nexo_ai 0.11.0 → 0.13.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/.rdoc_options +5 -0
- data/CHANGELOG.md +95 -0
- data/README.md +13 -14
- data/Rakefile +5 -0
- data/docs/concurrency.md +1 -2
- data/docs/durable-workflows.md +5 -3
- data/docs/getting-started.md +1 -1
- data/docs/loops.md +62 -89
- data/docs/mcp.md +57 -51
- data/docs/rails.md +1 -1
- data/docs/sessions.md +7 -3
- data/docs/skills.md +20 -11
- data/docs/workflows.md +2 -2
- data/examples/mcp_filesystem.rb +1 -1
- data/lib/generators/nexo/artifacts/artifacts_generator.rb +9 -7
- data/lib/generators/nexo/artifacts/templates/add_artifacts_to_nexo_workflow_runs.rb +1 -1
- data/lib/generators/nexo/install/install_generator.rb +7 -5
- data/lib/generators/nexo/skill/skill_generator.rb +10 -8
- data/lib/generators/nexo/state/state_generator.rb +9 -7
- data/lib/generators/nexo/state/templates/add_state_to_nexo_workflow_runs.rb +1 -1
- data/lib/generators/nexo/workflows/templates/create_nexo_workflow_runs.rb +3 -3
- data/lib/generators/nexo/workflows/workflows_generator.rb +7 -5
- data/lib/nexo/agent.rb +159 -169
- data/lib/nexo/concurrent.rb +18 -16
- data/lib/nexo/configuration.rb +21 -21
- data/lib/nexo/engine.rb +1 -1
- data/lib/nexo/loop.rb +12 -14
- data/lib/nexo/loops/ruby_llm.rb +43 -34
- data/lib/nexo/mcp/gated_tool.rb +31 -27
- data/lib/nexo/mcp.rb +73 -68
- data/lib/nexo/output_truncator.rb +9 -9
- data/lib/nexo/permissions.rb +44 -46
- data/lib/nexo/read_tracker.rb +4 -4
- data/lib/nexo/run_store.rb +30 -28
- data/lib/nexo/sandbox.rb +29 -27
- data/lib/nexo/sandboxes/container.rb +75 -75
- data/lib/nexo/sandboxes/local.rb +15 -15
- data/lib/nexo/sandboxes/remote.rb +25 -23
- data/lib/nexo/sandboxes/virtual.rb +2 -2
- data/lib/nexo/sandboxes.rb +9 -9
- data/lib/nexo/session.rb +31 -29
- data/lib/nexo/skills/skill.rb +89 -0
- data/lib/nexo/skills.rb +33 -58
- data/lib/nexo/tools/fetch.rb +21 -21
- data/lib/nexo/tools/glob.rb +6 -6
- data/lib/nexo/tools/read_file.rb +8 -8
- data/lib/nexo/tools/shell.rb +7 -7
- data/lib/nexo/tools/web_search.rb +16 -16
- data/lib/nexo/tools/write_file.rb +11 -11
- data/lib/nexo/turbo_broadcaster.rb +1 -1
- data/lib/nexo/version.rb +2 -2
- data/lib/nexo/workflow.rb +207 -193
- data/lib/nexo/workflow_job.rb +6 -6
- data/lib/nexo/workflow_run.rb +10 -10
- data/lib/nexo.rb +28 -26
- data/sig/nexo/agent.rbs +1 -1
- metadata +7 -34
- data/lib/nexo/loops/agent_sdk.rb +0 -68
data/docs/skills.md
CHANGED
|
@@ -3,9 +3,8 @@ A skill is a `SKILL.md` package that teaches the model *how you want a task done
|
|
|
3
3
|
|
|
4
4
|
A **skill** is a `SKILL.md` package — frontmatter plus instructions — that teaches the
|
|
5
5
|
model *how you want a task done*. Skills guide **reasoning**; the sandbox-backed tools
|
|
6
|
-
above perform **execution**.
|
|
7
|
-
|
|
8
|
-
skill with one macro and no loader setup.
|
|
6
|
+
above perform **execution**. You attach a skill with one macro: Nexo reads the `SKILL.md`
|
|
7
|
+
itself, so there is no loader to set up and no extra gem to install.
|
|
9
8
|
|
|
10
9
|
Drop a package under `app/skills/` (or scaffold one — see below):
|
|
11
10
|
|
|
@@ -52,10 +51,20 @@ rails g nexo:skill triage
|
|
|
52
51
|
# create app/skills/triage/SKILL.md
|
|
53
52
|
```
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
Referencing a skill that does not exist raises `Nexo::Error` naming the missing
|
|
55
|
+
`SKILL.md` path, as does a `SKILL.md` with no YAML front matter.
|
|
56
|
+
|
|
57
|
+
> **Upgrading from 0.12:** remove `gem "ruby_llm-skills"` from your Gemfile — it is no
|
|
58
|
+
> longer used (and it pins `ruby_llm` 1.x). The `skills` macro, `Nexo::Skills.find` and
|
|
59
|
+
> `Nexo::Skills.materialize` are unchanged.
|
|
60
|
+
|
|
61
|
+
### Why not `ruby_llm`'s own skills?
|
|
62
|
+
|
|
63
|
+
`ruby_llm` 2.2 ships skills too (`chat.with_skills`). Nexo does not use them, for two
|
|
64
|
+
reasons. Its loader enforces the Agent Skills naming rule — lowercase words joined by
|
|
65
|
+
hyphens — and so rejects the underscore names Nexo resolves from a symbol (`skills
|
|
66
|
+
:email_triage`). And it works by giving the model a `load_skill` tool, where Nexo's rule is
|
|
67
|
+
that a skill adds instructions and nothing else.
|
|
59
68
|
|
|
60
69
|
## Say what a skill needs with `compatibility:`
|
|
61
70
|
|
|
@@ -82,15 +91,15 @@ exactly their body, unchanged.
|
|
|
82
91
|
It is **free text, by design** — the spec does not make it machine-checkable, and Nexo does
|
|
83
92
|
not try to. It is documentation aimed at a human or a model, not a dependency manifest:
|
|
84
93
|
provisioning the sandbox (a gem, a library, a config) is the job of whoever wires the agent
|
|
85
|
-
to it, not of the skill file. `license:` and `allowed-tools:` are
|
|
86
|
-
|
|
94
|
+
to it, not of the skill file. `license:` and `allowed-tools:` are read from the front
|
|
95
|
+
matter but deliberately **not** surfaced — the first is prompt noise, and the
|
|
87
96
|
second would compete with `Nexo::Permissions`, which is the real gate.
|
|
88
97
|
|
|
89
98
|
## Skill tools stay gated
|
|
90
99
|
|
|
91
100
|
A skill contributes **instructions only**. A loaded skill ships no independent tools, and
|
|
92
|
-
Nexo deliberately does not attach `ruby_llm
|
|
93
|
-
|
|
101
|
+
Nexo deliberately does not attach `ruby_llm`'s `load_skill` tool (which reads skill
|
|
102
|
+
files from the host, outside the sandbox) — so **attaching a skill never widens what an agent can
|
|
94
103
|
do** beyond its configured sandbox/permission mode.
|
|
95
104
|
|
|
96
105
|
## Bundled files are not reachable until you stage them
|
data/docs/workflows.md
CHANGED
|
@@ -176,7 +176,7 @@ artifact("digest.md", from: "app/templates/digest.md.erb",
|
|
|
176
176
|
> or uploaded template is remote code execution. If a body is untrusted, pass it
|
|
177
177
|
> as `content:` (inert data), not as a `from:` template.
|
|
178
178
|
|
|
179
|
-
See [`examples/artifact_from_template.rb`](
|
|
179
|
+
See [`examples/artifact_from_template.rb`](https://github.com/maquina-app/nexo/blob/main/examples/artifact_from_template.rb) for
|
|
180
180
|
the full offline flow (`ruby -Ilib examples/artifact_from_template.rb`).
|
|
181
181
|
### Agent output — `produces`
|
|
182
182
|
|
|
@@ -307,7 +307,7 @@ end
|
|
|
307
307
|
> *how* (skills/instructions). Driving an agent never widens its authority — its
|
|
308
308
|
> safe default (`:read_only`) is untouched.
|
|
309
309
|
|
|
310
|
-
See [`examples/inbox_digest_task.rb`](
|
|
310
|
+
See [`examples/inbox_digest_task.rb`](https://github.com/maquina-app/nexo/blob/main/examples/inbox_digest_task.rb) for a live
|
|
311
311
|
example that wraps the MCP-backed `InboxTriage` agent in a workflow and captures
|
|
312
312
|
the digest as an artifact.
|
|
313
313
|
|
data/examples/mcp_filesystem.rb
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
# * read tools are on the mcp_allow list -> the model can use them
|
|
8
8
|
# * write_file is NOT on the list -> the gate returns { error: ... } (denied)
|
|
9
9
|
#
|
|
10
|
-
# Requires:
|
|
10
|
+
# Requires: `npx` on PATH, and a model. MCP ships with ruby_llm — no extra gem.
|
|
11
11
|
#
|
|
12
12
|
# NEXO_LIVE=1 NEXO_MODEL=gemma3:12b ruby -Ilib examples/mcp_filesystem.rb /tmp
|
|
13
13
|
#
|
|
@@ -5,15 +5,17 @@ require "rails/generators/migration"
|
|
|
5
5
|
|
|
6
6
|
module Nexo
|
|
7
7
|
module Generators
|
|
8
|
-
# Adds the
|
|
8
|
+
# Adds the `artifacts` column to an already-installed `nexo_workflow_runs`
|
|
9
9
|
# table (Spec 7):
|
|
10
10
|
#
|
|
11
|
-
#
|
|
11
|
+
# ```sh
|
|
12
|
+
# rails g nexo:artifacts
|
|
13
|
+
# ```
|
|
12
14
|
#
|
|
13
|
-
# copies a timestamped, additive migration adding a
|
|
14
|
-
# (default
|
|
15
|
+
# copies a timestamped, additive migration adding a `json` `artifacts` column
|
|
16
|
+
# (default `[]`), after which `rails db:migrate` lets Nexo::Workflow runs
|
|
15
17
|
# record named artifacts. Fresh installs get the column from
|
|
16
|
-
#
|
|
18
|
+
# `nexo:workflows` directly; this generator is for apps installed before
|
|
17
19
|
# Spec 7. Modeled on WorkflowsGenerator.
|
|
18
20
|
class ArtifactsGenerator < Rails::Generators::Base
|
|
19
21
|
include Rails::Generators::Migration
|
|
@@ -27,8 +29,8 @@ module Nexo
|
|
|
27
29
|
::ActiveRecord::Migration.next_migration_number(next_migration_number)
|
|
28
30
|
end
|
|
29
31
|
|
|
30
|
-
# Generation step: copy the timestamped
|
|
31
|
-
#
|
|
32
|
+
# Generation step: copy the timestamped `artifacts`-column migration into
|
|
33
|
+
# `db/migrate`.
|
|
32
34
|
def create_migration_file
|
|
33
35
|
migration_template "add_artifacts_to_nexo_workflow_runs.rb", "db/migrate/add_artifacts_to_nexo_workflow_runs.rb"
|
|
34
36
|
end
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# column from create_nexo_workflow_runs directly). Portable json column, default
|
|
5
5
|
# [], matching the events column shape.
|
|
6
6
|
class AddArtifactsToNexoWorkflowRuns < ActiveRecord::Migration[8.0]
|
|
7
|
-
# Adds the
|
|
7
|
+
# Adds the `artifacts` json column (default `[]`) to `nexo_workflow_runs`.
|
|
8
8
|
def change
|
|
9
9
|
add_column :nexo_workflow_runs, :artifacts, :json, null: false, default: []
|
|
10
10
|
end
|
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
require "rails/generators"
|
|
4
4
|
|
|
5
5
|
module Nexo
|
|
6
|
-
# Namespace for Nexo's Rails generators (
|
|
7
|
-
#
|
|
6
|
+
# Namespace for Nexo's Rails generators (`rails g nexo:install`,
|
|
7
|
+
# `nexo:workflows`, `nexo:artifacts`, `nexo:state`, `nexo:skill`). Each is
|
|
8
8
|
# Rails-coupled and never autoloaded by the plain-Ruby core.
|
|
9
9
|
module Generators
|
|
10
10
|
# Sets up the conventional Nexo layout in a host Rails app:
|
|
11
11
|
#
|
|
12
|
-
#
|
|
12
|
+
# ```sh
|
|
13
|
+
# rails g nexo:install
|
|
14
|
+
# ```
|
|
13
15
|
#
|
|
14
16
|
# creates the app/agents, app/workflows and app/skills directories (each
|
|
15
17
|
# with a committable .keep) and a provider-neutral config/initializers/nexo.rb.
|
|
@@ -17,7 +19,7 @@ module Nexo
|
|
|
17
19
|
source_root File.expand_path("templates", __dir__)
|
|
18
20
|
|
|
19
21
|
# Generation step: create the app/agents, app/workflows, and app/skills
|
|
20
|
-
# directories, each with a committable
|
|
22
|
+
# directories, each with a committable `.keep`.
|
|
21
23
|
def create_directories
|
|
22
24
|
%w[app/agents app/workflows app/skills].each do |dir|
|
|
23
25
|
empty_directory dir
|
|
@@ -26,7 +28,7 @@ module Nexo
|
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
# Generation step: copy the provider-neutral
|
|
29
|
-
#
|
|
31
|
+
# `config/initializers/nexo.rb` into the host app.
|
|
30
32
|
def copy_initializer
|
|
31
33
|
copy_file "nexo.rb", "config/initializers/nexo.rb"
|
|
32
34
|
end
|
|
@@ -7,21 +7,23 @@ module Nexo
|
|
|
7
7
|
module Generators
|
|
8
8
|
# Scaffolds an Agent Skills package in a host Rails app:
|
|
9
9
|
#
|
|
10
|
-
#
|
|
10
|
+
# ```sh
|
|
11
|
+
# rails g nexo:skill triage
|
|
12
|
+
# ```
|
|
11
13
|
#
|
|
12
|
-
# creates
|
|
14
|
+
# creates `app/skills/triage/SKILL.md` (valid frontmatter + placeholder
|
|
13
15
|
# process steps, per agentskills.io/specification) and a kept
|
|
14
|
-
#
|
|
15
|
-
# cite. Reference it from an agent with the
|
|
16
|
+
# `app/skills/triage/references/` directory for supporting docs the skill can
|
|
17
|
+
# cite. Reference it from an agent with the `skills :triage` macro.
|
|
16
18
|
#
|
|
17
|
-
# Rails-coupled, like Nexo's other generators: it requires
|
|
19
|
+
# Rails-coupled, like Nexo's other generators: it requires `rails/generators`
|
|
18
20
|
# at load time and is never autoloaded by the plain-Ruby core, so
|
|
19
|
-
#
|
|
21
|
+
# `require "nexo"` with no Rails present neither defines nor fails on it.
|
|
20
22
|
class SkillGenerator < Rails::Generators::NamedBase
|
|
21
23
|
source_root File.expand_path("templates", __dir__)
|
|
22
24
|
|
|
23
|
-
# Generation step: scaffold
|
|
24
|
-
# directory and a valid
|
|
25
|
+
# Generation step: scaffold `app/skills/<name>/` with a kept `references/`
|
|
26
|
+
# directory and a valid `SKILL.md` rendered from the template.
|
|
25
27
|
def create_skill_package
|
|
26
28
|
empty_directory File.join(skill_root, "references")
|
|
27
29
|
# An empty references/ would not survive git; .keep keeps it tracked.
|
|
@@ -5,15 +5,17 @@ require "rails/generators/migration"
|
|
|
5
5
|
|
|
6
6
|
module Nexo
|
|
7
7
|
module Generators
|
|
8
|
-
# Adds the
|
|
8
|
+
# Adds the `state` column to an already-installed `nexo_workflow_runs` table
|
|
9
9
|
# (Spec 13):
|
|
10
10
|
#
|
|
11
|
-
#
|
|
11
|
+
# ```sh
|
|
12
|
+
# rails g nexo:state
|
|
13
|
+
# ```
|
|
12
14
|
#
|
|
13
|
-
# copies a timestamped, additive migration adding a
|
|
14
|
-
# (default
|
|
15
|
+
# copies a timestamped, additive migration adding a `json` `state` column
|
|
16
|
+
# (default `{}`), after which `rails db:migrate` lets Nexo::Workflow runs
|
|
15
17
|
# store checkpoint results and suspend metadata (durable suspend/resume).
|
|
16
|
-
# Fresh installs get the column from
|
|
18
|
+
# Fresh installs get the column from `nexo:workflows` directly; this generator
|
|
17
19
|
# is for apps installed before Spec 13. Modeled on ArtifactsGenerator.
|
|
18
20
|
class StateGenerator < Rails::Generators::Base
|
|
19
21
|
include Rails::Generators::Migration
|
|
@@ -27,8 +29,8 @@ module Nexo
|
|
|
27
29
|
::ActiveRecord::Migration.next_migration_number(next_migration_number)
|
|
28
30
|
end
|
|
29
31
|
|
|
30
|
-
# Generation step: copy the timestamped
|
|
31
|
-
#
|
|
32
|
+
# Generation step: copy the timestamped `state`-column migration into
|
|
33
|
+
# `db/migrate`.
|
|
32
34
|
def create_migration_file
|
|
33
35
|
migration_template "add_state_to_nexo_workflow_runs.rb", "db/migrate/add_state_to_nexo_workflow_runs.rb"
|
|
34
36
|
end
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# "__suspend__" suspend metadata. The migration version is resolved from the host
|
|
7
7
|
# app's ActiveRecord rather than hardcoded, so it tracks whatever Rails is installed.
|
|
8
8
|
class AddStateToNexoWorkflowRuns < ActiveRecord::Migration[ActiveRecord::Migration.current_version]
|
|
9
|
-
# Adds the
|
|
9
|
+
# Adds the `state` json object column (default `{}`) to `nexo_workflow_runs`.
|
|
10
10
|
def change
|
|
11
11
|
add_column :nexo_workflow_runs, :state, :json, null: false, default: {}
|
|
12
12
|
end
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
# SQLite and PostgreSQL without an adapter-aware path. The primary key is the
|
|
5
5
|
# UUID string id assigned by Nexo::WorkflowRun before_create.
|
|
6
6
|
class CreateNexoWorkflowRuns < ActiveRecord::Migration[8.0]
|
|
7
|
-
# Creates the
|
|
8
|
-
#
|
|
9
|
-
#
|
|
7
|
+
# Creates the `nexo_workflow_runs` table (UUID string primary key, portable
|
|
8
|
+
# `json` columns for payload/result/events/artifacts/state) plus indexes on
|
|
9
|
+
# `workflow_class` and `status`.
|
|
10
10
|
def change
|
|
11
11
|
create_table :nexo_workflow_runs, id: false do |t|
|
|
12
12
|
t.string :id, null: false, primary_key: true
|
|
@@ -7,10 +7,12 @@ module Nexo
|
|
|
7
7
|
module Generators
|
|
8
8
|
# Installs the WorkflowRun persistence schema into a host Rails app:
|
|
9
9
|
#
|
|
10
|
-
#
|
|
10
|
+
# ```sh
|
|
11
|
+
# rails g nexo:workflows
|
|
12
|
+
# ```
|
|
11
13
|
#
|
|
12
|
-
# copies a timestamped migration that creates the
|
|
13
|
-
# table, after which
|
|
14
|
+
# copies a timestamped migration that creates the `nexo_workflow_runs`
|
|
15
|
+
# table, after which `rails db:migrate` makes Nexo::Workflow runs persist
|
|
14
16
|
# to ActiveRecord instead of the in-memory store.
|
|
15
17
|
class WorkflowsGenerator < Rails::Generators::Base
|
|
16
18
|
include Rails::Generators::Migration
|
|
@@ -24,8 +26,8 @@ module Nexo
|
|
|
24
26
|
::ActiveRecord::Migration.next_migration_number(next_migration_number)
|
|
25
27
|
end
|
|
26
28
|
|
|
27
|
-
# Generation step: copy the timestamped
|
|
28
|
-
# migration into
|
|
29
|
+
# Generation step: copy the timestamped `create_nexo_workflow_runs`
|
|
30
|
+
# migration into `db/migrate`.
|
|
29
31
|
def create_migration_file
|
|
30
32
|
migration_template "create_nexo_workflow_runs.rb", "db/migrate/create_nexo_workflow_runs.rb"
|
|
31
33
|
end
|