@vertesia/appgen-docs 1.5.0-dev.20260725.083715Z

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,397 @@
1
+ <!-- Generated by @vertesia/appgen-docs from
2
+ templates/plugin-template/.agents/skills/vertesia-tool-server-resource/REFERENCE.md.
3
+ Do not edit the generated file. -->
4
+
5
+ # Write Tool Server Resource — Code Reference
6
+
7
+ Full code examples for each resource type. SKILL.md has the workflow and decision-points; this file has the templates you copy from.
8
+
9
+ ## Table of Contents
10
+
11
+ - [Tool](#tool)
12
+ - [Skill](#skill)
13
+ - [Interaction (template-based)](#interaction-template-based)
14
+ - [Interaction (code-based)](#interaction-code-based)
15
+ - [Content Type](#content-type)
16
+ - [Rendering Template](#rendering-template)
17
+ - [Collection registration & icons](#collection-registration--icons)
18
+
19
+ ---
20
+
21
+ ## Tool
22
+
23
+ ### `schema.ts`
24
+
25
+ ```typescript
26
+ import { JSONSchema } from "@llumiverse/common";
27
+
28
+ export interface MyToolParams {
29
+ query: string;
30
+ limit?: number;
31
+ }
32
+
33
+ export const Schema = {
34
+ type: "object",
35
+ properties: {
36
+ query: { type: "string", description: "Search query" },
37
+ limit: { type: "number", description: "Max results" }
38
+ },
39
+ required: ["query"]
40
+ } satisfies JSONSchema;
41
+ ```
42
+
43
+ ### `<impl>.ts`
44
+
45
+ ```typescript
46
+ import { ToolExecutionContext, ToolExecutionPayload } from "@vertesia/tools-sdk";
47
+ import { ToolResultContent } from "@vertesia/common";
48
+ import { type MyToolParams } from "./schema.js";
49
+
50
+ export async function myToolRun(
51
+ payload: ToolExecutionPayload<MyToolParams>,
52
+ context: ToolExecutionContext
53
+ ): Promise<ToolResultContent> {
54
+ try {
55
+ const { query, limit } = payload.tool_use.tool_input!;
56
+ const client = await context.getClient();
57
+ const results = await client.store.objects.find({ where: { name: query }, limit });
58
+
59
+ return { is_error: false, content: JSON.stringify(results) };
60
+ } catch (error) {
61
+ return {
62
+ is_error: true,
63
+ content: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`
64
+ };
65
+ }
66
+ }
67
+ ```
68
+
69
+ ### `index.ts` (tool definition)
70
+
71
+ ```typescript
72
+ import { Tool } from "@vertesia/tools-sdk";
73
+ import { myToolRun } from "./my-impl.js";
74
+ import { MyToolParams, Schema } from "./schema.js";
75
+
76
+ export const MyTool = {
77
+ name: "my_tool",
78
+ description: "Description of what this tool does",
79
+ input_schema: Schema,
80
+ run: myToolRun
81
+ } satisfies Tool<MyToolParams>;
82
+ ```
83
+
84
+ ### Collection (`tools/<collection>/index.ts`)
85
+
86
+ ```typescript
87
+ import { ToolCollection } from "@vertesia/tools-sdk";
88
+ import { MyTool } from "./my-tool/index.js";
89
+ import icon from "./icon.svg.js";
90
+
91
+ export const MyTools = new ToolCollection({
92
+ name: "my-collection",
93
+ title: "My Tools",
94
+ description: "Description of this collection",
95
+ icon,
96
+ tools: [MyTool]
97
+ });
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Skill
103
+
104
+ ### `SKILL.md`
105
+
106
+ ```markdown
107
+ ---
108
+ name: my-skill
109
+ title: My Skill
110
+ description: What this skill does and when to use it
111
+ keywords: [keyword1, keyword2, keyword3]
112
+ tools: [tool-to-enable]
113
+ ---
114
+
115
+ # Skill Instructions
116
+
117
+ Instructions for the AI agent when this skill is active.
118
+
119
+ ## What to do
120
+
121
+ Describe the behavior, output format, and constraints.
122
+ ```
123
+
124
+ **Frontmatter fields:**
125
+
126
+ - `name` (required): snake_case identifier
127
+ - `description` (required): what the skill does
128
+ - `title`: display name
129
+ - `keywords`: trigger auto-activation when matched
130
+ - `tools`: related tools to unlock when skill is active
131
+ - `language` / `packages`: for code-execution skills
132
+ - `widgets`: UI widgets to render
133
+
134
+ ### Optional `properties.ts`
135
+
136
+ ```typescript
137
+ import { SkillDefinition, ToolUseContext } from "@vertesia/tools-sdk";
138
+
139
+ export default {
140
+ isEnabled(_context: ToolUseContext) {
141
+ // Return false to hide this skill based on context/config
142
+ return true;
143
+ }
144
+ } satisfies Partial<SkillDefinition>;
145
+ ```
146
+
147
+ ### Collection auto-discovery
148
+
149
+ ```typescript
150
+ // skills/<collection>/index.ts
151
+ import { SkillCollection } from "@vertesia/tools-sdk";
152
+ import skills from "./all?skills";
153
+
154
+ export const MySkills = new SkillCollection({
155
+ name: "my-collection",
156
+ title: "My Skills",
157
+ description: "Description of this skill collection",
158
+ skills // Auto-discovers all subdirs with SKILL.md
159
+ });
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Interaction (template-based)
165
+
166
+ ### `prompt.hbs`
167
+
168
+ ```handlebars
169
+ {{!-- prompt.hbs --}}
170
+ ---
171
+ role: user
172
+ content_type: handlebars
173
+ schema: ./prompt_schema.ts
174
+ ---
175
+ Analyze the following content: {{input}}
176
+ Please provide a {{format}} summary.
177
+ ```
178
+
179
+ ### `prompt_schema.ts`
180
+
181
+ ```typescript
182
+ import { JSONSchema } from "@llumiverse/common";
183
+
184
+ export default {
185
+ type: "object",
186
+ properties: {
187
+ input: { type: "string", description: "Content to analyze" },
188
+ format: { type: "string", description: "Output format" }
189
+ },
190
+ required: ["input"]
191
+ } satisfies JSONSchema;
192
+ ```
193
+
194
+ ### `result_schema.ts`
195
+
196
+ ```typescript
197
+ import { JSONSchema } from "@llumiverse/common";
198
+
199
+ export default {
200
+ type: "object",
201
+ properties: {
202
+ summary: { type: "string", description: "The analysis summary" },
203
+ confidence: { type: "number", description: "Confidence score 0-1" }
204
+ },
205
+ required: ["summary"]
206
+ } satisfies JSONSchema;
207
+ ```
208
+
209
+ ### `index.ts` (interaction spec)
210
+
211
+ ```typescript
212
+ import { InteractionSpec } from "@vertesia/common";
213
+ import PROMPT from "./prompt.hbs?prompt";
214
+ import result_schema from "./result_schema.js";
215
+
216
+ export default {
217
+ name: "analyze_content",
218
+ title: "Analyze Content",
219
+ description: "Analyzes content and returns a structured summary",
220
+ result_schema,
221
+ prompts: [PROMPT],
222
+ tags: ["analysis", "text"]
223
+ } satisfies InteractionSpec;
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Interaction (code-based)
229
+
230
+ For agents and conversational interactions (no `.hbs` file):
231
+
232
+ ```typescript
233
+ import { PromptRole } from "@llumiverse/common";
234
+ import type { InteractionSpec } from "@vertesia/common";
235
+ import { TemplateType } from "@vertesia/common";
236
+
237
+ export default {
238
+ name: "my_assistant",
239
+ title: "My Assistant",
240
+ description: "A conversational assistant",
241
+ tags: ["assistant", "chat"],
242
+ agent_runner_options: {
243
+ is_agent: true,
244
+ },
245
+ prompts: [
246
+ {
247
+ role: PromptRole.system,
248
+ content: "You are a helpful assistant. Answer questions accurately.",
249
+ content_type: TemplateType.text,
250
+ },
251
+ {
252
+ role: PromptRole.user,
253
+ content_type: TemplateType.handlebars,
254
+ content: "{{user_prompt}}",
255
+ },
256
+ ],
257
+ } satisfies InteractionSpec;
258
+ ```
259
+
260
+ ### Collection (`interactions/<collection>/index.ts`)
261
+
262
+ ```typescript
263
+ import { InteractionCollection } from "@vertesia/tools-sdk";
264
+ import analyzeContent from "./analyze_content/index.js";
265
+ import icon from "./icon.svg.js";
266
+
267
+ export const MyInteractions = new InteractionCollection({
268
+ name: "my-collection",
269
+ title: "My Interactions",
270
+ description: "Description of this collection",
271
+ icon,
272
+ interactions: [analyzeContent]
273
+ });
274
+ ```
275
+
276
+ ---
277
+
278
+ ## Content Type
279
+
280
+ ### `<type-name>.ts`
281
+
282
+ ```typescript
283
+ import { InCodeTypeSpec } from "@vertesia/common";
284
+
285
+ export const MyType = {
286
+ name: "my_type",
287
+ description: "Description of this content type",
288
+ tags: ["category1", "category2"],
289
+ object_schema: {
290
+ type: "object",
291
+ properties: {
292
+ title: { type: "string", description: "Title", minLength: 1, maxLength: 200 },
293
+ body: { type: "string", description: "Body content" },
294
+ status: { type: "string", enum: ["draft", "published", "archived"] }
295
+ },
296
+ required: ["title"],
297
+ additionalProperties: false
298
+ },
299
+ table_layout: [
300
+ { field: "properties.title", name: "Title", type: "string" },
301
+ { field: "properties.status", name: "Status", type: "string" },
302
+ { field: "updated_at", name: "Updated", type: "date" }
303
+ ],
304
+ is_chunkable: true,
305
+ strict_mode: true
306
+ } satisfies InCodeTypeSpec;
307
+ ```
308
+
309
+ ### Collection (`types/<collection>/index.ts`)
310
+
311
+ ```typescript
312
+ import { ContentTypesCollection } from "@vertesia/tools-sdk";
313
+ import { MyType } from "./my-type.js";
314
+ import icon from "./icon.svg.js";
315
+
316
+ export const MyTypes = new ContentTypesCollection({
317
+ name: "my-collection",
318
+ title: "My Content Types",
319
+ description: "Description of this collection",
320
+ icon,
321
+ types: [MyType]
322
+ });
323
+ ```
324
+
325
+ ---
326
+
327
+ ## Rendering Template
328
+
329
+ ### `TEMPLATE.md`
330
+
331
+ ```markdown
332
+ ---
333
+ title: My Report
334
+ description: A report template for generating formatted PDFs
335
+ tags: [report, pdf]
336
+ type: document
337
+ ---
338
+
339
+ # Report Template
340
+
341
+ Instructions for the document generation system.
342
+
343
+ ## Available Variables
344
+
345
+ - `{{title}}` — Report title
346
+ - `{{author}}` — Author name
347
+ - `{{date}}` — Report date
348
+ ```
349
+
350
+ **Frontmatter fields:**
351
+
352
+ - `description` (required): what this template generates
353
+ - `type` (required): `'document'` or `'presentation'`
354
+ - `title`: display name
355
+ - `tags`: categorization tags
356
+
357
+ Asset files (SVG, LaTeX, PNG) in the same directory are auto-discovered and copied to `dist/templates/`.
358
+
359
+ ### Collection auto-discovery
360
+
361
+ ```typescript
362
+ // templates/<collection>/index.ts
363
+ import { RenderingTemplateCollection } from "@vertesia/tools-sdk";
364
+ import templates from './all?templates';
365
+
366
+ export const MyTemplates = new RenderingTemplateCollection({
367
+ name: "my-collection",
368
+ title: "My Templates",
369
+ description: "Description of this template collection",
370
+ templates // Auto-discovers all subdirs with TEMPLATE.md
371
+ });
372
+ ```
373
+
374
+ ---
375
+
376
+ ## Collection registration & icons
377
+
378
+ ### Adding a collection to its type's index
379
+
380
+ ```typescript
381
+ // src/modules/app/resources/tools/index.ts
382
+ import { MyTools } from "./my-collection/index.js";
383
+
384
+ export const tools = [MyTools];
385
+ ```
386
+
387
+ `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 once the new collection is in the module resource array.
388
+
389
+ ### `icon.svg.ts`
390
+
391
+ Each collection needs an SVG icon as a default string export:
392
+
393
+ ```typescript
394
+ export default `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
395
+ <circle cx="12" cy="12" r="10"/>
396
+ </svg>`;
397
+ ```
@@ -0,0 +1,20 @@
1
+ # @vertesia/ui Quick Reference
2
+
3
+ This bundled fallback exists so `app_docs_grep` with `kind: "ui"` always returns a bounded result even when the remote design docs are unavailable.
4
+
5
+ Use these imports in generated app UI:
6
+
7
+ ```ts
8
+ import { Button, Badge, Table, VTabs, useFetch, useToast } from '@vertesia/ui/core';
9
+ import { NavLink, NestedRouterProvider, type Route } from '@vertesia/ui/router';
10
+ import { useUserSession } from '@vertesia/ui/session';
11
+ import { VertesiaShell } from '@vertesia/ui/shell';
12
+ ```
13
+
14
+ Rules:
15
+
16
+ - Use `useUserSession().client` for Vertesia API calls.
17
+ - Use `NavLink href`, not `to`.
18
+ - Use semantic Tailwind tokens such as `bg-background`, `bg-card`, `border-border`, `text-muted`, `text-success`, `text-attention`, and `text-destructive`.
19
+ - Default to a light, compact Studio-native operational UI.
20
+ - Do not import `react-router-dom` or `@tanstack/react-query` in generated apps.