aigency 0.3.0 → 0.5.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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -0
  3. data/README.md +7 -15
  4. data/lib/aigency/aigent/current_time.rb +33 -0
  5. data/lib/aigency/aigent/shell.rb +124 -0
  6. data/lib/aigency/aigent.rb +110 -36
  7. data/lib/aigency/delegator.rb +11 -0
  8. data/lib/aigency/plugin/shell.rb +11 -0
  9. data/lib/aigency/plugin.rb +6 -2
  10. data/lib/aigency/rake.rb +13 -0
  11. data/lib/aigency/sandbox/copy_from_tempdir.rb +30 -0
  12. data/lib/aigency/sandbox/copy_to_tempdir.rb +30 -0
  13. data/lib/aigency/sandbox/exec.rb +2 -2
  14. data/lib/aigency/sandbox/helpers.rb +15 -0
  15. data/lib/aigency/sandbox.rb +9 -5
  16. data/lib/aigency/shell.rb +4 -11
  17. data/lib/aigency/tempdir/helpers.rb +15 -0
  18. data/lib/aigency/tempdir/list.rb +18 -0
  19. data/lib/aigency/tempdir/read.rb +28 -0
  20. data/lib/aigency/tempdir/size.rb +27 -0
  21. data/lib/aigency/tempdir/write.rb +28 -0
  22. data/lib/aigency/tempdir.rb +19 -0
  23. data/lib/aigency/tool.rb +5 -0
  24. data/lib/aigency/usability.rb +1 -0
  25. data/lib/aigency/version.rb +1 -1
  26. data/lib/aigency/workspace/cat.rb +2 -2
  27. data/lib/aigency/workspace/{shell.rb → cmd.rb} +3 -3
  28. data/lib/aigency/workspace/copy_from_tempdir.rb +29 -0
  29. data/lib/aigency/workspace/copy_to_tempdir.rb +29 -0
  30. data/lib/aigency/workspace/cp.rb +2 -2
  31. data/lib/aigency/workspace/diff.rb +2 -2
  32. data/lib/aigency/workspace/grep.rb +2 -2
  33. data/lib/aigency/workspace/head.rb +2 -2
  34. data/lib/aigency/workspace/ls.rb +2 -2
  35. data/lib/aigency/workspace/mkdir.rb +2 -2
  36. data/lib/aigency/workspace/mv.rb +2 -2
  37. data/lib/aigency/workspace/rm.rb +2 -2
  38. data/lib/aigency/workspace/tail.rb +2 -2
  39. data/lib/aigency/workspace/wc.rb +2 -2
  40. data/lib/aigency/workspace/write.rb +2 -2
  41. data/lib/aigency/workspace.rb +4 -4
  42. data/lib/aigency.rb +16 -14
  43. data/scaffold/{Rakefile → aigent/aigent.rake} +1 -10
  44. data/scaffold/{.gitignore → enlist/.gitignore} +1 -0
  45. data/scaffold/{README.md → enlist/README.md} +7 -3
  46. data/scaffold/enlist/Rakefile +9 -0
  47. data/scaffold/enlist/bin/aigent +11 -0
  48. data/scaffold/{config → enlist/config}/schedule.rb +5 -0
  49. data/scaffold/sandbox/Dockerfile +37 -0
  50. data/scaffold/sandbox/docker-compose.yml +37 -0
  51. data/{lib/aigency/sandbox/squid.conf.tpl → scaffold/sandbox/squid.conf} +4 -2
  52. data/scaffold/sandbox/ssh_config +2 -0
  53. metadata +49 -17
  54. data/lib/aigency/sandbox/Dockerfile.tpl +0 -13
  55. data/lib/aigency/sandbox/docker-compose.yml.tpl +0 -26
  56. data/scaffold/config/aigent.yml +0 -9
  57. /data/scaffold/{.env.example → enlist/.env.example} +0 -0
  58. /data/scaffold/{Gemfile → enlist/Gemfile} +0 -0
  59. /data/scaffold/{IDENTITY.md → enlist/IDENTITY.md} +0 -0
@@ -2,16 +2,20 @@
2
2
 
3
3
  module Aigency
4
4
  module Sandbox
5
+ require 'aigency/sandbox/helpers'
5
6
  require 'aigency/sandbox/exec'
