Skip to content

feat(skills): skill-runner execution surface + close the raw library read (ent#139) - #1735

Merged
vybe merged 2 commits into
devfrom
feature/ent139-skill-runner
Jul 23, 2026
Merged

vybe merged 2 commits into
devfrom
feature/ent139-skill-runner

Conversation

@dolho

@dolho dolho commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Related to Abilityai/trinity-enterprise#139 (OSS half; the gated module is Abilityai/trinity-enterprise#195).

1. Security fix — close the unrestricted library read

GET /api/skills/library/{name} returns a skill's full content — SKILL.md plus any bundled scripts/, i.e. executable material — behind a bare get_current_user. An agent-scoped key resolves to its owner, so any agent could pull arbitrary executable content out of the library and run it locally: self-acquisition with no chokepoint.

Now calls reject_agent_principal. This is edition-agnostic and stands on its own, which is why it lives in OSS rather than behind the entitlement. Listing stays open (name + description) so agents can still discover what exists — only the content fetch is closed.

⚠️ Behavior change: an agent-scoped MCP key calling get_skill now gets 403. Agents get skills two supported ways instead — assigned/injected by an operator, or executed on the runner under a per-skill allow-list. Neither needs raw content over REST.

2. MCP tools

run_skill(skill_name, input) and list_runnable_skills — structurally run_playbook (tools/connector.ts) pointed at the library. Both auto-register from the existing tool group; no server.ts change.

The tool-side allow-list check is not authorization — it exists only to turn a predictable refusal into a message listing what IS available. The backend re-checks the ACL at dispatch, and a failed pre-check falls through to the backend rather than failing open into "assume permitted". On an OSS build (no module mounted) both tools return an honest enabled: false / "not available on this platform" instead of throwing a stack trace at the agent.

3. Grid tile — first agent-class variant

AgentTile.vue keyed off agent.type === 'skill-runner' (the trinity.agent-type label), so:

  • no new per-agent field on the agents payload;
  • it degrades to the standard tile automatically — with the module unmounted no agent carries that type.

Adds a SKILL RUNNER identity chip (same shape as .sys-badge), a teal avatar ring, and an exposed-skill chip (or a warn chip when the runner exists but execution is off).

The ring uses a CSS var (--gv-ring-runner, defined per-theme in FleetGrid.vue) rather than a Tailwind class — there is no teal token in tailwind.config.js, and an invented class name renders no border at all, silently. Light and dark values both defined.

Status rides the Grid's existing visibility-aware refreshBatchData — no new polling loop — and the endpoint is admin-only, so a non-admin viewer keeps null and gets the standard tile.

Deliberately scoped as an in-tile variant rather than a new component, so it does not pre-empt epic Abilityai/trinity-enterprise#94's tile-variant architecture.

Verification

  • npx tsc --noEmit on the MCP server → clean.
  • @vue/compiler-sfc parse + compileScript + compileTemplate on AgentTile.vue and FleetGrid.vue → clean. (A full npm run build fails on this machine for an unrelated pre-existing reason: mermaid is in package.json but missing from the local node_modules, breaking AgentWorkspace.vue.)
  • pytest tests/unit -k "skill or models_centralized or auth_wiring or enumeration" → 138 passed, 3 skipped.
  • Live: GET /api/skills/library still 200 for an admin JWT.

Not done

The Grid tile has not been seen rendered — no skill-runner agent exists on this stack (the module refuses to provision without a configured skills library), so the variant is verified by compilation and code inspection only, not visually.

🤖 Generated with Claude Code

dolho and others added 2 commits July 22, 2026 11:09
…read (ent#139)

OSS half of the skill runner. Three surfaces.

Backend: GET /api/skills/library/{name} returns a skill's full content —
SKILL.md plus any bundled scripts/, i.e. executable material — behind a bare
get_current_user. An agent-scoped key resolves to its owner, so before this any
agent could pull arbitrary executable content out of the library and run it
locally. That is self-acquisition with no chokepoint, so the endpoint now calls
reject_agent_principal. This stands on its own as an edition-agnostic security
fix, which is why it lives in OSS. Listing (name + description) stays open so
agents can still discover what exists.

MCP: run_skill and list_runnable_skills, structurally run_playbook pointed at
the library. The tool-side allow-list check exists only to turn a predictable
refusal into a message listing what IS available — the backend re-checks at
dispatch, and a failed pre-check falls through rather than failing open into
"assume permitted". On an OSS build both tools return an honest disabled/
unavailable status instead of throwing.

Grid: AgentTile gains its first agent-class variant, keyed off
agent.type === 'skill-runner' (the trinity.agent-type label), so it needs no new
per-agent field and degrades to the standard tile when the feature is absent —
with the module unmounted no agent carries that type. Identity chip, teal avatar
ring and an exposed-skill chip. The ring uses a CSS var rather than a Tailwind
class because there is no teal token in tailwind.config.js and an invented class
name renders no border at all, silently. Status rides the Grid's existing
visibility-aware batch refresh — no new polling loop — and is admin-only, so a
non-admin viewer keeps null and gets the standard tile.

Related to Abilityai/trinity-enterprise#139

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Live check rendered "1 skills exposed".

Related to Abilityai/trinity-enterprise#139

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@dolho

dolho commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Live-tested against a real instance alongside Abilityai/trinity-enterprise#195.

Verified live:

  • GET /api/skills/library/{name} — agent-scoped key 403, admin 200. The gating works and does not disturb operators.
  • Listing (GET /api/skills/library) still 200 for an agent key, so discovery is preserved as intended.
  • MCP end-to-end over real JSON-RPC with an agent's own TRINITY_MCP_API_KEY: after rebuilding the MCP image, tool count 97 → 102, both run_skill and list_runnable_skills advertised. list_runnable_skills returned exactly the caller's permitted set (1 of 2 library skills); run_skill("word-count") returned a real result with cost and execution_id; run_skill("secret-skill") returned the structured refusal with available: ["word-count"].
  • Grid tile data confirmed: the runner reports type: "skill-runner" on /api/agents, and the status endpoint yields the expected badge/chip/tooltip values.

Fixed after live check (b56b319): the chip rendered "1 skills exposed" — pluralized.

Not verified:

  • The tile was never seen rendered. Data + compile only — no browser tooling available in this session. Worth a visual pass before merge, particularly the teal ring/badge in dark mode.
  • get_skill remains advertised as an MCP tool to agent-scoped keys even though it now always 403s for them. Harmless but slightly untidy; hiding it from agent keys would need a canAccess change I did not want to make unasked.

Note for reviewers: the MCP server is a baked image (no bind mount), so npm run build on the host is not enough — docker compose build mcp-server is required to pick these tools up.

@github-actions

Copy link
Copy Markdown

⚠️ Nightly unit-suite check skipped — merge conflict against dev.

Resolve by running git merge dev locally and pushing the result. The next nightly run will re-test once the conflict is gone.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validated: OSS half of ent#139 (standalone security fix closing the agent-key library-content read + graceful-fallback MCP tools + degrading grid tile). Enterprise half merged with review fixes (single-slot pin). Earlier CI failure was the base-side hung-job flake; rerun green.

@vybe
vybe merged commit 6a5828e into dev Jul 23, 2026
28 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants