feat(connectors): check workflow and trigger references against declared capabilities (#2087)
This commit is contained in:
20 files changed
+555
-48
No files matched your search
@@ -816,6 +816,23 @@ export interface SettingField {
|
||||
secret?: boolean;
|
||||
}
|
||||
|
||||
/** One event type, action, delivery or lookup a connector declared. */
|
||||
export interface Capability {
|
||||
name: string;
|
||||
description: string;
|
||||
schema: unknown;
|
||||
}
|
||||
|
||||
/** What a connector declared when it last loaded. */
|
||||
export interface Capabilities {
|
||||
events: Capability[];
|
||||
actions: Capability[];
|
||||
deliveries: Capability[];
|
||||
lookups: Capability[];
|
||||
listens: boolean;
|
||||
target_facts: boolean;
|
||||
}
|
||||
|
||||
export interface Extension {
|
||||
name: string;
|
||||
state: string;
|
||||
@@ -834,6 +851,8 @@ export interface Extension {
|
||||
credentials?: Record<string, string>;
|
||||
/** An MCP server's declared tools, as it was accepted with them. */
|
||||
tools?: unknown;
|
||||
/** A connector's declarations; absent until it has loaded. */
|
||||
capabilities?: Capabilities;
|
||||
}
|
||||
|
||||
export interface ExtensionInput {
|
||||
|
||||
@@ -29,13 +29,25 @@ const props = defineProps<{ kind: ExtensionKind; noun: string }>();
|
||||
const { data, error, reload } = useRead(() => api.extensions(props.kind));
|
||||
onMounted(reload);
|
||||
|
||||
const columns: DataTableColumn<Extension>[] = [
|
||||
const columns = computed<DataTableColumn<Extension>[]>(() => [
|
||||
{ id: "name", label: "Name", fixed: true, sort: (e) => e.name },
|
||||
{ id: "state", label: "State", fixed: true, sort: (e) => e.state },
|
||||
{ id: "version", label: "Version", sort: (e) => e.version ?? "" },
|
||||
...(props.kind === "connectors" ? [{ id: "capabilities", label: "Declares" }] : []),
|
||||
{ id: "path", label: "Path", hidden: true },
|
||||
{ id: "egress", label: "Egress", hidden: true },
|
||||
];
|
||||
]);
|
||||
|
||||
const CAPABILITY_GROUPS = [
|
||||
{ key: "events", label: "Events" },
|
||||
{ key: "actions", label: "Actions" },
|
||||
{ key: "deliveries", label: "Deliveries" },
|
||||
{ key: "lookups", label: "Lookups" },
|
||||
] as const;
|
||||
|
||||
function declared(ext: Extension) {
|
||||
return CAPABILITY_GROUPS.map((g) => ({ ...g, items: ext.capabilities?.[g.key] ?? [] })).filter((g) => g.items.length);
|
||||
}
|
||||
|
||||
const mcp = computed(() => props.kind === "mcp-servers");
|
||||
const editing = ref(false);
|
||||
@@ -129,6 +141,12 @@ async function remove(): Promise<void> {
|
||||
<p v-if="row.error" class="mt-1 text-caption text-danger">{{ row.error }}</p>
|
||||
</template>
|
||||
<template #cell-version="{ row }">{{ row.version }}</template>
|
||||
<template #cell-capabilities="{ row }">
|
||||
<dl v-for="group in declared(row)" :key="group.key" class="mb-1 text-caption">
|
||||
<dt class="text-fg-subtle">{{ group.label }}</dt>
|
||||
<dd v-for="item in group.items" :key="item.name"><span class="font-mono">{{ item.name }}</span><span v-if="item.description" class="text-fg-subtle"> {{ item.description }}</span></dd>
|
||||
</dl>
|
||||
</template>
|
||||
<template #cell-path="{ row }"><span class="font-mono text-caption [overflow-wrap:anywhere]">{{ row.path || row.url }}</span></template>
|
||||
<template #cell-egress="{ row }"><span class="font-mono text-caption">{{ (row.egress ?? []).join(", ") }}</span></template>
|
||||
<template #actions="{ row }">
|
||||
|
||||
Reference in new issue
Block a user