Pular para o conteúdo
AggregaAggrega
Selecionar língua: Português (Portugal)
Esta página foi traduzida automaticamente. Ler o original em inglês.

aggrega plugin

Inspecionar os plugins Wasm que a CLI consegue resolver

Sinopse

aggrega plugin

Descrição

Work with the WebAssembly plugins this CLI can resolve.
All of Aggrega's provider-specific and policy-specific behaviour lives in Wasm
plugins rather than in the binary, so this is where you see which ones are
reachable, add or remove a workspace binding, and check a guest before you
publish it.
Plugins reach the CLI two ways. Some are compiled into the binary and resolve
with no filesystem, cache or network access. The rest are workspace bindings in
.aggrega-config.yaml, resolved through the plugin cascade. "aggrega plugin list"
shows both groups together.
The subcommands below cover the whole life of a binding: list what is reachable,
add and remove bindings, run a local guest export directly, sync the
machine-owned records in a Plugin entity with its .wasm, and generate Plugin
catalog entities from a guest's own metadata.

Subcomandos

ComandoDescrição
aggrega plugin addEncontra no registo um plugin do tipo indicado e adiciona-o
aggrega plugin gen-catalogGera entidades de catálogo Plugin a partir do describe() do guest mais um overlay escrito pelo autor
aggrega plugin listLista os plugins que a CLI consegue resolver com os seus metadados de describe()
aggrega plugin removeRemove um plugin configurado do tipo indicado
aggrega plugin run-localCarrega um guest .wasm local e chama uma das suas exportações
aggrega plugin syncSincroniza os registos geridos pela máquina de um plugin (funções de anfitrião, comandos da CLI) no seu ficheiro de entidade com o seu .wasm

Descrição de aggrega plugin add

Find a plugin of the named type in the configured registry and add it to your
configuration.
Examples:
aggrega plugin add cli moo # add the moo command
aggrega plugin add cli moo:0.2.4 # a specific version
aggrega plugin add governance rego --role render-verdict
Arguments:
<type> The plugin socket to add for. One of: provider, governance,
linter, importer, or cli. The governance type requires --role.
<query> The plugin's name, optionally followed by :<version> to add that
version rather than the latest published one. The name is looked
up directly first. Where no plugin of the chosen type has that name,
it is matched as a case-insensitive substring against the plugin
names of that type, which reads the registry's whole catalog and
must resolve to exactly one plugin — otherwise the command lists the
candidates so you can narrow it. A query naming a version is never
matched that way. The provider type takes no version.
What add writes depends on the type:
- A socket type (governance, linter, importer) pins the version the query
names, or else the latest published version, and adds the bare plugin
identity (<type>/<name>:<version>) to the plugins.<type> list. The latest
is never taken from pre-release versions, so a plugin that publishes only
those is added by naming one. A governance entry also records its --role,
one of annotation-transform, label-transform, ir-verdict, or render-verdict.
An importer the plugins.importer list already names keeps its one entry,
moved to the pinned version with its place and what it carries under with.
- The provider type adds a plugins.providers entry naming the plugin by its
bare identity (provider/<name>) with no version; --capability names the
capability the binding serves, preserving existing settings. The version is
the one the Recipe pins, or else the highest available, and the lockfile
records the one a pull chose.
- The cli type fetches the plugin from the registry, verifies it, and caches
its bytes, then pins it into the plugins.cli list as a top-level aggrega
command — no separate pull step. Its resolved reference and the content
digest of the verified bytes are recorded so the command runs those exact
bytes, resolving from the local cache on later runs with no further network
access. A cli plugin defaults to the global config, so its command is
available in every workspace; --workspace pins it to this project instead.
It needs no workspace: run outside one, its bytes are cached in the
machine-wide cache rather than in the folder you ran it in. Its declared
capabilities are confirmed before installing, and --accept-capabilities or
--yes skips that prompt for non-interactive use.
A provider or socket attachment is written to a workspace's own configuration
unless --global is passed, so outside a workspace it is refused before the
registry is reached; so is anything else that can be refused without it.
A provider or socket attachment is configuration you go on editing, so --dry-run
does everything the plain command does except write: it hands back the
configuration the write would have produced, creating and modifying nothing. The
answer names the file that content is for — which matters here, because a
--global attachment targets the config shared across every workspace. A caller
that keeps its own document model puts the content there, where it is visible
before it is saved and can be amended or undone. The registry is still searched,
and for a socket type the version still resolved, since the returned document
carries the identity a write would have written.
Under --dry-run standard output carries that content and nothing else, so it stays
parseable; a version substitution is announced on standard error instead. The cli
type does not accept --dry-run: what it records is the content digest of the bytes
it verified, which is a record the machine maintains rather than content you
edit.

Flags de aggrega plugin add

FlagPredefiniçãoDescrição
--accept-capabilitiesfalseAceita as capacidades declaradas de um plugin cli sem o pedido interativo (apenas tipo cli)
--capability—Capacidade que a associação de provider serve (obrigatória para o tipo provider, e válida apenas com ele)
--dry-runfalseFaz tudo exceto escrever: devolve a configuração resultante como conteúdo, indicando o ficheiro a que se destina, e não cria nem modifica nada. Sem ela, o anexo é escrito no ficheiro de configuração resolvido. Não aceite com o tipo cli.
--globalfalseEscreve o anexo na configuração global partilhada por todos os espaços de trabalho.
--role—Papel do anexo de governação: annotation-transform, label-transform, ir-verdict ou render-verdict (obrigatório para o tipo governance, e válido apenas com ele)
--workspacefalseEscreve o anexo na configuração do espaço de trabalho deste projeto. Um anexo de provider ou de socket vai para aqui por predefinição; um plugin cli vai por predefinição para a configuração global.
--yesfalseSalta o pedido de confirmação de capacidades cli para uso não interativo (apenas tipo cli)

Descrição de aggrega plugin gen-catalog

Generate one Plugin entity per selected Wasm guest.
Each entity's contract fields — pluginType, abiVersion, capabilities, exports,
and contract — are derived from the guest's describe() self-report, so the
entity can never promise a capability the binary does not provide. The entity's
identity (metadata.name), runtime limits, and provider block come from an authored
per-plugin overlay; the entity version is the guest's describe() self-report
version. The plugin-level description, when the guest reports one, is emitted as
metadata.description and omitted cleanly when it does not.
Two selection modes:
--from-embedded generate an entity for every guest embedded in this binary.
The overlay path is a directory; each overlay is matched to
a guest by its metadata.name identity, and, where overlays
in several socket directories (<socket>/<name>.yaml)
declare one name, by the directory naming the guest's
socket.
--plugin <f.wasm> generate a single entity for one non-embedded guest. The
overlay path is a single overlay file.
The output is written under <output-dir>/<pluginType>/<name>/<version>/plugin.yaml
and carries a generated-output banner. The leading pluginType segment keeps two
same-named plugins in different sockets apart, since a bare plugin name is unique
only within its own socket. Regenerating over unchanged inputs yields
byte-identical files.
A generated entity is a catalog document you own and go on editing, so --dry-run
does everything gen-catalog does except write: it hands the content back, creating
and modifying nothing, and the answer names the file each document is for. A
caller that keeps its own document model — an editor, for instance — puts the
content there, where it is visible before it is saved and can be amended or
undone. Every other behaviour is the write's — the same guests are read and the
same overlays matched — so a selection gen-catalog would refuse is refused under
--dry-run too. Without the flag the entities are written, because a caller at a
terminal has nowhere better to put them.

Flags de aggrega plugin gen-catalog

FlagPredefiniçãoDescrição
--dry-runfalseFaz tudo exceto escrever: devolve as entidades geradas como conteúdo, indicando o ficheiro a que cada uma se destina, e não cria nem modifica nada. Todos os outros comportamentos são os da escrita, pelo que uma seleção que a escrita recusaria é aqui também recusada. Sem ela, as entidades são escritas sob —output-dir.
--from-embeddedfalsegera uma entidade para cada guest incorporado neste binário
--output-dir—diretório sob o qual as entidades geradas são escritas (obrigatório)
--overlay—diretório (—from-embedded) ou ficheiro (—plugin) de overlay escrito pelo autor (obrigatório)
--plugin—gera uma única entidade para o guest .wasm neste caminho

Descrição de aggrega plugin list

List every Wasm plugin the CLI can see and, for each, its self-reported
describe() metadata.
Two groups are printed. Embedded built-ins are the provider and linter guests
compiled into the binary; they resolve with no filesystem, cache, or network
access. Configured plugins are the workspace bindings — the provider and linter
bindings and the CLI-extension commands — resolved through the plugin cascade.
Each plugin's type appears in the TYPE column, so a CLI-extension command
(type cli) is legible alongside the socket plugins; a CLI plugin also carries a
status of its own — ready, unresolved, describe-failed, or digest-drift when
its bytes changed since it was pinned at install.
The default output is a scannable table with one row per plugin, showing its
type, name, served capabilities, and version. The output is read-only and
deterministic. A plugin that fails to resolve or describe is listed with its
failure status rather than halting the whole listing.
With -o json, the output is a structured object carrying the full per-plugin
detail — type, name, version, commit, capabilities, input kinds, boundary
assembly, exports, origin, readiness, and any resolve or describe error —
grouped as embedded and configured. It is suitable for programmatic
consumption and documentation generation.

Flags de aggrega plugin list

FlagPredefiniçãoDescrição
--output, -otableFormato de saída: table|json.

Descrição de aggrega plugin remove

Remove a configured plugin of the named type from a config file so it no longer
participates.
The type is one of provider, governance, linter, importer, or cli — the same
set 'plugin add' accepts. The query identifies the entry to remove: the plugin's
short name (matched against 'add's short name so remove is symmetric with add),
its full pinned reference, or, for the provider type, the capability the binding
serves. A query that matches nothing halts and leaves the config untouched, so a
typo never silently removes the wrong plugin.
A provider or socket attachment defaults to this project's workspace config; a cli
command defaults to the global config shared across every workspace. --global and
--workspace force the file the removal targets, overriding the default.

Flags de aggrega plugin remove

FlagPredefiniçãoDescrição
--globalfalseRemove da configuração global partilhada por todos os espaços de trabalho.
--workspacefalseRemove da configuração do espaço de trabalho deste projeto. Um anexo de provider ou de socket vai para aqui por predefinição; um comando cli vai por predefinição para a configuração global.

Descrição de aggrega plugin run-local

Load a .wasm guest from a filesystem path, call one of its declared
exports with an optional payload, and write the guest's answer to stdout.
The guest is addressed directly by --plugin path; it is not resolved through
the workspace plugin cascade. The export named by --export must be one the
guest advertises in its describe() self-report, or the call is rejected before
the guest runs.
The command has two forms. The artifact form takes no positional argument and
loads the guest bare. The entity form takes a Plugin entity file as its one
positional argument: the entity is schema-validated, and its declared
metadata.pluginType and export contract are cross-checked against the guest's
describe() before the guest runs. In both forms the guest bytes come from
--plugin; the entity carries no artifact path.
The payload is supplied with --with, and it is always written as JSON. A value
beginning with @ reads the payload bytes from a file (--with @input.json); any
other value is taken as a literal inline JSON payload (--with '{"k":1}'). When
--with is omitted, the export receives the minimal empty JSON object {}. The
resolved payload is validated as JSON before the guest runs, so malformed input
is reported up front.
An export a socket calls with a payload reads it in a binary encoding rather
than as JSON; a CLI plugin's cli_run export is the exception, and reads JSON.
Which encoding an export reads is fixed by the socket that export serves, so no
flag selects it: the resolved payload is converted into the encoding the named
export reads before the guest is called. The conversion reads the payload's
shape from the export's name, so it covers each export a socket calls by
default; an entry function an attachment or a pipeline step names under a name
of its own receives the payload as written. The authored payload stays JSON
either way.
The answer is converted the same way in reverse. An export a socket calls
answers in that binary encoding, so its answer is read as the export's output
shape and written to stdout as indented JSON; an answer that is not that shape
is reported as an error naming the export rather than printed. A cli_run
export's answer, and an entry function under a name of its own, are written to
stdout exactly as the guest wrote them. When the guest exits non-zero, what it
wrote is passed through unchanged.
In the artifact form, --type optionally names a plugin type the guest's
describe() self-report must agree with, or the load is rejected before the
guest runs; when omitted, no type expectation is imposed. In the entity form
--type is rejected, because the entity's metadata.pluginType supplies the type.
The guest's clean exit code becomes this command's exit status, so a failure
inside the plugin is distinguishable from a failure of aggrega itself.

Flags de aggrega plugin run-local

FlagPredefiniçãoDescrição
--export—a exportação declarada a chamar
--plugin—caminho no sistema de ficheiros para o artefacto .wasm
--type—o tipo de plugin a que o que o describe() do guest reporta sobre si tem de corresponder
--with—conteúdo para a exportação: JSON inline, ou @ para ler de um ficheiro; a predefinição é {} quando omitido

Descrição de aggrega plugin sync

Sync a plugin's machine-owned records in a Plugin entity file with its .wasm.
Two records are not authored by hand: the set of host functions a plugin may
call, derived from the plugin's .wasm import section, and the top-level commands a
CLI plugin contributes, read from the plugin's describe() self-report. Both are
ground truth in the binary. This command reads the .wasm, derives the
host-function set in canonical form and the command mirror in describe()-declared
order, and aligns the entity's spec.runtime.hostFunctions and spec.commands with
them — creating the runtime block when the file has none. Only those blocks
change; every comment, blank line, and other field is preserved byte-for-byte. A
plugin that imports no host functions or contributes no commands records an
explicit empty list, so each field is always present and reviewable.
The write is idempotent: re-running when the records already match the .wasm
leaves the file untouched. Commit the result; publish (aggrega push) then only
verifies the committed records against the .wasm and refuses to publish a file
whose records are out of sync with its binary.

Flags de aggrega plugin sync

FlagPredefiniçãoDescrição
--plugin—Caminho para o artefacto .wasm do plugin cujas importações e describe() determinam as funções de anfitrião e os comandos registados

O que faz uma entrada de importador

aggrega plugin add importer escreve a identidade do plugin e a versão mais recente publicada para ele, ou a versão indicada como <name>:<version> — importer/<name>:<version> — na lista plugins.importer. Essa entrada anexa o importador que indica: uma importação que peça um formato que o importador anuncia executa esse importador, nessa versão, mesmo quando outros importadores do catálogo também anunciam o formato, e só esse importador recebe o que a entrada traz em with. Que importador transforma uma origem em rascunhos descreve a entrada por completo.

Um importador é anexado por uma única entrada, pelo que adicionar um que a lista plugins.importer do ficheiro a escrever já indica — em qualquer versão, ou por um intervalo — não acrescenta uma segunda entrada. Em vez disso, o comando move essa entrada para a versão que resolveu: a entrada mantém o seu lugar na lista e tudo o que traz em with. Adicionar um importador na versão que a sua entrada já indica deixa a entrada como está.

Os comandos de um plugin de CLI e as suas flags

Sempre que aggrega arranca, acrescenta um comando por cada comando com que um plugin cli configurado contribui, lendo os comandos e as suas flags do que o describe() do plugin reporta sobre si — da cache de describe quando esta contém o digest fixado do plugin, e caso contrário descrevendo o plugin. Cada flag declarada é declarada no seu comando, para que aggrega help <command> a liste da mesma forma que lista as flags de um comando incorporado; o plugin continua a receber os seus argumentos sem análise e lê as suas próprias flags.

O digest fixado fica junto à referência do plugin na lista plugins.cli da configuração, escrito como sha256: seguido de 64 dígitos hexadecimais em minúsculas — a grafia que aggrega plugin add cli regista. Um digest escrito de qualquer outra forma, como hexadecimal simples sem o prefixo sha256:, é recusado quando o ficheiro de configuração é carregado, indicando o ficheiro e a entrada; até ser corrigido, não é acrescentado nenhum comando de plugin configurado, e um aviso no erro padrão traz a recusa.

Antes de acrescentar qualquer dos comandos de um plugin, aggrega verifica todas as flags que cada um deles declara. Um plugin cujas declarações falhem é ignorado: nenhum dos seus comandos é acrescentado, um aviso no erro padrão indica o plugin, o comando, a flag e o que está errado nela, e todos os outros comandos — incorporados ou de outro plugin — correm como habitualmente:

warning: CLI plugin "oci://hub.aggrega.ai/plugin/cli/greet:1.2.0" was not added as a command: its command "greet" declares the flag "--verbose" with the shorthand "vv"; a shorthand is a single ASCII letter or digit

Uma declaração de flag passa quando:

  • a flag tem um nome, e nenhuma outra flag do mesmo comando o tem;
  • a sua forma abreviada, se tiver uma, é uma única letra ou dígito ASCII que nenhuma outra flag do mesmo comando usa;
  • nem o seu nome nem a sua forma abreviada reutilizam uma flag que todos os comandos aggrega já têm — --help, -h e as flags globais;
  • o seu tipo, se declarar um, é string, bool ou int — uma flag sem tipo é uma flag de string;
  • o seu valor predefinido, se declarar um, é um valor do seu tipo.

A exclusão repete-se, com o seu aviso, em cada invocação até a configuração fixar uma versão do plugin cujas declarações passem. Os campos que uma declaração de flag traz estão descritos em spec.commands na página da entidade Plugin.

Gerar entidades e sincronizar registos: dois tipos diferentes de ação

Dois destes subcomandos produzem um ficheiro, e o que produzem não é o mesmo tipo de coisa.

plugin gen-catalog — as entidades geradas são do utilizador para editar

aggrega plugin gen-catalog produz entidades de catálogo Plugin. Uma entidade é um documento de catálogo: arquiva-se, revê-se e continua-se a editá-la juntamente com o resto do catálogo. Por ser conteúdo que pertence ao utilizador, o comando pode entregá-lo em vez de o colocar em disco.

--dry-run faz tudo o que gen-catalog faz exceto escrever. Devolve as entidades geradas como conteúdo — nenhum ficheiro é criado, nenhum diretório é feito — e cada documento na resposta indica o ficheiro a que se destina, para que um chamador saiba onde pertence cada um. Um chamador que mantém o seu próprio modelo de documentos, como um editor, coloca o conteúdo aí, onde o utilizador o vê antes de ser guardado e o pode alterar ou anular. Sem a flag, as entidades são escritas sob --output-dir, porque um chamador num terminal não tem melhor sítio para as colocar.

O conteúdo devolvido e os bytes escritos são o mesmo conteúdo: --dry-run devolve o que a escrita teria produzido, não uma pré-visualização montada à parte. Todos os outros comportamentos são também os da escrita — os mesmos guests são lidos, os mesmos overlays correspondidos, e --output-dir é obrigatório em ambos os casos, porque cada documento devolvido continua a indicar o ficheiro a que se destina e esse caminho é composto a partir dele.

Todas as entidades são compostas e validadas antes de qualquer delas ser entregue, pelo que uma execução ou produz o conjunto inteiro ou não produz nada. Um overlay que interrompe a geração — um que falta, ou cuja identidade não corresponde ao guest com que é fundido — não deixa para trás nenhuma saída parcialmente escrita para limpar.

plugin sync — os registos geridos pela máquina são do compilador

aggrega plugin sync coloca os registos geridos pela máquina de um plugin em sintonia com o seu módulo: o conjunto de funções de anfitrião derivado da secção de importações do módulo, e o espelho de comandos lido do que o próprio plugin reporta sobre si. Ambos são a verdade de base no binário e não valores que alguém escolha.

Escreve sempre, e não oferece --dry-run. Isto vale mesmo que escreva dentro de um ficheiro de entidade escrito pelo utilizador — a linha traça-se no conteúdo, não no ficheiro. Os registos que o compilador mantém sobre si próprio não são do utilizador para editar, pelo que não há nada a rever antes de chegarem; o documento à volta fica intacto byte a byte, e só esses blocos mudam.