feat(connectors): group extensions as platform, integration or agent (#2084)
This commit is contained in:
6 files changed
+176
-26
No files matched your search
+13
-1
@@ -210,6 +210,7 @@ export const api = {
|
||||
putWorkflow: (name: string, body: string) =>
|
||||
request<WorkflowVersion>(`/api/workflows/${encodeURIComponent(name)}`, { method: "PUT", body: { body } }),
|
||||
workflowStepTypes: () => request<{ name: string; needs_repository: boolean; settings?: unknown }[]>("/api/workflow-step-types"),
|
||||
extensionKinds: () => request<ExtensionKindInfo[]>("/api/extension-kinds"),
|
||||
extensions: (kind: ExtensionKind) => request<Extension[]>(`/api/${kind}`),
|
||||
acceptExtension: (kind: ExtensionKind, name: string, body: ExtensionInput) =>
|
||||
request<{ name: string; state: string }>(`/api/${kind}/${encodeURIComponent(name)}`, { method: "PUT", body, timeoutMs: 60_000 }),
|
||||
@@ -793,7 +794,17 @@ export interface WorkflowVersion {
|
||||
created_by?: string;
|
||||
}
|
||||
|
||||
export type ExtensionKind = "connectors" | "guards" | "mcp-servers" | "secret-engines";
|
||||
export type ExtensionGroup = "platform" | "integration" | "agent";
|
||||
|
||||
/** An accepted-package kind, as the server lists it: the path segment of its API. */
|
||||
export type ExtensionKind = string;
|
||||
|
||||
export interface ExtensionKindInfo {
|
||||
kind: ExtensionKind;
|
||||
label: string;
|
||||
singular: string;
|
||||
group: ExtensionGroup;
|
||||
}
|
||||
|
||||
export interface SettingField {
|
||||
key: string;
|
||||
@@ -815,6 +826,7 @@ export interface Extension {
|
||||
digest?: string;
|
||||
version?: string;
|
||||
contract?: string;
|
||||
group?: ExtensionGroup;
|
||||
egress?: string[];
|
||||
env?: string[];
|
||||
settings?: Record<string, string>;
|
||||
|
||||
@@ -1,33 +1,47 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { computed, onMounted } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { ReadError } from "@/components/ui/read-error";
|
||||
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import type { ExtensionKind } from "@/lib/api";
|
||||
import { api, type ExtensionGroup } from "@/lib/api";
|
||||
import { useRead } from "@/lib/use-read";
|
||||
import ExtensionList from "./ExtensionList.vue";
|
||||
|
||||
/** Connectors, guards and MCP servers: the packages Archie acts and judges
|
||||
* through. The open tab is `?kind=`. */
|
||||
const KINDS: { kind: ExtensionKind; label: string; noun: string }[] = [
|
||||
{ kind: "connectors", label: "Connectors", noun: "connector" },
|
||||
{ kind: "guards", label: "Guards", noun: "guard" },
|
||||
{ kind: "mcp-servers", label: "MCP servers", noun: "MCP server" },
|
||||
{ kind: "secret-engines", label: "Secret engines", noun: "secret engine" },
|
||||
/** The packages Archie runs, listed by group. The open tab is `?kind=`. */
|
||||
const GROUPS: { id: ExtensionGroup; label: string }[] = [
|
||||
{ id: "platform", label: "Platform extensions" },
|
||||
{ id: "integration", label: "Integration extensions" },
|
||||
{ id: "agent", label: "Agent extensions" },
|
||||
];
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const active = computed(() => KINDS.find((k) => k.kind === route.query.kind) ?? KINDS[0]);
|
||||
const { data: kinds, error, reload } = useRead(() => api.extensionKinds());
|
||||
onMounted(reload);
|
||||
|
||||
const groups = computed(() =>
|
||||
GROUPS.map((group) => ({ ...group, kinds: (kinds.value ?? []).filter((k) => k.group === group.id) })).filter((group) => group.kinds.length),
|
||||
);
|
||||
const active = computed(() => kinds.value?.find((k) => k.kind === route.query.kind) ?? kinds.value?.[0]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader title="Extensions" />
|
||||
<Tabs :model-value="active.kind" class="mb-4" @update:model-value="(k) => router.replace({ query: { kind: String(k) } })">
|
||||
<TabsList variant="line" class="w-full justify-start">
|
||||
<TabsTrigger v-for="k in KINDS" :key="k.kind" :value="k.kind" class="flex-none px-3">{{ k.label }}</TabsTrigger>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
<ExtensionList :key="active.kind" :kind="active.kind" :noun="active.noun" />
|
||||
<ReadError v-if="error" :message="error" retry-label="Retry" @retry="reload" />
|
||||
<template v-else-if="active">
|
||||
<Tabs :model-value="active.kind" class="mb-4" @update:model-value="(k) => router.replace({ query: { kind: String(k) } })">
|
||||
<div class="flex flex-wrap gap-x-6 gap-y-3">
|
||||
<div v-for="group in groups" :key="group.id">
|
||||
<h2 class="mb-1 text-caption text-fg-subtle">{{ group.label }}</h2>
|
||||
<TabsList variant="line" class="justify-start">
|
||||
<TabsTrigger v-for="k in group.kinds" :key="k.kind" :value="k.kind" class="flex-none px-3">{{ k.label }}</TabsTrigger>
|
||||
</TabsList>
|
||||
</div>
|
||||
</div>
|
||||
</Tabs>
|
||||
<ExtensionList :key="active.kind" :kind="active.kind" :noun="active.singular" />
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user