@vibeframe/cli 0.105.1 → 0.105.2
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/agent/adapters/claude.d.ts +14 -0
- package/dist/agent/adapters/gemini.d.ts +14 -0
- package/dist/agent/adapters/index.d.ts +27 -0
- package/dist/agent/adapters/ollama.d.ts +19 -0
- package/dist/agent/adapters/openai.d.ts +14 -0
- package/dist/agent/adapters/openrouter.d.ts +15 -0
- package/dist/agent/adapters/openrouter.test.d.ts +4 -0
- package/dist/agent/adapters/xai.d.ts +14 -0
- package/dist/agent/index.d.ts +109 -0
- package/dist/agent/memory/index.d.ts +69 -0
- package/dist/agent/prompts/system.d.ts +5 -0
- package/dist/agent/tools/e2e.test.d.ts +25 -0
- package/dist/agent/tools/index.d.ts +59 -0
- package/dist/agent/tools/integration.test.d.ts +10 -0
- package/dist/agent/tools/scene.test.d.ts +1 -0
- package/dist/agent/types.d.ts +72 -0
- package/dist/commands/_shared/build-asset-metadata.d.ts +43 -0
- package/dist/commands/_shared/build-asset-reference.d.ts +18 -0
- package/dist/commands/_shared/build-backdrop-prompt.d.ts +8 -0
- package/dist/commands/_shared/build-backdrop-prompt.test.d.ts +1 -0
- package/dist/commands/_shared/build-cache.d.ts +37 -0
- package/dist/commands/_shared/build-plan.d.ts +107 -0
- package/dist/commands/_shared/build-plan.test.d.ts +1 -0
- package/dist/commands/_shared/compose-prompts.d.ts +97 -0
- package/dist/commands/_shared/compose-prompts.test.d.ts +1 -0
- package/dist/commands/_shared/compose-scenes-skills.d.ts +282 -0
- package/dist/commands/_shared/compose-scenes-skills.test.d.ts +1 -0
- package/dist/commands/_shared/composer-resolve.d.ts +47 -0
- package/dist/commands/_shared/composer-resolve.test.d.ts +1 -0
- package/dist/commands/_shared/cost-tier.d.ts +58 -0
- package/dist/commands/_shared/edit/_helpers.d.ts +12 -0
- package/dist/commands/_shared/edit/caption.d.ts +47 -0
- package/dist/commands/_shared/edit/fade.d.ts +38 -0
- package/dist/commands/_shared/edit/jump-cut.d.ts +80 -0
- package/dist/commands/_shared/edit/noise-reduce.d.ts +33 -0
- package/dist/commands/_shared/edit/silence-cut.d.ts +63 -0
- package/dist/commands/_shared/edit/text-overlay.d.ts +50 -0
- package/dist/commands/_shared/edit/translate-srt.d.ts +40 -0
- package/dist/commands/_shared/edit/video-review.d.ts +62 -0
- package/dist/commands/_shared/execute-fill-gaps.d.ts +97 -0
- package/dist/commands/_shared/hf-skill-bundle/bundle-content.d.ts +16 -0
- package/dist/commands/_shared/hf-skill-bundle/bundle.d.ts +57 -0
- package/dist/commands/_shared/hf-skill-bundle/bundle.test.d.ts +1 -0
- package/dist/commands/_shared/init-templates.d.ts +58 -0
- package/dist/commands/_shared/init-templates.test.d.ts +1 -0
- package/dist/commands/_shared/install-skill.d.ts +76 -0
- package/dist/commands/_shared/install-skill.test.d.ts +1 -0
- package/dist/commands/_shared/openai-image.d.ts +49 -0
- package/dist/commands/_shared/openai-image.test.d.ts +1 -0
- package/dist/commands/_shared/product-surface.d.ts +11 -0
- package/dist/commands/_shared/product-surface.test.d.ts +1 -0
- package/dist/commands/_shared/project-config.d.ts +60 -0
- package/dist/commands/_shared/render-inspect.d.ts +104 -0
- package/dist/commands/_shared/render-inspect.test.d.ts +1 -0
- package/dist/commands/_shared/review-report.d.ts +65 -0
- package/dist/commands/_shared/root-sync.d.ts +39 -0
- package/dist/commands/_shared/scene-audio-mux.d.ts +74 -0
- package/dist/commands/_shared/scene-audio-mux.test.d.ts +6 -0
- package/dist/commands/_shared/scene-audio-scan.d.ts +93 -0
- package/dist/commands/_shared/scene-audio-scan.test.d.ts +5 -0
- package/dist/commands/_shared/scene-build-mode.d.ts +4 -0
- package/dist/commands/_shared/scene-build-mode.test.d.ts +1 -0
- package/dist/commands/_shared/scene-build.d.ts +452 -0
- package/dist/commands/_shared/scene-build.test.d.ts +1 -0
- package/dist/commands/_shared/scene-html-emit.d.ts +139 -0
- package/dist/commands/_shared/scene-html-emit.test.d.ts +1 -0
- package/dist/commands/_shared/scene-inspect.d.ts +56 -0
- package/dist/commands/_shared/scene-inspect.test.d.ts +1 -0
- package/dist/commands/_shared/scene-lint.d.ts +109 -0
- package/dist/commands/_shared/scene-lint.test.d.ts +1 -0
- package/dist/commands/_shared/scene-project.d.ts +147 -0
- package/dist/commands/_shared/scene-project.test.d.ts +1 -0
- package/dist/commands/_shared/scene-render.d.ts +109 -0
- package/dist/commands/_shared/scene-render.test.d.ts +1 -0
- package/dist/commands/_shared/scene-repair.d.ts +22 -0
- package/dist/commands/_shared/scene-repair.test.d.ts +1 -0
- package/dist/commands/_shared/status-jobs.d.ts +197 -0
- package/dist/commands/_shared/status-jobs.test.d.ts +1 -0
- package/dist/commands/_shared/storyboard-draft.d.ts +13 -0
- package/dist/commands/_shared/storyboard-draft.test.d.ts +1 -0
- package/dist/commands/_shared/storyboard-edit.d.ts +26 -0
- package/dist/commands/_shared/storyboard-edit.test.d.ts +1 -0
- package/dist/commands/_shared/storyboard-parse.d.ts +159 -0
- package/dist/commands/_shared/storyboard-parse.test.d.ts +1 -0
- package/dist/commands/_shared/storyboard-revise.d.ts +32 -0
- package/dist/commands/_shared/storyboard-revise.test.d.ts +1 -0
- package/dist/commands/_shared/timeline-project.d.ts +32 -0
- package/dist/commands/_shared/tts-resolve.d.ts +75 -0
- package/dist/commands/_shared/tts-resolve.test.d.ts +5 -0
- package/dist/commands/_shared/video-providers.d.ts +44 -0
- package/dist/commands/_shared/video-utils.d.ts +71 -0
- package/dist/commands/_shared/visual-styles.d.ts +55 -0
- package/dist/commands/_shared/visual-styles.test.d.ts +1 -0
- package/dist/commands/_shared/walkthroughs/walkthroughs.d.ts +47 -0
- package/dist/commands/_shared/walkthroughs/walkthroughs.test.d.ts +1 -0
- package/dist/commands/agent.d.ts +24 -0
- package/dist/commands/ai-analyze.d.ts +105 -0
- package/dist/commands/ai-animated-caption.d.ts +63 -0
- package/dist/commands/ai-audio.d.ts +92 -0
- package/dist/commands/ai-edit-cli.d.ts +13 -0
- package/dist/commands/ai-edit.d.ts +29 -0
- package/dist/commands/ai-fill-gaps.d.ts +15 -0
- package/dist/commands/ai-helpers.d.ts +26 -0
- package/dist/commands/ai-highlights.d.ts +126 -0
- package/dist/commands/ai-image.d.ts +71 -0
- package/dist/commands/ai-motion.d.ts +53 -0
- package/dist/commands/ai-review.d.ts +58 -0
- package/dist/commands/ai-script-pipeline-cli.d.ts +10 -0
- package/dist/commands/ai-script-pipeline.d.ts +74 -0
- package/dist/commands/ai-suggest-edit.d.ts +32 -0
- package/dist/commands/ai-video.d.ts +95 -0
- package/dist/commands/ai.test.d.ts +1 -0
- package/dist/commands/audio.d.ts +17 -0
- package/dist/commands/batch.d.ts +2 -0
- package/dist/commands/batch.test.d.ts +1 -0
- package/dist/commands/build.d.ts +2 -0
- package/dist/commands/completion.d.ts +20 -0
- package/dist/commands/completion.test.d.ts +1 -0
- package/dist/commands/context.d.ts +7 -0
- package/dist/commands/context.test.d.ts +1 -0
- package/dist/commands/demo.d.ts +6 -0
- package/dist/commands/detect.d.ts +55 -0
- package/dist/commands/doctor.d.ts +5 -0
- package/dist/commands/doctor.test.d.ts +1 -0
- package/dist/commands/edit/motion-overlay.d.ts +30 -0
- package/dist/commands/edit-cmd.d.ts +112 -0
- package/dist/commands/envelope-snapshots.test.d.ts +32 -0
- package/dist/commands/export.d.ts +60 -0
- package/dist/commands/export.test.d.ts +1 -0
- package/dist/commands/generate/background.d.ts +22 -0
- package/dist/commands/generate/image.d.ts +8 -0
- package/dist/commands/generate/music-status.d.ts +20 -0
- package/dist/commands/generate/music.d.ts +27 -0
- package/dist/commands/generate/sound-effect.d.ts +19 -0
- package/dist/commands/generate/speech.d.ts +21 -0
- package/dist/commands/generate/storyboard.d.ts +27 -0
- package/dist/commands/generate/thumbnail.d.ts +8 -0
- package/dist/commands/generate/video-cancel.d.ts +8 -0
- package/dist/commands/generate/video-extend.d.ts +8 -0
- package/dist/commands/generate/video-status.d.ts +8 -0
- package/dist/commands/generate/video.d.ts +8 -0
- package/dist/commands/generate.d.ts +36 -0
- package/dist/commands/init.d.ts +24 -0
- package/dist/commands/init.test.d.ts +1 -0
- package/dist/commands/inspect.d.ts +20 -0
- package/dist/commands/media.d.ts +2 -0
- package/dist/commands/output.d.ts +80 -0
- package/dist/commands/output.test.d.ts +1 -0
- package/dist/commands/plan.d.ts +2 -0
- package/dist/commands/project.d.ts +2 -0
- package/dist/commands/project.test.d.ts +1 -0
- package/dist/commands/provider-config-cli.test.d.ts +1 -0
- package/dist/commands/q-flag-collision.test.d.ts +1 -0
- package/dist/commands/remix.d.ts +20 -0
- package/dist/commands/render.d.ts +2 -0
- package/dist/commands/run.d.ts +14 -0
- package/dist/commands/sanitize.d.ts +20 -0
- package/dist/commands/scene.d.ts +92 -0
- package/dist/commands/scene.test.d.ts +1 -0
- package/dist/commands/schema.d.ts +12 -0
- package/dist/commands/setup.d.ts +5 -0
- package/dist/commands/setup.test.d.ts +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/storyboard.d.ts +2 -0
- package/dist/commands/timeline.d.ts +2 -0
- package/dist/commands/timeline.test.d.ts +1 -0
- package/dist/commands/validate.d.ts +33 -0
- package/dist/commands/walkthrough.d.ts +21 -0
- package/dist/config/config.test.d.ts +1 -0
- package/dist/config/index.d.ts +110 -0
- package/dist/config/schema.d.ts +64 -0
- package/dist/config/scope.test.d.ts +1 -0
- package/dist/engine/index.d.ts +2 -0
- package/dist/engine/index.js +345 -0
- package/dist/engine/project.d.ts +93 -0
- package/dist/engine/project.test.d.ts +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +234 -258
- package/dist/pipeline/executor.d.ts +27 -0
- package/dist/pipeline/generate-actions.test.d.ts +1 -0
- package/dist/pipeline/index.d.ts +3 -0
- package/dist/pipeline/renderers/__tests__/html-template.test.d.ts +1 -0
- package/dist/pipeline/renderers/__tests__/integration.test.d.ts +1 -0
- package/dist/pipeline/renderers/chrome.d.ts +25 -0
- package/dist/pipeline/renderers/html-clips.d.ts +19 -0
- package/dist/pipeline/renderers/html-runtime.d.ts +6 -0
- package/dist/pipeline/renderers/html-template.d.ts +2 -0
- package/dist/pipeline/renderers/hyperframes.d.ts +7 -0
- package/dist/pipeline/renderers/project-builder.d.ts +7 -0
- package/dist/pipeline/renderers/types.d.ts +39 -0
- package/dist/pipeline/resolver.d.ts +19 -0
- package/dist/pipeline/scene-actions.test.d.ts +1 -0
- package/dist/pipeline/types.d.ts +81 -0
- package/dist/tools/adapters/agent.d.ts +9 -0
- package/dist/tools/adapters/agent.js +188 -0
- package/dist/tools/adapters/mcp.d.ts +34 -0
- package/dist/tools/adapters/mcp.js +173 -0
- package/dist/tools/define-tool.d.ts +82 -0
- package/dist/tools/define-tool.js +214 -0
- package/dist/tools/manifest/_project-io.d.ts +13 -0
- package/dist/tools/manifest/agent-only.d.ts +236 -0
- package/dist/tools/manifest/audio.d.ts +93 -0
- package/dist/tools/manifest/detect.d.ts +47 -0
- package/dist/tools/manifest/edit.d.ts +398 -0
- package/dist/tools/manifest/export.d.ts +27 -0
- package/dist/tools/manifest/generate.d.ts +307 -0
- package/dist/tools/manifest/index.d.ts +22 -0
- package/dist/tools/manifest/index.js +60628 -0
- package/dist/tools/manifest/inspect.d.ts +139 -0
- package/dist/tools/manifest/project.d.ts +33 -0
- package/dist/tools/manifest/remix.d.ts +154 -0
- package/dist/tools/manifest/scene.d.ts +221 -0
- package/dist/tools/manifest/status.d.ts +36 -0
- package/dist/tools/manifest/storyboard.d.ts +136 -0
- package/dist/tools/manifest/timeline.d.ts +173 -0
- package/dist/tools/manifest/walkthrough.d.ts +22 -0
- package/dist/tools/manifest.test.d.ts +13 -0
- package/dist/tools/zod-to-json-schema.d.ts +47 -0
- package/dist/utils/agent-host-detect.d.ts +61 -0
- package/dist/utils/agent-host-detect.test.d.ts +1 -0
- package/dist/utils/api-key.d.ts +58 -0
- package/dist/utils/api-key.test.d.ts +1 -0
- package/dist/utils/audio.d.ts +22 -0
- package/dist/utils/clipboard.d.ts +27 -0
- package/dist/utils/clipboard.test.d.ts +1 -0
- package/dist/utils/exec-safe.d.ts +21 -0
- package/dist/utils/first-run.d.ts +16 -0
- package/dist/utils/input-validation.d.ts +26 -0
- package/dist/utils/key-format.d.ts +15 -0
- package/dist/utils/key-live-test.d.ts +29 -0
- package/dist/utils/key-live-test.test.d.ts +1 -0
- package/dist/utils/open-url.d.ts +26 -0
- package/dist/utils/open-url.test.d.ts +1 -0
- package/dist/utils/project-resolver.d.ts +30 -0
- package/dist/utils/project-resolver.test.d.ts +8 -0
- package/dist/utils/provider-resolver.d.ts +32 -0
- package/dist/utils/provider-resolver.test.d.ts +13 -0
- package/dist/utils/remotion.d.ts +201 -0
- package/dist/utils/subtitle.d.ts +64 -0
- package/dist/utils/subtitle.test.d.ts +1 -0
- package/dist/utils/tty.d.ts +86 -0
- package/dist/utils/tty.test.d.ts +1 -0
- package/dist/utils/upload-host.d.ts +15 -0
- package/dist/utils/upload-host.test.d.ts +1 -0
- package/package.json +15 -115
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { type BuildAssetKind } from "./build-cache.js";
|
|
2
|
+
import { type AssetFreshness } from "./build-asset-metadata.js";
|
|
3
|
+
import { type LoadedProjectConfig } from "./project-config.js";
|
|
4
|
+
import { type StoryboardValidationIssue } from "./storyboard-edit.js";
|
|
5
|
+
export type BuildStage = "assets" | "compose" | "sync" | "render" | "all";
|
|
6
|
+
export type BuildPlanStatus = "ready" | "invalid";
|
|
7
|
+
export type AssetPlanReason = "canonical-exists" | "canonical-stale" | "canonical-unknown" | "content-cache-hit" | "force" | "missing" | "referenced-asset" | "invalid-reference" | "stage-skipped";
|
|
8
|
+
export type ProviderResolutionKind = BuildAssetKind | "composer";
|
|
9
|
+
export type ProviderResolutionSource = "cli" | "storyboard" | "project-config" | "default" | "auto";
|
|
10
|
+
export interface BuildPlanBeat {
|
|
11
|
+
id: string;
|
|
12
|
+
heading: string;
|
|
13
|
+
durationSec: number | null;
|
|
14
|
+
cues: Record<string, unknown>;
|
|
15
|
+
assets: {
|
|
16
|
+
narration: AssetPlan | null;
|
|
17
|
+
backdrop: AssetPlan | null;
|
|
18
|
+
video: AssetPlan | null;
|
|
19
|
+
music: AssetPlan | null;
|
|
20
|
+
};
|
|
21
|
+
composition: {
|
|
22
|
+
path: string;
|
|
23
|
+
exists: boolean;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface AssetPlan {
|
|
27
|
+
kind: BuildAssetKind;
|
|
28
|
+
cue: string;
|
|
29
|
+
provider: string;
|
|
30
|
+
path: string;
|
|
31
|
+
cachePath?: string;
|
|
32
|
+
cacheKey?: string;
|
|
33
|
+
metadataPath?: string;
|
|
34
|
+
freshness?: AssetFreshness;
|
|
35
|
+
sourcePath?: string;
|
|
36
|
+
referenceError?: string;
|
|
37
|
+
exists: boolean;
|
|
38
|
+
canonicalExists: boolean;
|
|
39
|
+
cacheHit: boolean;
|
|
40
|
+
willCopyFromCache: boolean;
|
|
41
|
+
willGenerate: boolean;
|
|
42
|
+
estimatedCostUsd: number;
|
|
43
|
+
reason: AssetPlanReason;
|
|
44
|
+
}
|
|
45
|
+
export interface ProviderResolution {
|
|
46
|
+
kind: ProviderResolutionKind;
|
|
47
|
+
requested: string | null;
|
|
48
|
+
resolved: string;
|
|
49
|
+
source: ProviderResolutionSource;
|
|
50
|
+
requiresKey: boolean;
|
|
51
|
+
configured: boolean;
|
|
52
|
+
configKey?: string;
|
|
53
|
+
missingKey?: string;
|
|
54
|
+
retryWith: string[];
|
|
55
|
+
}
|
|
56
|
+
export interface BuildPlanResult {
|
|
57
|
+
schemaVersion: "1";
|
|
58
|
+
kind: "build-plan";
|
|
59
|
+
projectDir: string;
|
|
60
|
+
config: LoadedProjectConfig;
|
|
61
|
+
stage: BuildStage;
|
|
62
|
+
status: BuildPlanStatus;
|
|
63
|
+
currentStage: BuildStage;
|
|
64
|
+
mode: "agent" | "batch" | "auto";
|
|
65
|
+
beat: string | null;
|
|
66
|
+
beats: BuildPlanBeat[];
|
|
67
|
+
missing: string[];
|
|
68
|
+
providers: string[];
|
|
69
|
+
providerResolution: ProviderResolution[];
|
|
70
|
+
estimatedCostUsd: number;
|
|
71
|
+
summary: BuildPlanSummary;
|
|
72
|
+
nextCommands: string[];
|
|
73
|
+
warnings: string[];
|
|
74
|
+
retryWith: string[];
|
|
75
|
+
validation: {
|
|
76
|
+
ok: boolean;
|
|
77
|
+
issues: StoryboardValidationIssue[];
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export interface BuildPlanSummary {
|
|
81
|
+
beats: number;
|
|
82
|
+
missing: string[];
|
|
83
|
+
providers: string[];
|
|
84
|
+
estimatedCostUsd: number;
|
|
85
|
+
validationErrors: number;
|
|
86
|
+
validationWarnings: number;
|
|
87
|
+
}
|
|
88
|
+
export interface CreateBuildPlanOptions {
|
|
89
|
+
projectDir: string;
|
|
90
|
+
stage?: BuildStage;
|
|
91
|
+
beat?: string;
|
|
92
|
+
mode?: "agent" | "batch" | "auto";
|
|
93
|
+
skipNarration?: boolean;
|
|
94
|
+
skipBackdrop?: boolean;
|
|
95
|
+
skipVideo?: boolean;
|
|
96
|
+
skipMusic?: boolean;
|
|
97
|
+
ttsProvider?: string;
|
|
98
|
+
voice?: string;
|
|
99
|
+
imageProvider?: string;
|
|
100
|
+
imageQuality?: "standard" | "hd";
|
|
101
|
+
imageSize?: string;
|
|
102
|
+
videoProvider?: string;
|
|
103
|
+
musicProvider?: string;
|
|
104
|
+
composer?: string;
|
|
105
|
+
force?: boolean;
|
|
106
|
+
}
|
|
107
|
+
export declare function createBuildPlan(opts: CreateBuildPlanOptions): Promise<BuildPlanResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module _shared/compose-prompts
|
|
3
|
+
*
|
|
4
|
+
* Phase H2 — agentic compose primitive. Reads `STORYBOARD.md` + `DESIGN.md`
|
|
5
|
+
* from a scene project and emits a structured plan for the host agent
|
|
6
|
+
* (Claude Code, Cursor, Codex, Aider) to author per-beat HTML files
|
|
7
|
+
* itself. **No LLM call from inside the CLI** — that's the point. The
|
|
8
|
+
* CLI is the deterministic toolbelt; the host agent is the sole reasoner.
|
|
9
|
+
*
|
|
10
|
+
* Output shape:
|
|
11
|
+
*
|
|
12
|
+
* {
|
|
13
|
+
* "projectDir": "<abs>",
|
|
14
|
+
* "designReference": "DESIGN.md",
|
|
15
|
+
* "storyboardReference": "STORYBOARD.md",
|
|
16
|
+
* "skillReference": "SKILL.md", // present after `scene install-skill`
|
|
17
|
+
* "compositionsDir": "compositions",
|
|
18
|
+
* "beats": [
|
|
19
|
+
* { "id": "hook", "outputPath": "compositions/scene-hook.html",
|
|
20
|
+
* "userPrompt": "...", "body": "...", "cues": {...}, "exists": false }
|
|
21
|
+
* ],
|
|
22
|
+
* "instructions": [...]
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* Pairs with H1 (`vibe scene install-skill`) — the host agent reads
|
|
26
|
+
* `SKILL.md` for framework rules, `DESIGN.md` for visual identity, then
|
|
27
|
+
* writes each `compositions/scene-<id>.html`. After authoring, runs
|
|
28
|
+
* `vibe scene lint --fix` to verify and `vibe render` to produce MP4.
|
|
29
|
+
*
|
|
30
|
+
* The internal-LLM path (`vibe scene build`, PR #176) still works — it's
|
|
31
|
+
* the batch / non-agent fallback. H3 will add mode dispatch so a single
|
|
32
|
+
* entry point picks between agentic and batch depending on context.
|
|
33
|
+
*/
|
|
34
|
+
export interface ComposePromptsBeat {
|
|
35
|
+
/** Stable beat id from `parseStoryboard().deriveBeatId()`. */
|
|
36
|
+
id: string;
|
|
37
|
+
/** Original `## …` heading line (without the `## ` prefix). */
|
|
38
|
+
heading: string;
|
|
39
|
+
/** Path the agent should write the composition to (relative to projectDir). */
|
|
40
|
+
outputPath: string;
|
|
41
|
+
/** Beat duration in seconds (from cues or `### Beat duration` subsection), if known. */
|
|
42
|
+
duration?: number;
|
|
43
|
+
/** Per-beat YAML cues parsed from the leading code block of the body. */
|
|
44
|
+
cues?: Record<string, unknown>;
|
|
45
|
+
/** Beat body markdown (with the leading `\`\`\`yaml` cue block stripped). */
|
|
46
|
+
body: string;
|
|
47
|
+
/**
|
|
48
|
+
* Pre-built user prompt — the same shape `composeBeatHtml` would send to
|
|
49
|
+
* Claude / OpenAI / Gemini. The host agent consumes this directly so the
|
|
50
|
+
* agentic and batch paths produce equivalent HTML.
|
|
51
|
+
*/
|
|
52
|
+
userPrompt: string;
|
|
53
|
+
/** True when `compositions/scene-<id>.html` already exists on disk. */
|
|
54
|
+
exists: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface ComposePromptsResult {
|
|
57
|
+
success: boolean;
|
|
58
|
+
/** Absolute project directory. */
|
|
59
|
+
projectDir: string;
|
|
60
|
+
/** Project-root-relative path to DESIGN.md (always "DESIGN.md"). */
|
|
61
|
+
designReference: string;
|
|
62
|
+
/** Project-root-relative path to STORYBOARD.md (always "STORYBOARD.md"). */
|
|
63
|
+
storyboardReference: string;
|
|
64
|
+
/**
|
|
65
|
+
* Project-root-relative path to the universal Hyperframes SKILL.md.
|
|
66
|
+
* `null` when the skill hasn't been installed — the
|
|
67
|
+
* `warnings` field then carries an actionable hint.
|
|
68
|
+
*/
|
|
69
|
+
skillReference: string | null;
|
|
70
|
+
/** Project-root-relative compositions directory (always "compositions"). */
|
|
71
|
+
compositionsDir: string;
|
|
72
|
+
/** Per-beat plan, ordered by source document position. */
|
|
73
|
+
beats: ComposePromptsBeat[];
|
|
74
|
+
/** Step-by-step instructions for the host agent. */
|
|
75
|
+
instructions: string[];
|
|
76
|
+
/** Hyperframes bundle version — informational; ties cache keys back to the internal-LLM path. */
|
|
77
|
+
bundleVersion: string;
|
|
78
|
+
/** Non-fatal hints surfaced to the agent (e.g. missing SKILL.md). */
|
|
79
|
+
warnings: string[];
|
|
80
|
+
/** Set when {@link success} is false. */
|
|
81
|
+
error?: string;
|
|
82
|
+
}
|
|
83
|
+
export interface ComposePromptsOptions {
|
|
84
|
+
/** Project directory containing STORYBOARD.md / DESIGN.md. */
|
|
85
|
+
projectDir: string;
|
|
86
|
+
/**
|
|
87
|
+
* Restrict output to a single beat id. When unset, every beat in the
|
|
88
|
+
* storyboard is emitted.
|
|
89
|
+
*/
|
|
90
|
+
beatId?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Build the agent compose plan from a scene project on disk. Pure I/O —
|
|
94
|
+
* no network, no LLM, no mutation. Caller (CLI handler / manifest tool /
|
|
95
|
+
* MCP surface) decides how to surface the result.
|
|
96
|
+
*/
|
|
97
|
+
export declare function getComposePrompts(opts: ComposePromptsOptions): Promise<ComposePromptsResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module _shared/compose-scenes-skills
|
|
3
|
+
*
|
|
4
|
+
* Single-beat Claude composer for the `compose-scenes-with-skills` v0.59
|
|
5
|
+
* pipeline action. Per beat:
|
|
6
|
+
*
|
|
7
|
+
* 1. Compute a sha256 cache key over (skill-bundle hash, DESIGN.md,
|
|
8
|
+
* storyboard global direction, beat body, model id, retry-feedback).
|
|
9
|
+
* 2. Read the user cache's `compose-scenes/<key>.html` if present.
|
|
10
|
+
* 3. Otherwise call Claude Sonnet 4.6 with the skill bundle as system
|
|
11
|
+
* prompt and the beat as user prompt; parse HTML out of a fenced
|
|
12
|
+
* code block; persist to cache.
|
|
13
|
+
*
|
|
14
|
+
* Pre-flight (PR #111) validated this exact prompt shape at 5/5 lint pass,
|
|
15
|
+
* $0.058/scene, 8.4 s. The diff between runs is high (~33 % line-Jaccard)
|
|
16
|
+
* which is precisely *why* we cache on input rather than output: same
|
|
17
|
+
* input prompts always return the same cached HTML.
|
|
18
|
+
*
|
|
19
|
+
* C3 ships:
|
|
20
|
+
* - `composeBeatHtml(ctx)` — single shot, no retry
|
|
21
|
+
* - Cache I/O (read + write) by sha256 input key
|
|
22
|
+
* - Anthropic SDK call with model selection + cost reporting
|
|
23
|
+
* - Pure prompt construction helpers (testable without API key)
|
|
24
|
+
*
|
|
25
|
+
* Lint feedback retry loop comes in C4 (extends this module).
|
|
26
|
+
*/
|
|
27
|
+
import { type LintFinding } from "./scene-lint.js";
|
|
28
|
+
import { type Beat } from "./storyboard-parse.js";
|
|
29
|
+
import { type ComposerProvider } from "./composer-resolve.js";
|
|
30
|
+
/** Effort level → token caps. Model is per-provider (see MODEL_SETTINGS_BY_PROVIDER). */
|
|
31
|
+
export type ComposeEffort = "low" | "medium" | "high";
|
|
32
|
+
export interface ComposeBeatContext {
|
|
33
|
+
/** The beat to compose, from `parseStoryboard()`. */
|
|
34
|
+
beat: Beat;
|
|
35
|
+
/** Project's `DESIGN.md` content (visual identity hard-gate). */
|
|
36
|
+
designMd: string;
|
|
37
|
+
/** Storyboard's global direction (everything before the first `## Beat`). */
|
|
38
|
+
storyboardGlobal: string;
|
|
39
|
+
/** Hyperframes skill bundle content + hash, from `loadHyperframesSkillBundle()`. */
|
|
40
|
+
skillBundle: {
|
|
41
|
+
content: string;
|
|
42
|
+
hash: string;
|
|
43
|
+
};
|
|
44
|
+
/** Effort level — picks model + token caps. Defaults to "medium". */
|
|
45
|
+
effort?: ComposeEffort;
|
|
46
|
+
/**
|
|
47
|
+
* Optional lint feedback to append to the user prompt, used by C4's retry
|
|
48
|
+
* loop. When non-empty, the cache key includes it so retries don't return
|
|
49
|
+
* the cached first-shot HTML.
|
|
50
|
+
*/
|
|
51
|
+
retryFeedback?: string;
|
|
52
|
+
/**
|
|
53
|
+
* LLM provider that powers the composer. Picked by `resolveComposer()` at
|
|
54
|
+
* the entry point (CLI flag → env auto-resolve). The `apiKey` field below
|
|
55
|
+
* is the matching key for this provider.
|
|
56
|
+
*/
|
|
57
|
+
provider: ComposerProvider;
|
|
58
|
+
/** API key for {@link ComposeBeatContext.provider}. */
|
|
59
|
+
apiKey: string;
|
|
60
|
+
/**
|
|
61
|
+
* Cache directory override. Defaults to `~/.vibeframe/cache/compose-scenes/`.
|
|
62
|
+
* Tests pass a temp dir.
|
|
63
|
+
*/
|
|
64
|
+
cacheDir?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface ComposeBeatResult {
|
|
67
|
+
/** Generated HTML (from cache or fresh API call). */
|
|
68
|
+
html: string;
|
|
69
|
+
/** True when the HTML came from cache (no API call made). */
|
|
70
|
+
cached: boolean;
|
|
71
|
+
/** Cache key used (sha256 hex). */
|
|
72
|
+
cacheKey: string;
|
|
73
|
+
/** Provider input tokens (only set on fresh API call). */
|
|
74
|
+
inputTokens?: number;
|
|
75
|
+
/** Provider output tokens (only set on fresh API call). */
|
|
76
|
+
outputTokens?: number;
|
|
77
|
+
/** USD cost of this beat (only set on fresh API call). */
|
|
78
|
+
costUsd?: number;
|
|
79
|
+
/** Wall-clock latency in ms (only set on fresh API call). */
|
|
80
|
+
latencyMs?: number;
|
|
81
|
+
/** Resolved model id (e.g. "claude-sonnet-4-6"). */
|
|
82
|
+
model: string;
|
|
83
|
+
/** Composer provider that produced this beat. */
|
|
84
|
+
provider: ComposerProvider;
|
|
85
|
+
}
|
|
86
|
+
/** Build the system prompt — skill bundle + DESIGN.md hard-gate. */
|
|
87
|
+
export declare function buildSystemPrompt(ctx: Pick<ComposeBeatContext, "skillBundle" | "designMd">): string;
|
|
88
|
+
/** Build the user prompt — instructions + storyboard global + beat body. */
|
|
89
|
+
export declare function buildUserPrompt(ctx: Pick<ComposeBeatContext, "beat" | "storyboardGlobal" | "retryFeedback">): string;
|
|
90
|
+
/**
|
|
91
|
+
* Compute the sha256 cache key for a (provider, model, system, user) tuple.
|
|
92
|
+
* Provider id is folded in so switching `--composer` doesn't serve cached
|
|
93
|
+
* HTML produced by a different model.
|
|
94
|
+
*/
|
|
95
|
+
export declare function computeCacheKey(parts: {
|
|
96
|
+
provider: ComposerProvider;
|
|
97
|
+
systemPrompt: string;
|
|
98
|
+
userPrompt: string;
|
|
99
|
+
model: string;
|
|
100
|
+
}): string;
|
|
101
|
+
/** Default cache root: `~/.vibeframe/cache/compose-scenes/`. */
|
|
102
|
+
export declare function defaultCacheDir(): string;
|
|
103
|
+
/**
|
|
104
|
+
* Pull the HTML out of Claude's response. Prefers a fenced ```html block;
|
|
105
|
+
* accepts a bare HTML response as fallback (some completions skip the fence
|
|
106
|
+
* when the entire reply is the document).
|
|
107
|
+
*/
|
|
108
|
+
export declare function extractHtml(responseText: string): string;
|
|
109
|
+
export declare class ComposeBeatError extends Error {
|
|
110
|
+
readonly code: string;
|
|
111
|
+
readonly cause?: unknown | undefined;
|
|
112
|
+
constructor(code: string, message: string, cause?: unknown | undefined);
|
|
113
|
+
}
|
|
114
|
+
/** Raw text-completion result from any of the three providers. */
|
|
115
|
+
export interface LLMCallResult {
|
|
116
|
+
text: string;
|
|
117
|
+
inputTokens: number;
|
|
118
|
+
outputTokens: number;
|
|
119
|
+
}
|
|
120
|
+
/** Injectable LLM call function — used by tests to mock the SDK calls. */
|
|
121
|
+
export type LLMCallFn = (req: {
|
|
122
|
+
provider: ComposerProvider;
|
|
123
|
+
apiKey: string;
|
|
124
|
+
model: string;
|
|
125
|
+
maxTokens: number;
|
|
126
|
+
systemPrompt: string;
|
|
127
|
+
userPrompt: string;
|
|
128
|
+
}) => Promise<LLMCallResult>;
|
|
129
|
+
/**
|
|
130
|
+
* Compose one beat into HTML. Cache-first; on miss, call the configured
|
|
131
|
+
* composer provider (Claude / OpenAI / Gemini — picked at the entry point
|
|
132
|
+
* via `resolveComposer()` and threaded through `ctx.provider`).
|
|
133
|
+
*
|
|
134
|
+
* @param overrides allows tests to inject a mocked LLM call. In prod we use
|
|
135
|
+
* `defaultCallLLM` which dispatches to the matching SDK.
|
|
136
|
+
*/
|
|
137
|
+
export declare function composeBeatHtml(ctx: ComposeBeatContext, overrides?: {
|
|
138
|
+
callLLM?: LLMCallFn;
|
|
139
|
+
now?: () => number;
|
|
140
|
+
}): Promise<ComposeBeatResult>;
|
|
141
|
+
export interface BeatLintResult {
|
|
142
|
+
errorCount: number;
|
|
143
|
+
warningCount: number;
|
|
144
|
+
findings: LintFinding[];
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Lint a single beat's HTML in-memory using `@hyperframes/producer`'s
|
|
148
|
+
* `runHyperframeLint` directly — no temp project shell, no subprocess.
|
|
149
|
+
*
|
|
150
|
+
* Sub-composition false-positives are filtered (matches what the
|
|
151
|
+
* `vibe scene lint` command does). The result is the same set of
|
|
152
|
+
* findings the user would see if they ran `vibe scene lint` after
|
|
153
|
+
* the beat HTML landed in a project.
|
|
154
|
+
*/
|
|
155
|
+
export declare function lintBeatHtml(html: string, beatId: string): BeatLintResult;
|
|
156
|
+
/**
|
|
157
|
+
* Format lint findings into a feedback block for the retry prompt.
|
|
158
|
+
* Errors only — warnings don't block, so we don't burn the LLM's
|
|
159
|
+
* attention budget on them.
|
|
160
|
+
*/
|
|
161
|
+
export declare function formatLintFeedback(findings: LintFinding[]): string;
|
|
162
|
+
export interface ComposeBeatWithRetryResult extends ComposeBeatResult {
|
|
163
|
+
/** 1 if first-shot HTML linted clean; 2 if retry succeeded. */
|
|
164
|
+
lintAttempts: 1 | 2;
|
|
165
|
+
/** Lint result from the *final* (winning) attempt. */
|
|
166
|
+
lint: BeatLintResult;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* `composeBeatHtml` + lint feedback retry loop, capped at 1 retry.
|
|
170
|
+
*
|
|
171
|
+
* Pre-flight (PR #111) showed 5/5 first-pass success at $0.058/scene; deeper
|
|
172
|
+
* retry loops just burn budget. If the second attempt also fails lint,
|
|
173
|
+
* throws `ComposeBeatError("lint-failed-after-retry", ...)` with the final
|
|
174
|
+
* findings — caller (C5 pipeline action) decides whether to fall back to
|
|
175
|
+
* the 5-preset emit path or surface the failure to the user.
|
|
176
|
+
*
|
|
177
|
+
* Cache contract preserved: retries use a different `retryFeedback`, which
|
|
178
|
+
* is folded into the cache key, so retries don't accidentally serve the
|
|
179
|
+
* cached first-shot HTML.
|
|
180
|
+
*/
|
|
181
|
+
export declare function composeBeatWithRetry(ctx: ComposeBeatContext, overrides?: {
|
|
182
|
+
callLLM?: LLMCallFn;
|
|
183
|
+
now?: () => number;
|
|
184
|
+
}): Promise<ComposeBeatWithRetryResult>;
|
|
185
|
+
/**
|
|
186
|
+
* YAML pipeline action: read DESIGN.md + STORYBOARD.md, compose each beat
|
|
187
|
+
* via Claude, write `compositions/scene-<id>.html` per beat. Sequential
|
|
188
|
+
* fanout; C6 swaps in `Promise.all` parallelism.
|
|
189
|
+
*
|
|
190
|
+
* Wired into `pipeline/executor.ts` as the `compose-scenes-with-skills`
|
|
191
|
+
* action. YAML shape:
|
|
192
|
+
*
|
|
193
|
+
* - id: compose
|
|
194
|
+
* action: compose-scenes-with-skills
|
|
195
|
+
* design: DESIGN.md # required (relative to project)
|
|
196
|
+
* storyboard: STORYBOARD.md # required
|
|
197
|
+
* project: . # optional, default outputDir
|
|
198
|
+
* effort: medium # optional, low|medium|high
|
|
199
|
+
*
|
|
200
|
+
* Returns the project root as `output` and per-beat metadata in `data`.
|
|
201
|
+
*/
|
|
202
|
+
/** Per-beat lifecycle event emitted to the optional `onProgress` callback. */
|
|
203
|
+
export type ComposeProgressEvent = {
|
|
204
|
+
type: "beat-start";
|
|
205
|
+
beatId: string;
|
|
206
|
+
beatIndex: number;
|
|
207
|
+
totalBeats: number;
|
|
208
|
+
} | {
|
|
209
|
+
type: "beat-cached";
|
|
210
|
+
beatId: string;
|
|
211
|
+
beatIndex: number;
|
|
212
|
+
totalBeats: number;
|
|
213
|
+
lintAttempts: 1 | 2;
|
|
214
|
+
} | {
|
|
215
|
+
type: "beat-fresh";
|
|
216
|
+
beatId: string;
|
|
217
|
+
beatIndex: number;
|
|
218
|
+
totalBeats: number;
|
|
219
|
+
lintAttempts: 1 | 2;
|
|
220
|
+
costUsd?: number;
|
|
221
|
+
latencyMs?: number;
|
|
222
|
+
} | {
|
|
223
|
+
type: "beat-failed";
|
|
224
|
+
beatId: string;
|
|
225
|
+
beatIndex: number;
|
|
226
|
+
totalBeats: number;
|
|
227
|
+
error: string;
|
|
228
|
+
};
|
|
229
|
+
export interface ComposeScenesParams {
|
|
230
|
+
/** Path to DESIGN.md, relative to project root. */
|
|
231
|
+
design?: string;
|
|
232
|
+
/** Path to STORYBOARD.md, relative to project root. */
|
|
233
|
+
storyboard?: string;
|
|
234
|
+
/** Scene project root, relative to outputDir. Defaults to outputDir. */
|
|
235
|
+
project?: string;
|
|
236
|
+
/** Effort tier — low/medium/high. Defaults to medium. */
|
|
237
|
+
effort?: ComposeEffort;
|
|
238
|
+
/**
|
|
239
|
+
* Composer provider override. When undefined, `resolveComposer()` picks
|
|
240
|
+
* one based on env keys (`claude > gemini > openai` order).
|
|
241
|
+
*/
|
|
242
|
+
composer?: ComposerProvider;
|
|
243
|
+
/** Override the cache directory (tests). */
|
|
244
|
+
cacheDir?: string;
|
|
245
|
+
/** Optional per-beat progress callback (CLI spinner / pipeline reporter). */
|
|
246
|
+
onProgress?: (event: ComposeProgressEvent) => void;
|
|
247
|
+
}
|
|
248
|
+
export interface ComposeScenesActionResult {
|
|
249
|
+
success: boolean;
|
|
250
|
+
/** Project root (where compositions/ lives). */
|
|
251
|
+
outputPath?: string;
|
|
252
|
+
/** Aggregated metadata for the dry-run / final report. */
|
|
253
|
+
data?: {
|
|
254
|
+
beats: number;
|
|
255
|
+
written: Array<{
|
|
256
|
+
beatId: string;
|
|
257
|
+
path: string;
|
|
258
|
+
cached: boolean;
|
|
259
|
+
cacheKey: string;
|
|
260
|
+
lintAttempts: 1 | 2;
|
|
261
|
+
costUsd?: number;
|
|
262
|
+
}>;
|
|
263
|
+
totalCostUsd: number;
|
|
264
|
+
totalTokensIn: number;
|
|
265
|
+
totalTokensOut: number;
|
|
266
|
+
cacheHits: number;
|
|
267
|
+
};
|
|
268
|
+
error?: string;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Execute the action. Per-beat fanout via `Promise.allSettled` — all beats
|
|
272
|
+
* compose in parallel, all errors surface together (rather than fail-fast,
|
|
273
|
+
* which would still pay for in-flight API calls without surfacing their
|
|
274
|
+
* findings). Tests inject `overrides` to mock the SDK + clock.
|
|
275
|
+
*
|
|
276
|
+
* Wall-clock for an N-beat compose ≈ slowest single beat (~8s @ Sonnet 4.6
|
|
277
|
+
* per pre-flight PR #111), regardless of N. Cost still scales with N.
|
|
278
|
+
*/
|
|
279
|
+
export declare function executeComposeScenesWithSkills(params: ComposeScenesParams, outputDir: string, overrides?: {
|
|
280
|
+
callLLM?: LLMCallFn;
|
|
281
|
+
now?: () => number;
|
|
282
|
+
}): Promise<ComposeScenesActionResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module _shared/composer-resolve
|
|
3
|
+
*
|
|
4
|
+
* Picks the LLM provider that powers `compose-scenes-with-skills`. Until
|
|
5
|
+
* v0.69 the composer was hardcoded to Anthropic Claude Sonnet 4.6; v0.70
|
|
6
|
+
* exposes Claude / OpenAI / Gemini as interchangeable backends behind the
|
|
7
|
+
* same Hyperframes skill-bundle prompt (Phase 0 spike validated that all
|
|
8
|
+
* three pass first-shot lint on the same prompts — see
|
|
9
|
+
* `scripts-spike-composer-providers.mts` for the data).
|
|
10
|
+
*
|
|
11
|
+
* Auto-resolve preserves the v0.69 default (Claude) when the user has an
|
|
12
|
+
* `ANTHROPIC_API_KEY` set. Without one we fall back to Gemini (cheapest of
|
|
13
|
+
* the three per the spike) and then OpenAI. Explicit `--composer <name>`
|
|
14
|
+
* always wins.
|
|
15
|
+
*/
|
|
16
|
+
export type ComposerProvider = "claude" | "openai" | "gemini";
|
|
17
|
+
export interface ComposerResolution {
|
|
18
|
+
provider: ComposerProvider;
|
|
19
|
+
apiKey: string;
|
|
20
|
+
}
|
|
21
|
+
/** Env var name for a provider's composer key. */
|
|
22
|
+
export declare function composerEnvVar(provider: ComposerProvider): string;
|
|
23
|
+
/** Human label for error messages. */
|
|
24
|
+
export declare function composerLabel(provider: ComposerProvider): string;
|
|
25
|
+
/** Validate a composer string supplied via CLI flag / pipeline YAML. */
|
|
26
|
+
export declare function isComposerProvider(value: unknown): value is ComposerProvider;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve a composer provider + key.
|
|
29
|
+
*
|
|
30
|
+
* `explicit` takes precedence — if it's set, we require its key and return
|
|
31
|
+
* exactly that provider. With no `explicit`, we walk the auto-resolve order
|
|
32
|
+
* (`claude > gemini > openai`) and return the first provider whose key is
|
|
33
|
+
* present.
|
|
34
|
+
*
|
|
35
|
+
* Throws `ComposerResolveError` if (a) `explicit` was set but its key is
|
|
36
|
+
* missing, or (b) no provider's key is present.
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveComposer(explicit?: ComposerProvider): ComposerResolution;
|
|
39
|
+
export declare class ComposerResolveError extends Error {
|
|
40
|
+
readonly code: "missing-explicit-key" | "no-key-available";
|
|
41
|
+
readonly meta: {
|
|
42
|
+
requestedProvider?: ComposerProvider;
|
|
43
|
+
};
|
|
44
|
+
constructor(code: "missing-explicit-key" | "no-key-available", message: string, meta?: {
|
|
45
|
+
requestedProvider?: ComposerProvider;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cost-tier metadata for CLI subcommands.
|
|
3
|
+
*
|
|
4
|
+
* Top-level `vibe --help` shows the four-tier table at the bottom; this
|
|
5
|
+
* module attaches the tier *per subcommand* so users see the cost
|
|
6
|
+
* directly on each `vibe <group> <sub> --help` page. The schema
|
|
7
|
+
* generator also reads it back via the symbol stamped on each Command,
|
|
8
|
+
* exposing the tier as `--describe` JSON for agents.
|
|
9
|
+
*
|
|
10
|
+
* The command modules apply the actual tier values near their command
|
|
11
|
+
* registration so schema/help output stays close to the implementation.
|
|
12
|
+
*/
|
|
13
|
+
import type { Command } from "commander";
|
|
14
|
+
export type CostTier = "free" | "low" | "high" | "very-high";
|
|
15
|
+
export declare const TIER_DESCRIPTION: Record<CostTier, string>;
|
|
16
|
+
/**
|
|
17
|
+
* Tier → chalk colorizer. Cool colors for safe tiers, warm for paid ones.
|
|
18
|
+
* Used in `--help` footers (here) and in `vibe schema --list` human output.
|
|
19
|
+
*/
|
|
20
|
+
export declare const TIER_COLOR: Record<CostTier, (s: string) => string>;
|
|
21
|
+
/**
|
|
22
|
+
* Conservative USD midpoint estimate per tier — used for budget caps
|
|
23
|
+
* where we'd rather over-count than under-count and blow past the
|
|
24
|
+
* ceiling. Pick the upper third of each tier's published range so a
|
|
25
|
+
* `--budget-usd 1` agent session denies a `very-high` tool before it
|
|
26
|
+
* fires (`$25 > $1`), but a string of `low` calls fits comfortably.
|
|
27
|
+
*
|
|
28
|
+
* Note: the agent's tool registry has a 5-tier vocabulary
|
|
29
|
+
* (`free|low|medium|high|very-high`); the CLI catalog uses 4 (no
|
|
30
|
+
* `medium`). When estimating from a tool's tier, fall back to `medium
|
|
31
|
+
* ≈ $0.50` for the in-between case.
|
|
32
|
+
*/
|
|
33
|
+
export declare const TIER_USD_ESTIMATE: Record<CostTier, number>;
|
|
34
|
+
/**
|
|
35
|
+
* Attach a cost tier to a Command — adds a footer to its `--help`
|
|
36
|
+
* output and stamps a private symbol so the schema generator can emit
|
|
37
|
+
* `cost: "<tier>"`.
|
|
38
|
+
*
|
|
39
|
+
* Returns the command for chaining.
|
|
40
|
+
*/
|
|
41
|
+
export declare function applyTier<T extends Command>(cmd: T, tier: CostTier): T;
|
|
42
|
+
/**
|
|
43
|
+
* Read back the cost tier from a Command, if `applyTier` was called.
|
|
44
|
+
* Returns `undefined` for commands that haven't opted in (e.g. utility
|
|
45
|
+
* commands like `setup`, `doctor`, `init`).
|
|
46
|
+
*/
|
|
47
|
+
export declare function getCostTier(cmd: Command): CostTier | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Bulk-apply tiers to a parent's already-registered subcommands by name.
|
|
50
|
+
* Convenient for groups whose subcommands are registered via helper
|
|
51
|
+
* functions (e.g. `registerHighlightsCommands(parent)` adds two
|
|
52
|
+
* subcommands at once) — the caller doesn't have to track which slot
|
|
53
|
+
* was filled most recently.
|
|
54
|
+
*
|
|
55
|
+
* Subcommands not present in `tiers` are left untiered. Names in
|
|
56
|
+
* `tiers` that don't match any subcommand are silently ignored.
|
|
57
|
+
*/
|
|
58
|
+
export declare function applyTiers(parent: Command, tiers: Record<string, CostTier>): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module _shared/edit/_helpers
|
|
3
|
+
* @description Private helpers shared across the edit subcommand splits.
|
|
4
|
+
* Not part of the public ai-edit barrel re-export.
|
|
5
|
+
*/
|
|
6
|
+
/** Probe video resolution via ffprobe. Falls back to 1920x1080 on parse failure. */
|
|
7
|
+
export declare function getVideoResolution(videoPath: string): Promise<{
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}>;
|
|
11
|
+
/** Escape text for FFmpeg drawtext filter. */
|
|
12
|
+
export declare function escapeDrawtext(text: string): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module _shared/edit/caption
|
|
3
|
+
* @description `executeCaption` — Whisper transcribe + ASS subtitles
|
|
4
|
+
* burn-in (or Remotion fallback if libass missing). Split out of
|
|
5
|
+
* `ai-edit.ts` in v0.69 (Plan G Phase 3).
|
|
6
|
+
*/
|
|
7
|
+
/** Visual style preset for burned-in captions. */
|
|
8
|
+
export type CaptionStyle = "minimal" | "bold" | "outline" | "karaoke";
|
|
9
|
+
/** Options for {@link executeCaption}. */
|
|
10
|
+
export interface CaptionOptions {
|
|
11
|
+
/** Path to the input video file */
|
|
12
|
+
videoPath: string;
|
|
13
|
+
/** Path for the output video with burned-in captions */
|
|
14
|
+
outputPath: string;
|
|
15
|
+
/** Caption visual style preset (default: "bold") */
|
|
16
|
+
style?: CaptionStyle;
|
|
17
|
+
/** Font size override (auto-calculated from video height if omitted) */
|
|
18
|
+
fontSize?: number;
|
|
19
|
+
/** Font color name (default: "white") */
|
|
20
|
+
fontColor?: string;
|
|
21
|
+
/** Language code for Whisper transcription */
|
|
22
|
+
language?: string;
|
|
23
|
+
/** Vertical position of captions (default: "bottom") */
|
|
24
|
+
position?: "top" | "center" | "bottom";
|
|
25
|
+
/** Override OpenAI API key */
|
|
26
|
+
apiKey?: string;
|
|
27
|
+
}
|
|
28
|
+
/** Result from {@link executeCaption}. */
|
|
29
|
+
export interface CaptionResult {
|
|
30
|
+
/** Whether the operation succeeded */
|
|
31
|
+
success: boolean;
|
|
32
|
+
/** Path to the output video with captions */
|
|
33
|
+
outputPath?: string;
|
|
34
|
+
/** Path to the generated SRT file */
|
|
35
|
+
srtPath?: string;
|
|
36
|
+
/** Number of transcript segments */
|
|
37
|
+
segmentCount?: number;
|
|
38
|
+
/** Error message on failure */
|
|
39
|
+
error?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Transcribe video audio and burn styled captions using Whisper + FFmpeg.
|
|
43
|
+
*
|
|
44
|
+
* Pipeline: extract audio -> Whisper transcription -> generate SRT ->
|
|
45
|
+
* burn captions via FFmpeg subtitles filter (or Remotion fallback).
|
|
46
|
+
*/
|
|
47
|
+
export declare function executeCaption(options: CaptionOptions): Promise<CaptionResult>;
|