Skip to content

Rendered SKILL.tsx cannot import agent-bundle/meta (AB3003 wrapping AB4760) #440

Description

@ScriptedAlchemy

Summary

A rendered Skill (src/skills/<name>/SKILL.tsx) that imports agent-bundle/meta fails validation with AB3003 wrapping AB4760. The framework-mode docs say rendered skills "may import project code, so the document can be computed from the same sources the plugin ships", and that agent-bundle/meta is replaced "in every compiled surface" — but the Skill renderer evaluates the module outside the compiler's specifier replacement, so a skill cannot print the plugin version it documents.

Found while porting the cargo-hauler plugin (ScriptedAlchemy/cargo-hauler) to a full framework-mode app on preview 4edbd493b.

Repro

mkdir -p repro/src/skills/demo && cd repro
cat > package.json <<'EOF'
{ "name": "repro", "version": "0.0.1", "private": true, "type": "module" }
EOF
cat > agent-bundle.config.ts <<'EOF'
import { defineConfig } from 'agent-bundle/config';
export default defineConfig({ plugin: { description: 'repro', name: 'repro' }, targets: ['claude'] });
EOF
cat > src/skills/demo/SKILL.tsx <<'EOF'
import { version } from 'agent-bundle/meta';
import React from 'react';
export const frontmatter = { description: 'Demo rendered skill.', name: 'demo' };
export default () => (<><h1>Demo</h1><p>This document describes version <code>{version}</code>.</p></>);
EOF
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/agent-bundle@4edbd493b https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@4edbd493b react@19.2.8 zod@4.5.4
npx agent-bundle validate

Observed

[{"code":"AB3003","message":"Rendered Skill module failed to load: [AB4760] agent-bundle/meta is available only inside a surface Agent Bundle compiles; a plugin module reached it outside the compiler, so no project identity is available.\n  recovery: Run the test under agentBundleRstest() ... or compile the surface with `agent-bundle build`. ...","severity":"error","sourcePath":".../src/skills/demo/SKILL.tsx"},
 {"code":"AB4003","message":"Skill frontmatter description must have required property 'description'.", ...},
 {"code":"AB4002","message":"Skill frontmatter name must have required property 'name'.", ...}]

(AB4002/AB4003 are follow-on noise from the failed load; the skill exports both fields.)

Expected

Either the Skill renderer aliases agent-bundle/meta to the same generated identity module the compiler stamps (it already has the plugin identity at that point — it is inside validate/build), or the docs for rendered skills should state that agent-bundle/meta is not available there. The first is what a plugin author expects from "computed from the same sources the plugin ships".

Workaround

Do not import agent-bundle/meta from a rendered skill (the cargo-hauler skill prints no version for now).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions