AGENT SKILL

Vertesia 工具服务器资源创建

vertesia-tool-server-resource

为 Vertesia 插件工具服务器创建工具、技能、交互、内容类型、渲染模板、钩子和事件订阅。处理文件脚手架搭建与模块资源索引接线。当向此插件添加新的工具服务器资源时使用。

License 许可
Apache-2.0
最近更新
2026-11-14
Stars
★ 5
Forks
2

01 前言 Front Matter

name
vertesia-tool-server-resource
description
Creates tools, skills, interactions, content types, rendering templates, hooks, and event subscriptions for the Vertesia plugin tool server. Handles file scaffolding and module resource index wiring. Use when adding new tool server resources to this plugin.

02 资源文件 1

03 SKILL.md 正文

Vertesia Tool Server Resource

Step-by-step guide for creating tool server resources. Each resource follows the same workflow:

  1. Create files in the appropriate src/modules/app/resources/<type>/<collection>/ directory
  2. Export from the collection's index.ts
  3. Register the collection in src/modules/app/resources/<type>/index.ts (only when adding a new collection)

For full code templates of every resource type, see REFERENCE.md.

Application hooks and event subscriptions are definitions rather than resource collections. They are still app-owned contributions: register hooks under src/modules/app/resources/hooks/ and subscriptions under src/modules/app/resources/subscriptions/.

Conventions

  • All imports use .js extensions: import { x } from "./foo.js"
  • Use satisfies for type validation ({} satisfies Tool<T>, {} satisfies InCodeTypeSpec, …)
  • Icons are SVG strings exported as default from .ts files
  • Import hooks (?skill, ?skills, ?prompt, ?template, ?templates, ?raw) only work in Rollup-compiled tool-server code, not in UI code
  • Snake_case for resource names (my_tool, my_type); PascalCase for TypeScript exports (MyTool, MyType)
  • User-owned resources live in src/modules/app/resources/<type>/
  • See src/modules/examples/resources/<type>/ for working starter code when the examples module is available

Resource types

Tool

Three files in src/modules/app/resources/tools/<collection>/<tool-name>/:

File Purpose
schema.ts TypeScript interface + JSONSchema (satisfies JSONSchema)
<impl>.ts The run function — uses ToolExecutionPayload<P>, returns ToolResultContent
index.ts Tool<P> definition (satisfies Tool<ParamsT>)

Then export from src/modules/app/resources/tools/<collection>/index.ts as a ToolCollection.

→ Code in REFERENCE.md § Tool.

Skill

Files in src/modules/app/resources/skills/<collection>/<skill-name>/:

File Required Purpose
SKILL.md yes YAML frontmatter + instructions for the agent
properties.ts no Runtime gating (isEnabled)
*.tsx no Widgets (compiled to dist/widgets/)
*.py, *.js no Scripts beside SKILL.md (copied to dist/scripts/, synced to ~/skills/<skill-name>/)
scripts/, references/, assets/ no Agent Skills resource directories, any file type, nested folders allowed (copied to dist/skill-files/<skill-name>/, synced to ~/skills/<skill-name>/ with the same relative paths)

The frontmatter also accepts the Agent Skills fields license, compatibility, metadata (string values) and allowed-tools. allowed-tools is experimental in the spec and Vertesia does not support it: the build records it and unlocks nothing. Use tools to unlock tools.

Skills are auto-discovered: the collection imports ./all?skills — no per-skill imports needed.

→ Code in REFERENCE.md § Skill.

Interaction

Two flavors:

  • Template-based — prompt.hbs + prompt_schema.ts + result_schema.ts + index.ts (InteractionSpec importing the prompt via ?prompt).
  • Code-based — index.ts only, with prompts: [{ role, content, content_type }, …] inline. Use this for agents/conversations.

Then export from src/modules/app/resources/interactions/<collection>/index.ts as an InteractionCollection.

→ Code in REFERENCE.md § Interaction (template-based) and § Interaction (code-based).

Content Type

One file per type in src/modules/app/resources/types/<collection>/<type-name>.ts (InCodeTypeSpec), then a ContentTypesCollection in types/<collection>/index.ts.

Key fields: name (snake_case), object_schema (JSON Schema with additionalProperties: false), table_layout (columns for the UI), is_chunkable, strict_mode.

The type's public app id is its bare name: app:<app-name>:<type-name>. The collection is code organization only for content types and is not part of the public id. Type names must therefore be unique across collections.

→ Code in REFERENCE.md § Content Type.

Rendering Template

Folder per template in src/modules/app/resources/templates/<collection>/<template-name>/:

  • TEMPLATE.md with YAML frontmatter (description, type: 'document' | 'presentation', optional title, tags)
  • Asset files (SVG, LaTeX, PNG) — auto-discovered, copied to dist/templates/

Templates are auto-discovered: the collection imports ./all?templates.

→ Code in REFERENCE.md § Rendering Template.

Application Hooks

Use an install or uninstall hook when the app must initialize or clean up project data as a version becomes or stops being promoted. Hooks receive an authenticated context with the current project token and getClient().

  • Implement hooks in src/modules/app/resources/hooks/install.ts or uninstall.ts.
  • Register named hook definitions in src/modules/app/resources/hooks/index.ts.
  • Make install behavior idempotent. Studio may invoke it again during a reinstall or an explicit recovery.
  • Do not use hooks to materialize app-owned package types as project-local types. Use portable app:<app>:<type> refs.
  • An unpromoted version advertises hook definitions but does not run lifecycle hooks. Validate source/package wiring on a candidate and defer lifecycle execution until explicit promotion; do not invoke lifecycle endpoints manually for QA.
  • When an appgen capability manifest is present, declare each lifecycle or event hook as a hook artifact using app:<app-name>:<hook-name>.

→ Code in REFERENCE.md § Application lifecycle hooks.

Use an event hook for authenticated event-bus webhook deliveries. Event hooks receive the platform event envelope and the same authenticated client context as tools.

  • Implement event hooks in src/modules/app/resources/hooks/<hook-name>.ts.
  • Use a kebab-case name; install and uninstall are reserved.
  • Register { kind: 'event', name, description, handler } in the hooks index.
  • Inspect registered event hooks through /api/package?scope=hooks.

→ Code in REFERENCE.md § Application event hooks.

Event Subscription

Use an app-owned subscription to route matching platform events to an event hook registered by the same app.

  • Register definitions in src/modules/app/resources/subscriptions/index.ts.
  • Give each definition a stable kebab-case id.
  • Set hook to an AppEventHookDefinition.name; lifecycle hooks are not valid targets.
  • Define the event filter and required run_as_role, normally automation.
  • Do not set a URL or scope. Studio derives the project scope and promoted hook URL when a version is promoted.
  • Inspect contributions through /api/package?scope=subscriptions.
  • A bare version exposes subscription definitions in its package but does not materialize them in Event Bus. Candidate QA should validate the definition and hook reference only; registration and delivery checks require promotion.
  • When an appgen capability manifest is present, declare the subscription as a subscription artifact using app:<app-name>:<subscription-id>.

→ Code in REFERENCE.md § Application event subscriptions.

Collection registration

Once a collection is exported from src/modules/app/resources/<type>/<collection>/index.ts, add it to the array in src/modules/app/resources/<type>/index.ts:

// src/modules/app/resources/tools/index.ts
import { MyTools } from "./my-collection/index.js";

export const tools = [MyTools];

src/tool-server/app-server-modules.ts is generated from active modules and config.ts imports from it, so no further server wiring is needed.

Do not add app-owned registries directly under src/tool-server. When the platform introduces a new contribution type, add its typed empty default under src/modules/app/resources, export it from the module resource index, and update the template codegen SERVER_RESOURCES list so the generated aggregator includes it.

Each collection needs an SVG icon.svg.ts (default string export). Code in REFERENCE.md § Collection registration & icons.

For interactions and activities, prefer naming the default collection main. Runtime ids include the collection name, so main gives stable ids like app:<app-name>:main:<interaction-name>. Avoid naming a collection after the app, which creates redundant ids such as app:<app-name>:<app-name>:<interaction-name>.

Verification

After creating a resource:

  1. pnpm build:server
  2. pnpm start
  3. Check the admin UI at http://localhost:3000/ — your resource should appear.
  4. Or hit the API: curl http://localhost:3000/api/tools (or /skills, /interactions, /types, /templates).

04 同仓库更多 Skills

vertesia
vertesia/composableai

用户选项收集

user-select

向用户呈现选项并收集其选择,用于交互式决策

普通用户通用助手与问答
★ 5
vertesia
vertesia/composableai

Vertesia React UI 组件开发

vertesia-ui

使用 @vertesia/ui 构建 UI 的参考资料。涵盖组件 API(Input、Button、VModal、VTabs、Table)、支持无限滚动的列表/详情表格、可排序表头、带 URL 持久化和内联行过滤的 FilterProvider、布局组件(Sidebar、FullHeightLayout、GenericPageNavHeader)、路由(NestedRouterProvider、useParams、useNavigate)、智能体对话(ModernAgentConversation)、样式与安全。当创建或修改 React UI 页面或组件时使用。

软件开发工程师前端开发与界面实现
★ 5
vertesia
vertesia/composableai

Vertesia 插件架构参考

vertesia-plugin

关于插件架构、双构建系统、导入钩子和部署的参考资料。用于理解插件结构或构建配置。创建资源请使用 vertesia-tool-server-resource;构建 UI 请使用 vertesia-ui;客户端 API 请使用 vertesia-api。

软件开发工程师插件与技能管理
★ 5
vertesia
vertesia/composableai

Vertesia 需求能力差距评估

vertesia-gap-assessment

在提出实现方案之前,评估任意需求与现有 Vertesia 能力之间的差距。在审查 Vertesia 应用、插件、工作流或智能体的需求文档、调研笔记、演示请求或功能请求时使用,以便区分平台原生支持、已安装的项目能力、当前应用实现和真正需要自定义开发的工作。

软件开发工程师需求澄清与上下文补全
★ 5
vertesia
vertesia/composableai

Vertesia DSL 工作流参考

vertesia-dsl-workflow

DSL 工作流定义、远程活动、变量解析和条件处理的参考。在创建或调试调用插件远程活动的 DSL 工作流时使用。

软件开发工程师开发参考
★ 5
vertesia
vertesia/composableai

Vertesia 演示种子内容生成

vertesia-demo-content

为 Vertesia 应用生成真实且可复用的演示或种子内容,并通过 Vertesia CLI、API 或浏览器会话上传。在构建 Vertesia 自定义应用、插件、原型、仓库工作流、AI 提取工作流、搜索/筛选页面,或需要使用真实存储对象而非硬编码模拟数组的演示时使用;包括检查当前活动的 CLI 配置文件,以及在修改 Vertesia 项目前先询问确认。

软件开发工程师低代码应用开发
★ 5