@vertesia/tools-sdk 1.5.0-dev.20260725.083715Z → 1.5.0-dev.20260806.125520Z
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.
- package/lib/ActivityCollection.d.ts.map +1 -1
- package/lib/ContentTypesCollection.d.ts.map +1 -1
- package/lib/InteractionCollection.d.ts.map +1 -1
- package/lib/RenderingTemplateCollection.d.ts +10 -1
- package/lib/RenderingTemplateCollection.d.ts.map +1 -1
- package/lib/SkillCollection.d.ts.map +1 -1
- package/lib/ToolCollection.d.ts.map +1 -1
- package/lib/ToolRegistry.d.ts.map +1 -1
- package/lib/ToolRegistry.js.map +1 -1
- package/lib/auth.d.ts.map +1 -1
- package/lib/auth.js.map +1 -1
- package/lib/copy-assets.js.map +1 -1
- package/lib/server/app-package.d.ts.map +1 -1
- package/lib/server/app-package.js +48 -0
- package/lib/server/app-package.js.map +1 -1
- package/lib/server/hooks.d.ts +4 -0
- package/lib/server/hooks.d.ts.map +1 -0
- package/lib/server/hooks.js +76 -0
- package/lib/server/hooks.js.map +1 -0
- package/lib/server/types.d.ts +7 -1
- package/lib/server/types.d.ts.map +1 -1
- package/lib/server.d.ts.map +1 -1
- package/lib/server.js +3 -0
- package/lib/server.js.map +1 -1
- package/lib/types.d.ts +67 -1
- package/lib/types.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/server/app-package.test.ts +129 -1
- package/src/server/app-package.ts +59 -0
- package/src/server/hooks.test.ts +158 -0
- package/src/server/hooks.ts +95 -0
- package/src/server/types.ts +14 -1
- package/src/server.ts +3 -0
- package/src/types.ts +85 -0
package/src/types.ts
CHANGED
|
@@ -3,6 +3,9 @@ import type { VertesiaClient } from '@vertesia/client';
|
|
|
3
3
|
import type {
|
|
4
4
|
AgentToolDefinition,
|
|
5
5
|
AuthTokenPayload,
|
|
6
|
+
AppEventHookDelivery as CommonAppEventHookDelivery,
|
|
7
|
+
AppEventHookPayload as CommonAppEventHookPayload,
|
|
8
|
+
AppEventSubscriptionDefinition as CommonAppEventSubscriptionDefinition,
|
|
6
9
|
MCPToolAnnotations,
|
|
7
10
|
ProjectConfiguration,
|
|
8
11
|
RenderingTemplateDefinition,
|
|
@@ -13,6 +16,9 @@ import type {
|
|
|
13
16
|
} from '@vertesia/common';
|
|
14
17
|
|
|
15
18
|
export type { ToolExecutionMetadata };
|
|
19
|
+
export type AppEventSubscriptionDefinition = CommonAppEventSubscriptionDefinition;
|
|
20
|
+
export type AppEventHookDelivery = CommonAppEventHookDelivery;
|
|
21
|
+
export type AppEventHookPayload = CommonAppEventHookPayload;
|
|
16
22
|
|
|
17
23
|
export type ICollection<T = object> = CollectionProperties & Iterable<T>;
|
|
18
24
|
|
|
@@ -54,6 +60,50 @@ export interface ToolExecutionContext {
|
|
|
54
60
|
getClient: () => Promise<VertesiaClient>;
|
|
55
61
|
}
|
|
56
62
|
|
|
63
|
+
export type AppLifecycleHookName = 'install' | 'uninstall';
|
|
64
|
+
|
|
65
|
+
export interface AppLifecycleHookContext extends ToolExecutionContext {
|
|
66
|
+
/** Metadata supplied by Studio for this installation lifecycle call. */
|
|
67
|
+
metadata: ToolExecutionMetadata;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface AppLifecycleHookResult {
|
|
71
|
+
message?: string;
|
|
72
|
+
data?: Record<string, unknown>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// biome-ignore lint/suspicious/noConfusingVoidType: lifecycle hooks may complete without a response body.
|
|
76
|
+
export type AppLifecycleHook = (context: AppLifecycleHookContext) => Promise<void | AppLifecycleHookResult>;
|
|
77
|
+
|
|
78
|
+
export interface AppLifecycleHookDefinition {
|
|
79
|
+
kind: 'lifecycle';
|
|
80
|
+
name: AppLifecycleHookName;
|
|
81
|
+
handler: AppLifecycleHook;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export type AppEventHookContext = ToolExecutionContext;
|
|
85
|
+
export type AppEventHookResult = AppLifecycleHookResult;
|
|
86
|
+
|
|
87
|
+
export type AppEventHook = (
|
|
88
|
+
payload: AppEventHookPayload,
|
|
89
|
+
context: AppEventHookContext,
|
|
90
|
+
) => Promise<AppEventHookResult> | Promise<void>;
|
|
91
|
+
|
|
92
|
+
export interface AppEventHookDefinition {
|
|
93
|
+
kind: 'event';
|
|
94
|
+
/** Kebab-case URL-safe name. The lifecycle names install and uninstall are reserved. */
|
|
95
|
+
name: string;
|
|
96
|
+
description?: string;
|
|
97
|
+
handler: AppEventHook;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** App-owned hook definitions aggregated from active application modules. */
|
|
101
|
+
export type AppHookDefinition = AppLifecycleHookDefinition | AppEventHookDefinition;
|
|
102
|
+
|
|
103
|
+
export interface AppLifecycleHookPayload {
|
|
104
|
+
metadata?: ToolExecutionMetadata;
|
|
105
|
+
}
|
|
106
|
+
|
|
57
107
|
export interface ToolExecutionResult extends ToolResultContent {
|
|
58
108
|
/**
|
|
59
109
|
* Medata can be used to return more info on the tool execution like stats or user messages.
|
|
@@ -149,6 +199,41 @@ export interface Tool<ParamsT extends object = object> extends ToolDefinition {
|
|
|
149
199
|
* @returns
|
|
150
200
|
*/
|
|
151
201
|
isEnabled?: (payload: ToolUseContext) => boolean;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Declares which parameter carries the *name of another tool*. See {@link ToolDispatchDescriptor}.
|
|
205
|
+
*/
|
|
206
|
+
dispatch?: ToolDispatchDescriptor;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Which parameter of a tool carries the name of another tool.
|
|
211
|
+
*
|
|
212
|
+
* JSON Schema types such a field as `string`, so every phantom name validates against it. Naming
|
|
213
|
+
* the field here lets build-time validation resolve those names against the registry; without it
|
|
214
|
+
* the mistake surfaces only when an agent attempts the call and the server rejects it.
|
|
215
|
+
*
|
|
216
|
+
* Purely descriptive — nothing reads it at runtime. `@dglabs/workflows` and the skill-markdown
|
|
217
|
+
* checker each declare a structural twin, since neither can depend on this package.
|
|
218
|
+
*/
|
|
219
|
+
export interface ToolDispatchDescriptor {
|
|
220
|
+
/**
|
|
221
|
+
* Path to the parameter holding the tool name, using dots for nesting and `[]` for arrays.
|
|
222
|
+
* Examples: `tool_name`, `allowed_tools[]`, `agent_runner_options.tool_names[]`.
|
|
223
|
+
*/
|
|
224
|
+
field: string;
|
|
225
|
+
/**
|
|
226
|
+
* Path to the parameter holding the input forwarded to the dispatched tool, if any.
|
|
227
|
+
* When set, examples can also be validated against the *dispatched* tool's schema.
|
|
228
|
+
*/
|
|
229
|
+
inputField?: string;
|
|
230
|
+
/** Tool names this dispatcher refuses at runtime. Referencing one is an error. */
|
|
231
|
+
deny?: readonly string[];
|
|
232
|
+
/**
|
|
233
|
+
* True when the runtime strips a leading `+` or `-` before resolving the name — the selection
|
|
234
|
+
* prefixes that add to, or remove from, the default toolset.
|
|
235
|
+
*/
|
|
236
|
+
stripsSelectionPrefix?: boolean;
|
|
152
237
|
}
|
|
153
238
|
|
|
154
239
|
/**
|