feat(FN-3767): add task runtime env injection into executor commands via pl
Adds executor runtime environment support to the plugin system, enabling plugins to contribute environment variables that get injected into executor commands. The implementation includes new plugin types (`ExecutorRuntimeEnvPlugin`), aggregation in the plugin runner, thread-through into executor com Fusion-Task-Id: FN-3767
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, expectTypeOf, it } from "vitest";
|
||||
import type {
|
||||
FusionPlugin,
|
||||
PluginPromptContributions,
|
||||
PluginPromptSurface,
|
||||
PluginSetupCheckResult,
|
||||
ExecutorRuntimeEnvContribution,
|
||||
ExecutorRuntimeTaskContext,
|
||||
PluginSetupHooks,
|
||||
PluginSetupManifest,
|
||||
PluginSkillContribution,
|
||||
@@ -129,6 +131,28 @@ describe("plugin contribution type constraints", () => {
|
||||
expect(byPlugin["fusion-plugin-agent-browser"]?.contributions).toHaveLength(5);
|
||||
});
|
||||
|
||||
it("accepts executor runtime env contribution shape and hook typing", () => {
|
||||
const contribution: ExecutorRuntimeEnvContribution = {
|
||||
pathPrepend: ["/tmp/bin"],
|
||||
env: { SERVICE_TOKEN: "redacted" },
|
||||
description: "runtime contribution",
|
||||
};
|
||||
|
||||
const plugin: FusionPlugin = {
|
||||
manifest: { id: "plugin-runtime-env", name: "Runtime Env", version: "1.0.0" },
|
||||
state: "installed",
|
||||
hooks: {},
|
||||
executorRuntimeEnv: (taskCtx: ExecutorRuntimeTaskContext) => ({
|
||||
pathPrepend: [taskCtx.worktreePath],
|
||||
env: { TASK_ID: taskCtx.taskId },
|
||||
}),
|
||||
};
|
||||
|
||||
expect(contribution.pathPrepend?.[0]).toBe("/tmp/bin");
|
||||
expectTypeOf(contribution.env).toEqualTypeOf<Record<string, string> | undefined>();
|
||||
expectTypeOf(plugin.executorRuntimeEnv).toBeFunction();
|
||||
});
|
||||
|
||||
it("compile-time rejects invalid prompt surfaces", () => {
|
||||
const validSurface: PluginPromptSurface = "triage";
|
||||
expect(validSurface).toBe("triage");
|
||||
|
||||
Reference in New Issue
Block a user