Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

feat: the Producers a Fragment may call are listed with their ports (#79)

rponeawa661ada0c4cd0
diff --git a/.agents/skills/hypit/references/local-author-package.md b/.agents/skills/hypit/references/local-author-package.md
index 5f6eca4f..3f63d431 100644
--- a/.agents/skills/hypit/references/local-author-package.md
+++ b/.agents/skills/hypit/references/local-author-package.md
@@ -52,9 +52,12 @@ hypit-reference-video-tools inspect_visual_contract
It answers the questions a component is written against — which element kinds exist, which style
names are admitted on them, which of those take an enum, how few keyframes an animation carries, and
-the four rules the seal enforces about parents, `order` and interpolation. Every line is generated
-from the Composition schema, so it says what will be accepted rather than what one package happened
-to do. `inspect_svml_vocabulary` answers the other half: what a Source may write.
+the four rules the seal enforces about parents, `order` and interpolation. Add
+`--producers-of @hypit/temporal` for the Producers a Fragment calls to turn a Script name into a
+window, with their port names, and the same for any package whose Producers you chain. Every line is
+generated from the Composition schema and the Modules themselves, so it says what will be accepted
+rather than what one package happened to do. `inspect_svml_vocabulary` answers the other half: what a
+Source may write.
Open a package's source only when neither command settles it — a role whose shape the guide leaves
implicit, an export whose signature you need exactly. Use `hypit paths --json` to locate
diff --git a/packages/reference-video-tools/src/cli.ts b/packages/reference-video-tools/src/cli.ts
index 66746614..be936d59 100644
--- a/packages/reference-video-tools/src/cli.ts
+++ b/packages/reference-video-tools/src/cli.ts
@@ -16,7 +16,7 @@ function usage(): string {
" hypit-reference-video-tools observe_reference --reference-id <id> --batch <questions.json>",
" hypit-reference-video-tools record_observation --reference-id <id> --key <key> --text <text>|--text-file <path>",
" hypit-reference-video-tools inspect_svml_vocabulary --package <name> [--package <name> ...] [--tag <tag> ...] [--without-previews]",
- " hypit-reference-video-tools inspect_visual_contract [--shape visual-track|text-flow|text-typography|text-paint|text-document|path-command]",
+ " hypit-reference-video-tools inspect_visual_contract [--shape visual-track|text-flow|text-typography|text-paint|text-document|path-command] [--producers-of <package> ...]",
" hypit-reference-video-tools paths",
" hypit-reference-video-tools compare_reconstruction --reference-id <id> --run <build.svrun> --segment <id>|--selection <id> --video <path>|--image <path> [--question <scope>] [--element <id>]",
" hypit-reference-video-tools compare_reconstruction --reference-id <id> --shot-id <id> --video <path>|--image <path> [--question <scope>] [--element <id>]",
@@ -306,7 +306,10 @@ async function main(): Promise<void> {
};
result = await tools.compare_reconstruction(input as { reference_id: string; shot_id?: string; segment?: string; selection?: string; run?: string; image_path?: string; video_path?: string; question?: string; element?: string });
} else if (command === "inspect_visual_contract") {
- result = await tools.inspect_visual_contract({ ...(one(flags, "shape") === undefined ? {} : { shape: one(flags, "shape")! }) });
+ result = await tools.inspect_visual_contract({
+ ...(one(flags, "shape") === undefined ? {} : { shape: one(flags, "shape")! }),
+ ...(many(flags, "producers-of").length === 0 ? {} : { producers: many(flags, "producers-of") }),
+ });
} else if (command === "paths") {
result = await tools.paths();
} else if (command === "inspect_svml_vocabulary") {
diff --git a/packages/reference-video-tools/src/tools.ts b/packages/reference-video-tools/src/tools.ts
index 4bb9953f..0d83c11e 100644
--- a/packages/reference-video-tools/src/tools.ts
+++ b/packages/reference-video-tools/src/tools.ts
@@ -126,7 +126,7 @@ export type ReferenceVideoTools = {
prepare_reference(input: PrepareReferenceInput): Promise<PrepareResult>;
observe_reference(input: ObserveReferenceInput): Promise<Record<string, unknown>>;
inspect_svml_vocabulary(input: InspectVocabularyInput): Promise<Record<string, unknown>>;
- inspect_visual_contract(input: { readonly shape?: string }): Promise<Record<string, unknown>>;
+ inspect_visual_contract(input: { readonly shape?: string; readonly producers?: readonly string[] }): Promise<Record<string, unknown>>;
paths(): Promise<Record<string, unknown>>;
compare_reconstruction(input: CompareReconstructionInput): Promise<Record<string, unknown>>;
record_observation(input: RecordObservationInput): Promise<Record<string, unknown>>;
@@ -1244,8 +1244,22 @@ export function createReferenceVideoTools(options: ToolOptions = {}): ReferenceV
assert(asked === undefined || asked.length === 0 || Object.hasOwn(shapes, asked),
`shape must be one of ${Object.keys(shapes).join(", ")}`);
const chosen = asked === undefined || asked.length === 0 ? Object.keys(shapes) : [asked];
+ // Which Producers a Fragment may call, read off the Modules the named packages carry. A
+ // component's Fragment names one per operation, and the names were reachable only by opening a
+ // package that already called them.
+ const wanted = input.producers ?? [];
+ const calls = wanted.length === 0 ? [] : (await loadNodePackageSelection(wanted, packageRoot).catch(() => []))
+ .flatMap((pack) => (pack.contribution.modules ?? []).flatMap((module) =>
+ module.manifest.producers.map((producer) => ({
+ module: `${module.manifest.name}@${module.manifest.version}`,
+ producer: producer.name,
+ inputs: producer.inputs.map((port) => port.name),
+ outputs: producer.outputs.map((port) => port.name),
+ ...(producer.needs.length === 0 ? {} : { needs: producer.needs.map((port) => port.name) }),
+ }))));
return {
shapes: chosen.map((name) => ({ shape: name, describes: describeSchema(shapes[name]!).join("\n") })),
+ ...(calls.length === 0 ? {} : { producers: calls }),
// Each of these is refused somewhere, or follows from how the emitted CSS is written. None is
// a convention: a rule stated here that the code does not hold would be worse than silence.
rules: [