refactor: Update component specifications to use 'program' and 'behavior' attributes, enhancing clarity and consistency across the application

This commit is contained in:
2026-02-23 22:56:18 -08:00
parent 0d36e4f72a
commit efab2a7893
27 changed files with 258 additions and 393 deletions

View File

@@ -5,7 +5,7 @@ const TEMPLATES: Record<string, Record<string, unknown>> = {
service: {
run: {
runner: "python",
tool: "",
program: "",
cwd: "",
env: {},
},
@@ -23,9 +23,7 @@ const TEMPLATES: Record<string, Record<string, unknown>> = {
},
},
tool: {
install: {
path: { alias: "" },
},
behavior: "tool",
},
job: {
run: {
@@ -72,7 +70,7 @@ export function AddComponent({ onAdd, existingNames }: AddComponentProps) {
// Fill in template-specific fields
if (template === "service") {
const run = config.run as Record<string, unknown>
run.tool = name
run.program = name
run.cwd = name
const proxy = (config.proxy as Record<string, Record<string, string>>).caddy
proxy.path_prefix = `/${name}`
@@ -81,8 +79,7 @@ export function AddComponent({ onAdd, existingNames }: AddComponentProps) {
expose.http.internal.port = parseInt(port, 10)
}
} else if (template === "tool") {
const install = (config.install as Record<string, Record<string, string>>).path
install.alias = name
// tool template has behavior preset, no extra config needed
}
await onAdd(name, config)