elelem 0.4.1 → 0.4.2

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: 0a92bbacb94cf0c5d56ce42a83f48efc0079f59cbafb066a7fdd3a8c382cadc1
4
- data.tar.gz: 8bdf5148c6e082a070dd528bde2165093cb0e34a82d5c9e7260e24eef0c5b9ca
3
+ metadata.gz: 7c9f3ee321bf585693ae2be5186a3b84f0122f282bcd8cb6d320b92931eb0d13
4
+ data.tar.gz: f9200f6646a49666394493f46a99ec5ebb157d415e35208a8cdb405736c822c1
5
5
  SHA512:
6
- metadata.gz: f9f80b2af42fc637d70dc1fbffc72af9fdb1e1465c7db4a54adf789ae02861e8c306319cb35ebe3152a28bd22fed9202fdd21dba54415492593ea98cfb5fed4d
7
- data.tar.gz: 6fb3ea9891e2ae9f9e5377791bae7ac46d89303134d8a1d65de87e550be7ddb38f1f12d83cc3e257b32623e232317eb2fc4b48ed3a2d92adf6e2d402d80ae04b
6
+ metadata.gz: b62630ba5787d5b7daa55113c01012ade1075f4d9618b43c6a4ce46643b4a29ce3d380c864070f6aa43e26732ae6e20b07f4ce7eb7b4b251b90fd83f5ff5c781
7
+ data.tar.gz: 48929614d89e694d9d153baa195276042d586a537f1197c588156cf8d192afd4b6b134bad5bd30c836a05358ff26607ae6b7531f5f71e33f9e0291f0d5331e2d
data/CHANGELOG.md CHANGED
@@ -1,9 +1,25 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.2] - 2025-12-01
4
+
5
+ ### Changed
6
+ - Renamed `exec` tool to `bash` for clarity
7
+ - Improved system prompt with iterative refinements
8
+ - Added environment context variables to system prompt
9
+
3
10
  ## [0.4.1] - 2025-11-26
4
11
 
5
12
  ### Added
6
- - Updated version to 0.4.1
13
+ - `elelem files` subcommand: generates Claude‑compatible XML file listings.
14
+ - Rake task `files:prompt` to output a ready‑to‑copy list of files for prompts.
15
+
16
+ ### Changed
17
+ - Refactor tool‑call formatting to a more compact JSON payload for better LLM parsing.
18
+ - Updated CI and documentation to use GitHub instead of previous hosting.
19
+ - Runtime validation of command‑line parameters against a JSON schema.
20
+
21
+ ### Fixed
22
+ - Minor documentation and CI workflow adjustments.
7
23
 
8
24
  ## [0.4.0] - 2025-11-10
9
25
 
@@ -122,16 +138,3 @@
122
138
 
123
139
  - Initial release
124
140
 
125
- ## [0.4.2] - 2025-11-27
126
-
127
- ### Added
128
- - `elelem files` subcommand: generates Claude‑compatible XML file listings.
129
- - Rake task `files:prompt` to output a ready‑to‑copy list of files for prompts.
130
-
131
- ### Changed
132
- - Refactor tool‑call formatting to a more compact JSON payload for better LLM parsing.
133
- - Updated CI and documentation to use GitHub instead of previous hosting.
134
- - Runtime validation of command‑line parameters against a JSON schema.
135
-
136
- ### Fixed
137
- - Minor documentation and CI workflow adjustments.
data/README.md CHANGED
@@ -125,13 +125,13 @@ seven tools, each represented by a JSON schema that the LLM can call.
125
125
 
126
126
  | Tool | Purpose | Parameters |
127
127
  | ---- | ------- | ---------- |
128
+ | `bash` | Run shell commands | `cmd`, `args`, `env`, `cwd`, `stdin` |
128
129
  | `eval` | Dynamically create new tools | `code` |
129
130
  | `grep` | Search Git‑tracked files | `query` |
130
131
  | `list` | List tracked files | `path` (optional) |
132
+ | `patch` | Apply a unified diff via `git apply` | `diff` |
131
133
  | `read` | Read file contents | `path` |
132
134
  | `write` | Overwrite a file | `path`, `content` |
133
- | `patch` | Apply a unified diff via `git apply` | `diff` |
134
- | `execute` | Run shell commands | `cmd`, `args`, `env`, `cwd`, `stdin` |
135
135
 
136
136
  ## Tool Definition
137
137
 
data/lib/elelem/agent.rb CHANGED
@@ -66,6 +66,7 @@ module Elelem
66
66
  end
67
67
 
68
68
  def format_tool_call_result(result)
69
+ return if result.nil?
69
70
  return result["stdout"] if result["stdout"]
70
71
  return result["stderr"] if result["stderr"]
71
72
  return result[:error] if result[:error]
@@ -80,7 +81,7 @@ module Elelem
80
81
  content = ""
81
82
  tool_calls = []
82
83
 
83
- print "Thinking..."
84
+ print "Assistant> Thinking..."
84
85
  client.chat(messages + turn_context, tools) do |chunk|
85
86
  msg = chunk["message"]
86
87
  if msg
@@ -45,19 +45,19 @@ module Elelem
45
45
 
46
46
  case mode.sort
47
47
  when [:read]
48
- "#{base}\n\nRead and analyze. Understand before suggesting action."
48
+ "#{base}\n\nYou may read files on the system."
49
49
  when [:write]
50
- "#{base}\n\nWrite clean, thoughtful code."
50
+ "#{base}\n\nYou may write files on the system."
51
51
  when [:execute]
52
- "#{base}\n\nUse shell commands creatively to understand and manipulate the system."
52
+ "#{base}\n\nYou may execute shell commands on the system."
53
53
  when [:read, :write]
54
- "#{base}\n\nFirst understand, then build solutions that integrate well."
54
+ "#{base}\n\nYou may read and write files on the system."
55
55
  when [:execute, :read]
56
- "#{base}\n\nUse commands to deeply understand the system."
56
+ "#{base}\n\nYou may execute shell commands and read files on the system."
57
57
  when [:execute, :write]
58
- "#{base}\n\nCreate and execute freely. Have fun. Be kind."
58
+ "#{base}\n\nYou may execute shell commands and write files on the system."
59
59
  when [:execute, :read, :write]
60
- "#{base}\n\nYou have all tools. Use them wisely."
60
+ "#{base}\n\nYou may read files, write files and execute shell commands on the system."
61
61
  else
62
62
  base
63
63
  end
@@ -1,5 +1,15 @@
1
- You are a reasoning coding and system agent working from: <%= Dir.pwd %>.
1
+ You are a reasoning coding and system agent.
2
2
 
3
- - Less is more
4
- - No code comments
5
- - No trailing whitespace
3
+ ## System
4
+
5
+ Operating System: <%= `uname -a` %>
6
+ USER: <%= ENV['USER'] %>
7
+ HOME: <%= ENV['HOME'] %>
8
+ SHELL: <%= ENV['SHELL'] %>
9
+ PATH: <%= ENV['PATH'] %>
10
+ PWD: <%= ENV['PWD'] %>
11
+ LANG: <%= ENV['LANG'] %>
12
+ EDITOR: <%= ENV['EDITOR'] %>
13
+ LOGNAME: <%= ENV['LOGNAME'] %>
14
+ TERM: <%= ENV['TERM'] %>
15
+ MAIL: <%= ENV['MAIL'] %>
data/lib/elelem/tool.rb CHANGED
@@ -11,7 +11,9 @@ module Elelem
11
11
  end
12
12
 
13
13
  def call(args)
14
- return ArgumentError.new(args) unless valid?(args)
14
+ unless valid?(args)
15
+ return { error: "Invalid args for #{@name}", received: args.keys, expected: @schema.dig(:function, :parameters, :required) }
16
+ end
15
17
 
16
18
  @block.call(args)
17
19
  end
@@ -8,7 +8,7 @@ module Elelem
8
8
  full_path.exist? ? { content: full_path.read } : { error: "File not found: #{path}" }
9
9
  end
10
10
 
11
- EXEC_TOOL = Tool.build("execute", "Run shell commands. For git: execute({\"cmd\": \"git\", \"args\": [\"log\", \"--oneline\"]}). Returns stdout/stderr/exit_status.", { cmd: { type: "string" }, args: { type: "array", items: { type: "string" } }, env: { type: "object", additionalProperties: { type: "string" } }, cwd: { type: "string", description: "Working directory (defaults to current)" }, stdin: { type: "string" } }, ["cmd"]) do |args|
11
+ BASH_TOOL = Tool.build("bash", "Run shell commands. For git: bash({\"cmd\": \"git\", \"args\": [\"log\", \"--oneline\"]}). Returns stdout/stderr/exit_status.", { cmd: { type: "string" }, args: { type: "array", items: { type: "string" } }, env: { type: "object", additionalProperties: { type: "string" } }, cwd: { type: "string", description: "Working directory (defaults to current)" }, stdin: { type: "string" } }, ["cmd"]) do |args|
12
12
  Elelem.shell.execute(
13
13
  args["cmd"],
14
14
  args: args["args"] || [],
@@ -42,7 +42,7 @@ module Elelem
42
42
  @tools_by_name = {}
43
43
  @tools = { read: [], write: [], execute: [] }
44
44
  add_tool(eval_tool(binding), :execute)
45
- add_tool(EXEC_TOOL, :execute)
45
+ add_tool(BASH_TOOL, :execute)
46
46
  add_tool(GREP_TOOL, :read)
47
47
  add_tool(LIST_TOOL, :read)
48
48
  add_tool(PATCH_TOOL, :write)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Elelem
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elelem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan