Skip to content

AI Packages

AI Core устанавливает .aip packages. Package может быть Wasm plugin с explicit actions, code-free pipeline package или mixed package, который поставляет и actions, и bundled pipeline files.

Package authors используют tool binary aip-pack, чтобы превратить package directory в installable .aip artifact. Runtime hosts устанавливают получившиеся bytes в AI Core через FFI, Rust или process boundary.

Tool Artifacts

  • aip-pack: normal marketplace package flow. Создаёт encrypted packages и включает Marketplace operator commands.
  • aip-pack-for-developers: local developer package flow. Создаёт plaintext developer-signed packages для debugging.
  • aip-pack-no-marketplace: controlled local, enterprise или white-label package flow. Может создавать plaintext packages без Marketplace license checks, с optional developer signing.

SDK users должны получать эти инструменты как released tool binaries. Им не нужно собирать tool из source repository.

Example Packages

На сайте AI Core доступны downloadable reference packages для распространённых форм plugin:

  • Pipeline package: code-free package, собранный из pipeline.json, skills/ и schemas/. Используйте его, когда plugin в основном состоит из prompt и pipeline orchestration. AI Core exposes default run_pipeline action для этого shape.
  • Wasm action package: Rust/Wasm package с explicit actions, model slots, config schema metadata и Wasm ABI exports. Используйте его, когда plugin нужен custom validation, private logic, external tool calls или typed action handlers.

Каждый пример включает собственный README, aip.template.json, package files и commands для упаковки в .aip artifact. Начните с примера, который соответствует вашему plugin shape, затем замените ids, schemas, skills, model slots, requirements и output contracts на ваш собственный product contract.

Package Directory

Package directory обычно содержит:

  • aip.template.json: package manifest template;
  • pipeline.json: code-free pipeline definition, когда package является pipeline package;
  • skills/: markdown instructions или prompt material, используемые pipeline steps;
  • schemas/: JSON schemas, examples или output contracts;
  • wasm/ или другой declared entrypoint file, когда package exposes Wasm actions.

Package directory автоматически сканируется от root. Храните package assets в этом root tree и не оставляйте там unrelated repo files. Tool пропускает некоторые common source и build artifacts, но всё равно пакует только то, что находит под package root.

Templates содержат только manifest payload fields. Не добавляйте вручную generated schema, issuer, signatures, Marketplace approval data, encrypted envelopes или generated files[] hashes.

Minimal Pipeline Package

aip.template.json объявляет identity, version, requirements, model slots, config schema и файлы, входящие в package:

json
{
  "kind": "pipeline",
  "plugin": {
    "id": "example_pipeline",
    "version": "0.1.0"
  },
  "requirements": {
    "core": "^0.1.0",
    "plugin_api": "^0.1.0"
  },
  "entrypoint": {
    "pipeline": "pipeline.json"
  },
  "model_slots": [
    {
      "id": "draft",
      "description": "Writes the first draft",
      "fallback": "core.default"
    }
  ],
  "config": {
    "public_schema": "schemas/public-config.schema.json",
    "secrets_schema": "schemas/secrets.schema.json"
  }
}

pipeline.json описывает шаги, которые AI Core будет выполнять:

json
{
  "schema": "ai_core.pipeline.v1",
  "id": "example_pipeline.run",
  "input": {
    "schema": "example_pipeline.request.input.v1",
    "required": ["topic"]
  },
  "steps": [
    {
      "id": "draft",
      "model_slot": "draft",
      "skill": "skills/draft.md",
      "output_schema": "schemas/draft.schema.json"
    }
  ]
}

Если указан input.schema, AI Core загружает schema-файл из package и добавляет его в prompt intake-классификации и в prompt каждого шага. Если schema не указана, секция input schema не добавляется. При нехватке обязательных данных AI Core возвращает checkpoint перед шагом 0, после чего host задаёт вопрос и возобновляет pipeline.

model_slots — это plugin-level точки привязки generation-моделей, а не отдельные actions. Actions и pipeline steps могут указывать на slot через model_slot, а runtime может заполнить отсутствующие bindings из core.default. Routing всегда использует общую app-level routing model.

Minimal Wasm Action Package

Wasm package объявляет actions и entrypoint module:

json
{
  "kind": "wasm",
  "plugin": {
    "id": "example_actions",
    "version": "0.1.0"
  },
  "requirements": {
    "core": "^0.1.0",
    "plugin_api": "^0.1.0"
  },
  "entrypoint": {
    "wasm": "wasm/example_actions.wasm"
  },
  "actions": [
    {
      "id": "summarize",
      "input_schema": "schemas/summarize.input.schema.json",
      "output_schema": "schemas/summarize.output.schema.json"
    }
  ]
}

Hosts вызывают installed Wasm actions по plugin_id и fully qualified action_id, например example_actions.summarize.

Build A Package

Normal marketplace package:

sh
aip-pack developer-sign \
  --root /path/to/package \
  --developer-public-key /secure/developer.public.key \
  --developer-private-key /secure/developer.private.key \
  --output /out/example.aip

Developer package:

sh
aip-pack-for-developers developer-sign \
  --root /path/to/package \
  --developer-public-key /secure/developer.public.key \
  --developer-private-key /secure/developer.private.key \
  --output /out/example.dev.aip

No-marketplace package:

sh
aip-pack-no-marketplace developer-sign \
  --root /path/to/package \
  --output /out/example.no-marketplace.aip

No-marketplace can also be developer-signed:

sh
aip-pack-no-marketplace developer-sign \
  --root /path/to/package \
  --developer-public-key /secure/developer.public.key \
  --developer-private-key /secure/developer.private.key \
  --output /out/example.no-marketplace.signed.aip

No-marketplace builds can also stay unsigned. If you omit developer keys and do not request recipient encryption, aip-pack-no-marketplace writes a plaintext .aip archive. You can also developer-sign it for your own local or internal use without sending it through Marketplace.

What The Tool Does

aip-pack reads aip.template.json, recursively scans the package root, fills file paths, sizes and BLAKE3 hashes, signs the manifest when keys are provided, and writes the final .aip.

The tool includes package content such as pipeline.json, Wasm modules, skills/ и schemas/. Он исключает local source/build metadata such as dist/, target/, top-level src/, top-level tests/, README.md, Cargo.toml, Cargo.lock, Makefile, .gitignore и сам template.

Не полагайтесь на tool, чтобы он сам выбрал нужные files. Держите в package root только package content; всё, что там осталось, является кандидатом, если только tool явно это не пропускает.

Изменение любого packaged file после подписи делает manifest hash invalid. Пересобирайте .aip после каждого изменения content.

Runtime Compatibility

AI Core validates these before a package becomes active:

  • package format and manifest hash;
  • plugin id and version;
  • requirements.core;
  • plugin API version;
  • Wasm entrypoint and ABI version for Wasm packages;
  • package trust and license material for normal marketplace packages.

Если install не удался, предыдущая активная версия plugin остаётся active.

Author Checklist

  1. Declare requirements.core and requirements.plugin_api explicitly.
  2. Keep aip.template.json declarative.
  3. Put reusable prompt and instruction text under skills/.
  4. Put schemas, examples, or output contracts under schemas/.
  5. Install the resulting package into a compatible AI Core runtime artifact.

AI Core documentation site.