feat(connectors): group extensions as platform, integration or agent (#2084)

This commit is contained in:
sam committed 2026-11-21 14:58:53 +11:00
1 parent a3132792ea
commit 64ef2c9af7
6 files changed
+173 -23

No files matched your search

+52
View File
@@ -414,6 +414,28 @@ components:
- Reversibility
- Summary
type: object
ConnectorsExtensionKind:
additionalProperties: false
properties:
group:
enum:
- platform
- integration
- agent
type: string
kind:
description: The API path segment that lists this kind
type: string
label:
type: string
singular:
type: string
required:
- kind
- label
- singular
- group
type: object
ConnectorsExtensionView:
additionalProperties: false
properties:
@@ -445,6 +467,12 @@ components:
- "null"
error:
type: string
group:
enum:
- platform
- integration
- agent
type: string
name:
type: string
path:
@@ -469,6 +497,7 @@ components:
required:
- name
- contract
- group
- state
- digest
- egress
@@ -4117,6 +4146,29 @@ paths:
summary: Get an event with its payload and the runs it started
tags:
- Events
/api/extension-kinds:
get:
operationId: list-extension-kinds
responses:
"200":
content:
application/json:
schema:
items:
$ref: "#/components/schemas/ConnectorsExtensionKind"
type:
- array
- "null"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: List the kinds of extension and the group each belongs to
tags:
- Connectors
/api/groups:
get:
operationId: list-groups
@@ -46,6 +46,45 @@ const (
ContractGuard = "guard"
)
// Group says what an extension is for, so the dashboard can list the
// extensions an operator sets up together.
type Group string
// Groups of extensions. Workflows and playbooks are content and have none.
const (
GroupPlatform Group = "platform"
GroupIntegration Group = "integration"
GroupAgent Group = "agent"
)
// Contracts lists every contract with its group. Everything that enumerates
// contracts reads this table, and GroupOf is the only way to look a group up,
// so a contract without a group cannot be served.
func Contracts() []ContractGroup {
return []ContractGroup{
{ContractConnector, GroupIntegration},
{ContractSecretEngine, GroupPlatform},
{ContractGuard, GroupPlatform},
{ContractMCP, GroupAgent},
}
}
// ContractGroup pairs a contract with its group.
type ContractGroup struct {
Contract string
Group Group
}
// GroupOf returns the group of a contract in Contracts.
func GroupOf(contract string) Group {
for _, c := range Contracts() {
if c.Contract == contract {
return c.Group
}
}
return ""
}
// Credential is a credential's sealed fields.
type Credential struct {
OrgID string `db:"org_id"`
+2 -1
View File
@@ -20,6 +20,7 @@ import (
type ExtensionView struct {
Name string `json:"name"`
Contract string `json:"contract"`
Group string `json:"group" enum:"platform,integration,agent"`
State string `json:"state"`
Error string `json:"error,omitempty"`
Version string `json:"version,omitempty"`
@@ -61,7 +62,7 @@ func (m *Module) list(contract string) func(context.Context, *struct{}) (*httpap
func (m *Module) viewOf(a store.Accepted) (ExtensionView, error) {
view := ExtensionView{
Name: a.Name, Contract: a.Contract, Digest: a.SHA256, Path: a.Path, URL: a.URL,
Name: a.Name, Contract: a.Contract, Group: string(store.GroupOf(a.Contract)), Digest: a.SHA256, Path: a.Path, URL: a.URL,
Args: a.Args, Egress: a.Egress, Env: a.Env, Tools: a.Tools,
Settings: map[string]string{}, Credentials: map[string]string{}, SettingsSchema: []Setting{},
}
+40 -8
View File
@@ -254,16 +254,48 @@ func (m *Module) Close() {
m.host.Close()
}
// extensionKinds is the one table of accepted-package kinds: the contract each
// serves, its API path and its names. The group comes from the contract.
func extensionKinds() []extensionKind {
return []extensionKind{
{store.ContractConnector, "/api/connectors", "connector", "connector", "connectors", "Connectors"},
{store.ContractSecretEngine, "/api/secret-engines", "secret-engine", "secret engine", "secret engines", "Secret engines"},
{store.ContractGuard, "/api/guards", "guard", "guard", "guards", "Guards"},
{store.ContractMCP, "/api/mcp-servers", "mcp-server", "MCP server", "MCP servers", "MCP servers"},
}
}
type extensionKind struct {
contract, path, noun, singular, plural, tag string
}
// ExtensionKind is one kind of accepted package and the group it belongs to.
type ExtensionKind struct {
Kind string `json:"kind" doc:"The API path segment that lists this kind"`
Label string `json:"label"`
Singular string `json:"singular"`
Group string `json:"group" enum:"platform,integration,agent"`
}
func listExtensionKinds(context.Context, *struct{}) (*httpapi.Reply[[]ExtensionKind], error) {
kinds := extensionKinds()
out := make([]ExtensionKind, 0, len(kinds))
for _, k := range kinds {
out = append(out, ExtensionKind{
Kind: strings.TrimPrefix(k.path, "/api/"), Label: k.tag, Singular: k.singular,
Group: string(store.GroupOf(k.contract)),
})
}
return httpapi.OK(out), nil
}
// Register adds the API for accepted packages and credentials.
func (m *Module) Register(api huma.API) {
for _, k := range []struct {
contract, path, noun, plural, tag string
}{
{store.ContractConnector, "/api/connectors", "connector", "connectors", "Connectors"},
{store.ContractSecretEngine, "/api/secret-engines", "secret-engine", "secret engines", "Secret engines"},
{store.ContractGuard, "/api/guards", "guard", "guards", "Guards"},
{store.ContractMCP, "/api/mcp-servers", "mcp-server", "MCP servers", "MCP servers"},
} {
huma.Register(api, huma.Operation{
OperationID: "list-extension-kinds", Method: http.MethodGet, Path: "/api/extension-kinds",
Summary: "List the kinds of extension and the group each belongs to", Tags: []string{"Connectors"},
}, listExtensionKinds)
for _, k := range extensionKinds() {
tags := []string{k.tag}
huma.Register(api, huma.Operation{
OperationID: "list-" + k.noun + "s", Method: http.MethodGet, Path: k.path,
+13 -1
View File
@@ -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>;
+27 -13
View File
@@ -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" />
<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) } })">
<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>
<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.noun" />
<ExtensionList :key="active.kind" :kind="active.kind" :noun="active.singular" />
</template>
</div>
</template>