7
+ require 'aigency/sandbox/copy_from_tempdir'
8
+ require 'aigency/sandbox/copy_to_tempdir'
6
9
 
7
10
  Plugin.register Plugin.new(
8
11
  'sandbox',
9
- tools: [Sandbox::Exec],
10
- directories: ['data/sandbox', 'data/sandbox_ssh'],
12
+ tools: [Exec, CopyFromTempdir, CopyToTempdir],
13
+ directories: ['sandbox', 'data/sandbox', 'data/sandbox_ssh'],
11
14
  files: {
12
- 'Dockerfile' => File.read(File.join(__dir__, 'sandbox', 'Dockerfile.tpl')),
13
- 'docker-compose.yml' => File.read(File.join(__dir__, 'sandbox', 'docker-compose.yml.tpl')),
14
- 'squid.conf' => File.read(File.join(__dir__, 'sandbox', 'squid.conf.tpl'))
15
+ 'sandbox/Dockerfile' => File.read(File.join(GEM_PATH, 'scaffold', 'sandbox', 'Dockerfile')),
16
+ 'sandbox/squid.conf' => File.read(File.join(GEM_PATH, 'scaffold', 'sandbox', 'squid.conf')),
17
+ 'docker-compose.yml' => File.read(File.join(GEM_PATH, 'scaffold', 'sandbox', 'docker-compose.yml')),
18
+ 'data/sandbox_ssh/config' => File.read(File.join(GEM_PATH, 'scaffold', 'sandbox', 'ssh_config'))
15
19
  },
16
20
  config: <<~FILE
17
21
  prompt: "The sandbox tools provide access to a Docker container."
data/lib/aigency/shell.rb CHANGED
@@ -4,9 +4,11 @@ require 'fileutils'
4
4
  require 'thor'
5
5
 
6
6
  module Aigency
7
+ # Top-level aigency commands for creating aigents.
8
+ #
7
9
  class Shell < Thor
8
10
  map %i[new] => :enlist
9
- desc "enlist [DIRECTORY]", "Enable the current user as an aigent"
11
+ desc "enlist [DIRECTORY]", "Create an aigent directory"
10
12
  def enlist directory = 'aigent'
11
13
  puts "Installing aigent at #{directory}"
12
14
  if File.exist?(directory)
@@ -18,16 +20,7 @@ module Aigency
18
20
  end
19
21
  end
20
22
  FileUtils.mkdir(directory) unless File.directory?(directory)
21
- FileUtils.copy_entry(File.join(GEM_PATH, 'scaffold'), directory)
23
+ FileUtils.copy_entry(File.join(GEM_PATH, 'scaffold', 'enlist'), directory)
22
24
  end
23
-
24
- # desc "setup PLUGIN [...PLUGIN]", "Initialize plugin files"
25
- # option :all, type: :boolean, alias: :a, description: "Set up all plugins", default: false
26
- # option :overwrite, type: :boolean, alias: :o, description: "Overwrite existing files", default: false
27
- # def setup *plugins
28
- # # @todo Assuming all for now
29
- # aigent = Aigent.new(aigent)
30
- # aigent.setup
31
- # end
32
25
  end
33
26
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aigency
4
+ module Tempdir
5
+ module Helpers
6
+ module_function
7
+
8
+ def expand_in_tempdir path
9
+ absolute = File.absolute_path(path, PATH)
10
+ raise PathError, "#{path} is not relative to tempdir" unless absolute.start_with?(PATH)
11
+ absolute
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aigency
4
+ module Tempdir
5
+ class List < Tool
6
+ description "List all files in the temp directory"
7
+
8
+ def execute
9
+ aigent.log.puts "[Tempdir::List]"
10
+ files = Dir.glob(File.join(PATH, '**', '*'))
11
+ {
12
+ success: true,
13
+ files: files.map { |file| { path: file, size: File.size(file)} }
14
+ }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aigency
4
+ module Tempdir
5
+ class Read < Tool
6
+ include Helpers
7
+
8
+ description "Read a file from the temp directory"
9
+
10
+ parameters do
11
+ string :filename, description: "The file to read"
12
+ end
13
+
14
+ def execute(filename:)
15
+ aigent.log.puts "[Tempdir::Read] #{filename}"
16
+ absolute_path = expand_in_tempdir(filename)
17
+ # @todo Hardcoded max size
18
+ if File.size(absolute_path) > 500_000
19
+ { success: false, error: "File is too large to read (max 500000 bytes)"}
20
+ else
21
+ { success: true, filename: File.basename(absolute_path), content: File.read(absolute_path).scrub }
22
+ end
23
+ rescue StandardError => e
24
+ { success: false, error: "[#{e.class}] #{e.message}"}
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aigency
4
+ module Tempdir
5
+ class Size < Tool
6
+ include Helpers
7
+
8
+ description "Get the size of a file in the temp directory"
9
+
10
+ parameters do
11
+ string :filename, description: "The file to measure"
12
+ end
13
+
14
+ def execute(filename:)
15
+ aigent.log.puts "[Tempdir::Read] #{filename}"
16
+ absolute_path = expand_in_tempdir(filename)
17
+ {
18
+ success: true,
19
+ absolute_path: absolute_path,
20
+ size: File.size(absolute_path)
21
+ }
22
+ rescue StandardError => e
23
+ { success: false, error: "[#{e.class}] #{e.message}"}
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aigency
4
+ module Tempdir
5
+ class Write < Tool
6
+ include Helpers
7
+
8
+ description "Write a file in the temp directory"
9
+
10
+ parameters do
11
+ string :filename, description: "The filename to write"
12
+ string :content, description: "The file's content"
13
+ end
14
+
15
+ def execute(filename:, content:)
16
+ aigent.log.puts "[Tempdir::Write] #{filename}"
17
+ absolute_path = expand_in_tempdir(filename)
18
+ File.binwrite absolute_path, content
19
+ {
20
+ success: true,
21
+ absolute_path: absolute_path
22
+ }
23
+ rescue StandardError => e
24
+ { success: false, error: "[#{e.class}] #{e.message}"}
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tmpdir'
4
+ require 'fileutils'
5
+
6
+ module Aigency
7
+ module Tempdir
8
+ require 'aigency/tempdir/helpers'
9
+ require 'aigency/tempdir/list'
10
+ require 'aigency/tempdir/read'
11
+ require 'aigency/tempdir/write'
12
+ require 'aigency/tempdir/size'
13
+
14
+ PATH = Dir.mktmpdir
15
+ TOOLS = [List, Read, Write, Size]
16
+
17
+ at_exit { FileUtils.rm_rf PATH }
18
+ end
19
+ end
data/lib/aigency/tool.rb CHANGED
@@ -5,5 +5,10 @@ module Aigency
5
5
  #
6
6
  class Tool < RubyLLM::Tool
7
7
  include Usability
8
+
9
+ # class << self
10
+ # alias desc description
11
+ # alias params parameters
12
+ # end
8
13
  end
9
14
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  module Aigency
4
4
  module Usability
5
+ # @return [Aigent]
5
6
  attr_reader :aigent
6
7
 
7
8
  def initialize(aigent)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Aigency
4
- VERSION = '0.3.0'
4
+ VERSION = '0.5.0'
5
5
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Aigency
4
4
  module Workspace
5
- class Cat < Shell
6
- desc 'Run the `cat` shell command in your workspace'
5
+ class Cat < Cmd
6
+ description 'Run the `cat` shell command in your workspace'
7
7
 
8
8
  def command = 'cat'
9
9
  end
@@ -4,7 +4,7 @@ require 'open3'
4
4
 
5
5
  module Aigency
6
6
  module Workspace
7
- class Shell < Tool
7
+ class Cmd < Tool
8
8
  include Helpers
9
9
 
10
10
  # @abstract
@@ -28,13 +28,13 @@ module Aigency
28
28
  end
29
29
  validate_path_arguments(arguments, non_path_arguments.length)
30
30
  output, error, result = Open3.capture3(command, *arguments, chdir: resolved)
31
- { success: result.success?, stdout: output, stderr: error }
31
+ { success: result.success?, stdout: output.scrub, stderr: error.scrub }
32
32
  rescue StandardError => e
33
33
  { success: false, error: "[#{e.class}] #{e.message}" }
34
34
  end
35
35
 
36
36
  def self.inherited other
37
- other.params do
37
+ other.parameters do
38
38
  string :directory, description: "The working directory relative to workspace", required: false
39
39
  array :arguments, of: :string, description: "Command arguments", required: false
40
40
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+
5
+ module Aigency
6
+ module Workspace
7
+ class CopyFromTempdir < Tool
8
+ include Tempdir::Helpers
9
+ include Workspace::Helpers
10
+
11
+ description 'Copy a file from tempdir to workspace'
12
+
13
+ parameters do
14
+ string :tempdir_source, description: "A source filename in tempdir", required: true
15
+ string :workspace_destination, description: "A destination filename in workspace", required: true
16
+ end
17
+
18
+ def execute(tempdir_source:, workspace_destination:)
19
+ aigent.log.puts "[Workspace::CopyTempdirFile] #{tempdir_source.inspect} #{workspace_destination.inspect}"
20
+ abs_tempdir = expand_in_tempdir(tempdir_source)
21
+ abs_workspace = expand_in_workspace(workspace_destination)
22
+ FileUtils.copy_file abs_tempdir, abs_workspace
23
+ { success: true, file: abs_workspace }
24
+ rescue StandardError => e
25
+ { success: false, error: "[#{e.class}] #{e.message}"}
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+
5
+ module Aigency
6
+ module Workspace
7
+ class CopyToTempdir < Tool
8
+ include Tempdir::Helpers
9
+ include Workspace::Helpers
10
+
11
+ description 'Copy a file from workspace to tempdir'
12
+
13
+ parameters do
14
+ string :workspace_source, description: "A source filename in workspace", required: true
15
+ string :tempdir_destination, description: "A destination filename in tempdir", required: true
16
+ end
17
+
18
+ def execute(workspace_source:, tempdir_destination:)
19
+ aigent.log.puts "[Workspace::CopyTempdirFile] #{workspace_source} #{tempdir_destination}"
20
+ abs_workspace = expand_in_workspace(workspace_source)
21
+ abs_tempdir = expand_in_tempdir(tempdir_destination)
22
+ FileUtils.copy_file abs_workspace, abs_tempdir
23
+ { success: true, file: abs_tempdir }
24
+ rescue StandardError => e
25
+ { success: false, error: "[#{e.class}] #{e.message}"}
26
+ end
27
+ end
28
+ end
29
+ end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Aigency
4
4
  module Workspace
5
- class Cp < Shell
6
- desc 'Run the `cp` shell command in your workspace'
5
+ class Cp < Cmd
6
+ description 'Run the `cp` shell command in your workspace'
7
7
 
8
8
  def command = 'cp'
9
9
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Aigency
4
4
  module Workspace
5
- class Diff < Shell
6
- desc 'Run the `diff` shell command in your workspace'
5
+ class Diff < Cmd
6
+ description 'Run the `diff` shell command in your workspace'
7
7
 
8
8
  def command = 'diff'
9
9
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Aigency
4
4
  module Workspace
5
- class Grep < Shell
6
- desc 'Run the `grep` shell command in your workspace'
5
+ class Grep < Cmd
6
+ description 'Run the `grep` shell command in your workspace'
7
7
 
8
8
  def command = 'grep'
9
9
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Aigency
4
4
  module Workspace
5
- class Head < Shell
6
- desc 'Run the `head` shell command in your workspace'
5
+ class Head < Cmd
6
+ description 'Run the `head` shell command in your workspace'
7
7
 
8
8
  def command = 'head'
9
9
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Aigency
4
4
  module Workspace
5
- class Ls < Shell
6
- desc 'Run the `ls` shell command in your workspace'
5
+ class Ls < Cmd
6
+ description 'Run the `ls` shell command in your workspace'
7
7
 
8
8
  def command = 'ls'
9
9
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Aigency
4
4
  module Workspace
5
- class Mkdir < Shell
6
- desc 'Run the `mkdir` shell command in your workspace'
5
+ class Mkdir < Cmd
6
+ description 'Run the `mkdir` shell command in your workspace'
7
7
 
8
8
  def command = 'mkdir'
9
9
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Aigency
4
4
  module Workspace
5
- class Mv < Shell
6
- desc 'Run the `mv` shell command in your workspace'
5
+ class Mv < Cmd
6
+ description 'Run the `mv` shell command in your workspace'
7
7
 
8
8
  def command = 'mv'
9
9
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Aigency
4
4
  module Workspace
5
- class Rm < Shell
6
- desc 'Run the `rm` shell command in your workspace'
5
+ class Rm < Cmd
6
+ description 'Run the `rm` shell command in your workspace'
7
7
 
8
8
  def command = 'rm'
9
9
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Aigency
4
4
  module Workspace
5
- class Tail < Shell
6
- desc 'Run the `tail` shell command in your workspace'
5
+ class Tail < Cmd
6
+ description 'Run the `tail` shell command in your workspace'
7
7
 
8
8
  def command = 'tail'
9
9
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Aigency
4
4
  module Workspace
5
- class Wc < Shell
6
- desc 'Run the `wc` shell command in your workspace'
5
+ class Wc < Cmd
6
+ description 'Run the `wc` shell command in your workspace'
7
7
 
8
8
  def command = 'wc'
9
9
 
@@ -10,9 +10,9 @@ module Aigency
10
10
  class Write < Tool
11
11
  include Helpers
12
12
 
13
- desc 'Write or append to a file in the workspace'
13
+ description 'Write or append to a file in the workspace'
14
14
 
15
- params do
15
+ parameters do
16
16
  string :filename, description: "The filename relative to the workspace", required: true
17
17
  string :content, description: "The data to write to the file", required: true
18
18
  string :append, description: "Append if true or overwrite if false", required: true
@@ -2,10 +2,8 @@
2
2
 
3
3
  module Aigency
4
4
  module Workspace
5
- class PathError < ArgumentError; end
6
-
7
5
  require 'aigency/workspace/helpers'
8
- require 'aigency/workspace/shell'
6
+ require 'aigency/workspace/cmd'
9
7
  require 'aigency/workspace/cat'
10
8
  require 'aigency/workspace/cp'
11
9
  require 'aigency/workspace/diff'
@@ -16,11 +14,13 @@ module Aigency
16
14
  require 'aigency/workspace/rm'
17
15
  require 'aigency/workspace/wc'
18
16
  require 'aigency/workspace/write'
17
+ require 'aigency/workspace/copy_from_tempdir'
18
+ require 'aigency/workspace/copy_to_tempdir'
19
19
 
20
20
  Plugin.register Plugin.new(
21
21
  'workspace',
22
22
  directories: ['data/workspace'],
23
- tools: [Cat, Cp, Diff, Grep, Ls, Mkdir, Mv, Rm, Wc, Write],
23
+ tools: [Cat, Cp, Diff, Grep, Ls, Mkdir, Mv, Rm, Wc, Write, CopyFromTempdir, CopyToTempdir],
24
24
  config: <<~FILE
25
25
  prompt: "The workspace tools provide access to a readable and writeable directory."
26
26
  FILE
data/lib/aigency.rb CHANGED
@@ -2,21 +2,23 @@
2
2
 
3
3
  require 'ruby_llm'
4
4
 
5
- # Core
6
- require 'aigency/version'
7
- require 'aigency/usability'
8
- require 'aigency/tool'
9
- require 'aigency/aigent'
10
- require 'aigency/plugin'
11
- require 'aigency/shell'
12
-
13
- # Extensions
14
- require 'aigency/workspace'
15
- require 'aigency/sandbox'
16
-
17
5
  module Aigency
6
+ class PathError < ArgumentError; end
7
+
18
8
  GEM_PATH = File.absolute_path(File.join(__dir__, '..'))
19
9
 
20
- class Error < StandardError; end
21
- # Your code goes here...
10
+ # Core
11
+ require 'aigency/version'
12
+ require 'aigency/usability'
13
+ require 'aigency/tool'
14
+ require 'aigency/delegator'
15
+ require 'aigency/plugin'
16
+ require 'aigency/aigent'
17
+ require 'aigency/shell'
18
+ require 'aigency/rake'
19
+
20
+ # Plugins and Tools
21
+ require 'aigency/sandbox'
22
+ require 'aigency/tempdir'
23
+ require 'aigency/workspace'
22
24
  end
@@ -1,7 +1,4 @@
1
- require "bundler/setup"
2
- require 'yaml'
3
- require 'dotenv/load'
4
- require 'aigency'
1
+ # frozen_string_literal: true
5
2
 
6
3
  desc "Run a prompt from a file"
7
4
  task :load, [:filename] do |_, args|
@@ -17,12 +14,6 @@ task :load, [:filename] do |_, args|
17
14
  end
18
15
  end
19
16
 
20
- desc "Talk to the aigent"
21
- task :say, [:text] do |_, args|
22
- aigent = Aigency::Aigent.new('.')
23
- aigent.stream args[:text]
24
- end
25
-
26
17
  desc "Set up aigent plugins"
27
18
  task :setup do
28
19
  aigent = Aigency::Aigent.new('.')
@@ -1 +1,2 @@
1
1
  data
2
+ .env
@@ -38,7 +38,7 @@ The `workspace` plugin gives your aigent a directory where it can manage its own
38
38
 
39
39
  The `sandbox` plugin provides a container where the aigent can not only manage files, but also run commands and scripts.
40
40
 
41
- The `workspace` plugin is sufficient for many aigents. Switch to `sandbox` if you need your aigent to perform complex tasks.
41
+ The `workspace` plugin is sufficient for many aigents. Switch to `sandbox` if you need your aigent to perform software development or other complex tasks.
42
42
 
43
43
  ### 5. Run setup
44
44
 
@@ -50,10 +50,10 @@ rake setup
50
50
 
51
51
  ### Interactive Mode
52
52
 
53
- Talk to your aigent using the Rake task:
53
+ Talk to your aigent using the `say` command:
54
54
 
55
55
  ```bash
56
- rake say["How many fibers are intertwined in a shredded wheat biscuit?"]
56
+ bin/aigent say "How many fibers are intertwined in a shredded wheat biscuit?"
57
57
  ```
58
58
 
59
59
  ### Scheduling Tasks
@@ -84,3 +84,7 @@ If you enable the `sandbox` plugin, you'll need to start the container:
84
84
  ```bash
85
85
  docker compose up -d
86
86
  ```
87
+
88
+ The sandbox app is initialized with an egress that only allows network access to domains that are whitelisted in `squid.conf`. See the `http_targets` and `ssh_targets` ACLs.
89
+
90
+ Manage the sandbox user's SSH configuration in `data/sandbox_ssh`.
@@ -0,0 +1,9 @@
1
+ require "bundler/setup"
2
+ require 'dotenv/load'
3
+ Bundler.require(:default)
4
+
5
+ Aigency::Rake.define('.')
6
+
7
+ # Run `rake --tasks` for a list of tasks provided by aigent plugins.
8
+
9
+ # Custom rake tasks can be added below.
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # turn off warning diagnostics from Ruby
5
+ $VERBOSE=nil
6
+
7
+ require "bundler/setup"
8
+ require 'dotenv/load'
9
+ Bundler.require(:default)
10
+
11
+ Aigency::Aigent::Shell.start(ARGV)
@@ -19,6 +19,11 @@
19
19
 
20
20
  # Learn more: http://github.com/javan/whenever
21
21
 
22
+ job_type :rake, "cd :path && :environment_variable=:environment :bundle_command rake :task :output"
23
+
24
+ set :output, File.join(Dir.pwd, 'data', 'log', 'cron.log')
25
+
26
+ # Example job: run a prompt from a file named `DAILY.md` once a day
22
27
  # every 1.day do
23
28
  # rake "load[DAILY.md]"
24
29
  # end
@@ -0,0 +1,37 @@
1
+ FROM alpine:latest
2
+
3
+ RUN apk update && apk upgrade && apk add --no-cache \
4
+ autoconf \
5
+ bash \
6
+ bison \
7
+ build-base \
8
+ curl \
9
+ git \
10
+ libffi-dev \
11
+ linux-headers \
12
+ mise \
13
+ musl-dev \
14
+ netcat-openbsd \
15
+ nodejs \
16
+ openssh \
17
+ openssl \
18
+ openssl-dev \
19
+ perl \
20
+ pkgconf \
21
+ python3 \
22
+ tzdata \
23
+ xz \
24
+ yaml-dev \
25
+ zlib-dev
26
+
27
+ RUN adduser -D -h /sandbox user \
28
+ && mkdir -p /opt/mise \
29
+ && chown -R user:user /opt/mise
30
+ USER user
31
+ ENV MISE_DATA_DIR=/opt/mise \
32
+ MISE_CONFIG_DIR=/opt/mise/config \
33
+ MISE_TRUSTED_CONFIG_PATHS=/sandbox \
34
+ PATH=/opt/mise/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
35
+ RUN mise use -g ruby@3.4 && mise install --yes
36
+
37
+ CMD ["sleep", "infinity"]