Object ArtifactValidator

  • All Implemented Interfaces:

    
    public class ArtifactValidator
    
                        

    Lightweight validators for Browser4's four core artifact types.

    All validation is in-process (no external tools, no LSP, no browser session). The agent can supplement with:

    • coding.shell: mvn compile for plugin compilation

    • tab.eval for JS runtime testing

    • coding.shell: bash -n <file> / powershell -Command "..." for script syntax

    Zero dependencies — pure string/regex analysis.

    • Constructor Detail

    • Method Detail

      • validatePlugin

         final ValidationResult validatePlugin(String baseDir)

        Validate a Browser4 plugin directory.

        Parameters:
        baseDir - plugin base directory (containing pom.xml, src/, etc.
        Returns:

        validation result with issues found

      • validatePluginJson

         final List<ValidationIssue> validatePluginJson(String content, String fileName)

        Validate plugin.json content against the real ai.platon.pulsar.skeleton.plugin.PluginManifest contract: name + version required; description, dependsOn, autoConfigurationClasses optional.

      • validateSkill

         final ValidationResult validateSkill(String content, String fileName)

        Validate a SKILL.md file against the real ai.platon.pulsar.agentic.skills.SkillDefinitionLoader contract: YAML frontmatter with name (must equal the directory name, kebab-case) and description (1..1024 chars); optional allowed-tools.

        Parameters:
        fileName - should be the SKILL.md path (e.g.
      • validateToolReferences

         final List<ValidationIssue> validateToolReferences(String content, Map<String, Set<String>> knownTools, String fileName)

        Cross-check domain.method(...) references in an artifact (skill body, README, scripts) against the set of tools the LLM can actually see/call.

        The known-tools map is assembled by the caller from:

        • ai.platon.pulsar.agentic.tools.specs.ToolCallSpecificationRenderer builtin domain specs

        • ai.platon.pulsar.agentic.tools.CustomToolRegistry registered executors (plugins etc.)

        Grading (false-positive-safe):

        • ERROR for a domain that is definitely known but the method is not (typo in method)

        • WARNING for an unknown domain (may be a plugin not installed in this deployment)

        Parameters:
        content - artifact text to scan (SKILL.md body, README, etc.
        knownTools - map of tool domain -> set of method names visible to the agent
        fileName - artifact path for issue attribution
      • validateJs

         final ValidationResult validateJs(String content, String fileName)

        Validate a browser JS script's structural integrity.

        This is a static check only. For runtime validation, the agent should use tab.eval to execute the script and check for exceptions.