@vibeframe/cli 0.109.2 → 0.111.0
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/dist/index.js +305 -3
- package/dist/tools/_shared/elicit.d.ts +31 -0
- package/dist/tools/_shared/elicit.test.d.ts +1 -0
- package/dist/tools/adapters/mcp.d.ts +35 -0
- package/dist/tools/adapters/mcp.js +16 -2
- package/dist/tools/define-tool.d.ts +43 -0
- package/dist/tools/manifest/index.js +297 -2
- package/dist/tools/manifest/scene.d.ts +2 -2
- package/dist/tools/manifest/storyboard.d.ts +2 -2
- package/package.json +3 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ElicitForm } from "../adapters/mcp.js";
|
|
2
|
+
/**
|
|
3
|
+
* @module tools/_shared/elicit
|
|
4
|
+
*
|
|
5
|
+
* Pre-flight elicitation for the `build` tool: when an MCP client supports
|
|
6
|
+
* elicitation, ask the user the choices the host agent would otherwise pick
|
|
7
|
+
* silently (narration provider, paid backdrop generation, cost ceiling).
|
|
8
|
+
* Pure functions — the MCP wiring lives in the tool's execute and the
|
|
9
|
+
* server's makeElicitFn; CLI/Agent surfaces never reach this code path.
|
|
10
|
+
*/
|
|
11
|
+
/** The subset of build args that drive the question set. */
|
|
12
|
+
export interface BuildChoiceArgs {
|
|
13
|
+
stage?: "assets" | "compose" | "sync" | "render" | "all";
|
|
14
|
+
ttsProvider?: "auto" | "elevenlabs" | "kokoro";
|
|
15
|
+
skipNarration?: boolean;
|
|
16
|
+
skipBackdrop?: boolean;
|
|
17
|
+
imageProvider?: string;
|
|
18
|
+
maxCostUsd?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Builds the elicitation form for a build call, asking ONLY about choices the
|
|
22
|
+
* caller left unspecified. Returns null when there is nothing to ask — every
|
|
23
|
+
* choice explicit, or the requested stage doesn't generate assets.
|
|
24
|
+
*/
|
|
25
|
+
export declare function planBuildElicitation(args: BuildChoiceArgs): ElicitForm | null;
|
|
26
|
+
/**
|
|
27
|
+
* Maps accepted form answers back onto build args. Unknown or invalid values
|
|
28
|
+
* are ignored so a misbehaving client can never produce a worse state than
|
|
29
|
+
* the defaults the user would have gotten without elicitation.
|
|
30
|
+
*/
|
|
31
|
+
export declare function applyElicitationAnswers<T extends BuildChoiceArgs>(args: T, content: Record<string, string | number | boolean | string[]> | undefined): T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -17,11 +17,40 @@ export interface McpInputSchema {
|
|
|
17
17
|
required: string[];
|
|
18
18
|
description?: string;
|
|
19
19
|
}
|
|
20
|
+
/** MCP spec ToolAnnotations — safety hints surfaced to hosts. */
|
|
21
|
+
export interface McpToolAnnotations {
|
|
22
|
+
readOnlyHint: boolean;
|
|
23
|
+
destructiveHint?: boolean;
|
|
24
|
+
idempotentHint?: boolean;
|
|
25
|
+
openWorldHint: boolean;
|
|
26
|
+
}
|
|
20
27
|
export interface McpTool {
|
|
21
28
|
name: string;
|
|
29
|
+
/** Human-readable display name (MCP BaseMetadata.title). */
|
|
30
|
+
title: string;
|
|
22
31
|
description: string;
|
|
23
32
|
inputSchema: McpInputSchema;
|
|
33
|
+
annotations: McpToolAnnotations;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Structural mirror of the MCP elicitation form request/result (the CLI
|
|
37
|
+
* package deliberately has no dependency on @modelcontextprotocol/sdk).
|
|
38
|
+
* `requestedSchema.properties` values follow the spec's flat primitive
|
|
39
|
+
* schema: string (optionally with enum/enumNames), number, boolean.
|
|
40
|
+
*/
|
|
41
|
+
export interface ElicitForm {
|
|
42
|
+
message: string;
|
|
43
|
+
requestedSchema: {
|
|
44
|
+
type: "object";
|
|
45
|
+
properties: Record<string, unknown>;
|
|
46
|
+
required?: string[];
|
|
47
|
+
};
|
|
24
48
|
}
|
|
49
|
+
export interface ElicitOutcome {
|
|
50
|
+
action: "accept" | "decline" | "cancel";
|
|
51
|
+
content?: Record<string, string | number | boolean | string[]>;
|
|
52
|
+
}
|
|
53
|
+
export type ElicitFn = (form: ElicitForm) => Promise<ElicitOutcome>;
|
|
25
54
|
/** Per-call extras forwarded by the MCP server request handler. */
|
|
26
55
|
export interface McpCallExtra {
|
|
27
56
|
/**
|
|
@@ -34,6 +63,12 @@ export interface McpCallExtra {
|
|
|
34
63
|
total?: number;
|
|
35
64
|
message?: string;
|
|
36
65
|
}) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Sends an `elicitation/create` form to the client and resolves with the
|
|
68
|
+
* user's answer. Only present when the connected client advertises the
|
|
69
|
+
* elicitation capability.
|
|
70
|
+
*/
|
|
71
|
+
elicit?: ElicitFn;
|
|
37
72
|
}
|
|
38
73
|
export type McpDispatcher = (name: string, args: Record<string, unknown>, extra?: McpCallExtra) => Promise<{
|
|
39
74
|
content: Array<{
|
|
@@ -211,16 +211,29 @@ function manifestToMcpTools(manifest) {
|
|
|
211
211
|
const inputSchema = zodToJsonSchema(t.schema);
|
|
212
212
|
return {
|
|
213
213
|
name: t.name,
|
|
214
|
+
title: t.title,
|
|
214
215
|
description: t.description,
|
|
215
216
|
inputSchema: {
|
|
216
217
|
type: "object",
|
|
217
218
|
properties: inputSchema.properties ?? {},
|
|
218
219
|
required: inputSchema.required ?? [],
|
|
219
220
|
...inputSchema.description ? { description: inputSchema.description } : {}
|
|
220
|
-
}
|
|
221
|
+
},
|
|
222
|
+
annotations: toMcpAnnotations(t.annotations)
|
|
221
223
|
};
|
|
222
224
|
});
|
|
223
225
|
}
|
|
226
|
+
function toMcpAnnotations(a) {
|
|
227
|
+
if (a.readOnly) {
|
|
228
|
+
return { readOnlyHint: true, openWorldHint: a.openWorld };
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
readOnlyHint: false,
|
|
232
|
+
destructiveHint: a.destructive ?? true,
|
|
233
|
+
...a.idempotent !== void 0 ? { idempotentHint: a.idempotent } : {},
|
|
234
|
+
openWorldHint: a.openWorld
|
|
235
|
+
};
|
|
236
|
+
}
|
|
224
237
|
function buildMcpDispatcher(manifest) {
|
|
225
238
|
const byName = /* @__PURE__ */ new Map();
|
|
226
239
|
for (const t of manifest) {
|
|
@@ -245,7 +258,8 @@ function buildMcpDispatcher(manifest) {
|
|
|
245
258
|
() => tool.execute(parsed.data, {
|
|
246
259
|
workingDirectory: process.cwd(),
|
|
247
260
|
surface: "mcp",
|
|
248
|
-
...extra?.onProgress ? { onProgress: sink.send } : {}
|
|
261
|
+
...extra?.onProgress ? { onProgress: sink.send } : {},
|
|
262
|
+
...extra?.elicit ? { elicit: extra.elicit } : {}
|
|
249
263
|
})
|
|
250
264
|
);
|
|
251
265
|
const text = result.success ? JSON.stringify({ success: true, ...result.data }) : result.data ? JSON.stringify({
|
|
@@ -49,6 +49,23 @@ export interface ExecuteContext {
|
|
|
49
49
|
total?: number;
|
|
50
50
|
message?: string;
|
|
51
51
|
}) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Optional MCP elicitation channel. Present only when the connected MCP
|
|
54
|
+
* client advertises the elicitation capability; CLI/Agent surfaces leave
|
|
55
|
+
* it undefined, so CLI behavior never changes. See adapters/mcp.ts for
|
|
56
|
+
* the structural types.
|
|
57
|
+
*/
|
|
58
|
+
elicit?: (form: {
|
|
59
|
+
message: string;
|
|
60
|
+
requestedSchema: {
|
|
61
|
+
type: "object";
|
|
62
|
+
properties: Record<string, unknown>;
|
|
63
|
+
required?: string[];
|
|
64
|
+
};
|
|
65
|
+
}) => Promise<{
|
|
66
|
+
action: "accept" | "decline" | "cancel";
|
|
67
|
+
content?: Record<string, string | number | boolean | string[]>;
|
|
68
|
+
}>;
|
|
52
69
|
}
|
|
53
70
|
export interface ToolExecuteResult {
|
|
54
71
|
success: boolean;
|
|
@@ -71,6 +88,32 @@ export interface ToolDefinition<S extends ZodTypeAny = ZodTypeAny> {
|
|
|
71
88
|
replacement?: string;
|
|
72
89
|
/** Short explanation for product-surface routing. */
|
|
73
90
|
note?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Human-readable display name shown by MCP hosts, e.g. "Add Clip to
|
|
93
|
+
* Timeline". Required by the Anthropic extension directory.
|
|
94
|
+
*/
|
|
95
|
+
title: string;
|
|
96
|
+
/**
|
|
97
|
+
* MCP safety annotations (directory requirement: every tool declares
|
|
98
|
+
* readOnlyHint or destructiveHint).
|
|
99
|
+
* - `readOnly: true` — the tool never modifies files or project state.
|
|
100
|
+
* - `readOnly: false` — the tool writes; `destructive` defaults to true
|
|
101
|
+
* (may overwrite/modify existing data), set false for purely additive
|
|
102
|
+
* tools; `idempotent: true` when re-running with identical args has no
|
|
103
|
+
* additional effect.
|
|
104
|
+
* - `openWorld` — true when the tool calls external provider APIs; false
|
|
105
|
+
* for purely local work (ffmpeg, filesystem). Always stated explicitly
|
|
106
|
+
* because the MCP spec default is true.
|
|
107
|
+
*/
|
|
108
|
+
annotations: {
|
|
109
|
+
readOnly: true;
|
|
110
|
+
openWorld: boolean;
|
|
111
|
+
} | {
|
|
112
|
+
readOnly: false;
|
|
113
|
+
destructive?: boolean;
|
|
114
|
+
idempotent?: boolean;
|
|
115
|
+
openWorld: boolean;
|
|
116
|
+
};
|
|
74
117
|
/** Identical for MCP description and Agent description. One paragraph. */
|
|
75
118
|
description: string;
|
|
76
119
|
/** Single source of truth for argument shape. Must be a `z.object({...})`. */
|