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.

fix: read host facets by kind, and report the models a package offers

rpone77e609524f66
diff --git a/packages/reference-video-tools/package.json b/packages/reference-video-tools/package.json
index a95c8549..08a660df 100644
--- a/packages/reference-video-tools/package.json
+++ b/packages/reference-video-tools/package.json
@@ -13,6 +13,7 @@
"dependencies": {
"@google/genai": "1.52.0",
"@hypit/markup": "workspace:*",
+ "@hypit/model-kit": "workspace:*",
"@hypit/package-loader-node": "workspace:*",
"@hypit/protocol": "workspace:*",
"tsx": "4.21.0"
diff --git a/packages/reference-video-tools/src/tools.ts b/packages/reference-video-tools/src/tools.ts
index 20488d94..05f10709 100644
--- a/packages/reference-video-tools/src/tools.ts
+++ b/packages/reference-video-tools/src/tools.ts
@@ -4,7 +4,9 @@ import { access, readdir, stat, writeFile } from "node:fs/promises";
import { dirname, join, resolve } from "node:path";
import { createRequire } from "node:module";
import { loadNodePackageSelection } from "@hypit/package-loader-node";
+import { markupSurfaceHostFacetAbi } from "@hypit/markup";
import type { RegisteredSurface, SurfaceVocabulary } from "@hypit/markup";
+import { exactModelHostAbi } from "@hypit/model-kit";
import {
assert,
@@ -275,12 +277,22 @@ export function createReferenceVideoTools(options: ToolOptions = {}): ReferenceV
const manifest = await readJson<{ readonly hypit?: { readonly activation?: string }; readonly description?: string }>(
join(scope, name, "package.json"));
if (manifest?.hypit?.activation === undefined) continue;
+ // A package publishes several kinds of facet. Reading them all as one kind produced a null
+ // for every facet that is not a Markup Surface, which is what an exact-model package mostly
+ // publishes — the listing said `["TextVideo", "Value", null]` and a Provider said `[null]`.
const tags: string[] = [];
+ const models: string[] = [];
let note: string | undefined;
try {
for (const pack of await loadNodePackageSelection([specifier], packageRoot)) {
for (const facet of pack.contribution.hostFacets ?? []) {
- tags.push((facet.implementation as RegisteredSurface).tag);
+ if (facet.abi === markupSurfaceHostFacetAbi) {
+ tags.push((facet.implementation as RegisteredSurface).tag);
+ continue;
+ }
+ if (facet.abi === exactModelHostAbi) {
+ models.push(...(facet as { readonly offers?: readonly string[] }).offers ?? []);
+ }
}
}
} catch (error) { note = error instanceof Error ? error.message : String(error); }
@@ -288,6 +300,7 @@ export function createReferenceVideoTools(options: ToolOptions = {}): ReferenceV
package_name: specifier,
...(manifest.description === undefined ? {} : { description: manifest.description }),
tags: [...new Set(tags)].sort(),
+ ...(models.length === 0 ? {} : { models: [...new Set(models)].sort() }),
...(note === undefined ? {} : { unreadable: note }),
});
}
diff --git a/packages/reference-video-tools/test/tools.test.ts b/packages/reference-video-tools/test/tools.test.ts
index 1ecedebf..c30221ad 100644
--- a/packages/reference-video-tools/test/tools.test.ts
+++ b/packages/reference-video-tools/test/tools.test.ts
@@ -88,6 +88,9 @@ test("installed packages can be listed, and one that will not load is reported r
assert.equal(packages[0]!["description"], "declares a Surface");
assert.equal(typeof packages[0]!["unreadable"], "string",
"a package that declares an activation it cannot load is named, not silently dropped");
+ assert.equal(packages[0]!["tags"] !== undefined
+ && (packages[0]!["tags"] as readonly unknown[]).includes(null), false,
+ "a facet that is not a Markup Surface has no tag, and reading one out of it produced a null entry");
});
test("observation covers picture, drawn type and sound for every shot and caches every key", async () => {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 3694f0e5..09656ab1 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -225,6 +225,52 @@ importers:
specifier: ^1.6.4
+ examples/ranking-typewriter-reverse/packages/local-paper-list:
+ dependencies:
+ '@hypit/component-kit':
+ specifier: workspace:*
+ version: link:../../../../packages/component-kit
+ '@hypit/composition':
+ specifier: workspace:*
+ version: link:../../../../packages/composition
+ '@hypit/elaborator':
+ specifier: workspace:*
+ version: link:../../../../packages/elaborator
+ '@hypit/markup':
+ specifier: workspace:*
+ version: link:../../../../packages/markup
+ '@hypit/media':
+ specifier: workspace:*
+ version: link:../../../../packages/media
+ '@hypit/narrative':
+ specifier: workspace:*
+ version: link:../../../../packages/narrative
+ '@hypit/program-space':
+ specifier: workspace:*
+ version: link:../../../../packages/program-space
+ '@hypit/protocol':
+ specifier: workspace:*
+ version: link:../../../../packages/protocol
+ '@hypit/semantic-map':
+ specifier: workspace:*
+ version: link:../../../../packages/semantic-map
+ '@hypit/spatial':
+ specifier: workspace:*
+ version: link:../../../../packages/spatial
+ '@hypit/svs':
+ specifier: workspace:*
+ version: link:../../../../packages/svs
+ '@hypit/temporal':
+ specifier: workspace:*
+ version: link:../../../../packages/temporal
+ '@hypit/text':
+ specifier: workspace:*
+ version: link:../../../../packages/text
+ devDependencies:
+ '@hypit/core':
+ specifier: workspace:*
+ version: link:../../../../packages/core
+
packages/artifact:
dependencies:
'@hypit/protocol':
@@ -2090,6 +2136,9 @@ importers:
'@hypit/markup':
specifier: workspace:*
version: link:../markup
+ '@hypit/model-kit':
+ specifier: workspace:*
+ version: link:../model-kit
'@hypit/package-loader-node':
specifier: workspace:*
version: link:../package-loader-node