Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix(automations): admit plugin sources in catalog bundles (#17403)

Graham Neubig70ce073cbe52
diff --git a/__tests__/manifests/manifest-validation.test.ts b/__tests__/manifests/manifest-validation.test.ts
index 367fcefd64..4a43b6da19 100644
--- a/__tests__/manifests/manifest-validation.test.ts
+++ b/__tests__/manifests/manifest-validation.test.ts
@@ -234,6 +234,20 @@ describe("validateSetupEntry", () => {
expect(result).toEqual({ valid: true, errors: [] });
});
+ it.each([
+ ["plugins/qa-changes/scripts/prompt.py", true],
+ ["plugins/../outside.py", false],
+ ["/plugins/qa-changes/scripts/prompt.py", false],
+ ])("validates plugin bundle source %s", (source, valid) => {
+ const entry = createSetupEntry({
+ setup: createSetup({
+ prompt: undefined,
+ bundle: { ...bundle, files: { "main.py": source } },
+ }),
+ });
+ expect(validateSetupEntry(entry).valid).toBe(valid);
+ });
+
// A bundle is the one part of a manifest naming files and a command this
// host acts on, so each of these would be acted on if it were admitted.
it.each([
@@ -279,7 +293,7 @@ describe("validateSetupEntry", () => {
},
],
[
- "a source outside skills/ and automations/",
+ "a source outside the published package",
{
setup: createSetup({
prompt: undefined,
diff --git a/src/manifests/manifest-validation.ts b/src/manifests/manifest-validation.ts
index b5c0aa722d..2234301371 100644
--- a/src/manifests/manifest-validation.ts
+++ b/src/manifests/manifest-validation.ts
@@ -42,7 +42,7 @@ const TEMPLATE_VERSION_PATTERN =
const BUNDLE_COMMAND_PATTERN = /^[A-Za-z0-9 ._/-]+$/;
const BUNDLE_PATH_PATTERN = /^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/;
const BUNDLE_SOURCE_PATTERN =
- /^(skills|automations)\/[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/;
+ /^(skills|automations|plugins)\/[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/;
/** Every `{{` must open a known namespace and close immediately. */
const UNKNOWN_PLACEHOLDER_PATTERN = new RegExp(
`\\{\\{(?!(?:${SETUP_PLACEHOLDER_NAMESPACES.join("|")})\\.[A-Za-z0-9_.]+\\}\\})`,
@@ -595,7 +595,7 @@ function checkBundle(check: SetupChecker, bundle: unknown): void {
if (!isRelativePath(source, BUNDLE_SOURCE_PATTERN)) {
check.fail(
`setup.bundle.files.${packedPath}`,
- "must name a file under skills/ or automations/",
+ "must name a file under skills/, automations/, or plugins/",
);
}
});