@nebutra/brand-genesis 0.2.0 → 0.2.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/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  # @nebutra/brand-genesis
2
2
 
3
+ Status: **WIP**
4
+
3
5
  `brand-genesis` is the flagship Play package. It distills a one-sentence
4
6
  company idea into a `BrandContext`, writes `company/BRAND.md`, then delegates
5
7
  asset generation to existing media capabilities.
6
8
 
7
- It intentionally does not own image, video, audio, voice, mesh, or landing-page
9
+ It intentionally does not own image, video, audio, voice, mesh, or landing
8
10
  generation primitives.
9
11
 
10
12
  ```ts
@@ -3,6 +3,7 @@ import { mkdir } from "fs/promises";
3
3
  import { dirname, join } from "path";
4
4
  import { MeshPipeline } from "@nebutra/3d-pipeline";
5
5
  import { AudioPipeline } from "@nebutra/audio-pipeline";
6
+ import { requireCapabilityTenant } from "@nebutra/capability-kit";
6
7
  import { appendCapabilityDebug, readCapabilityDebug } from "@nebutra/capability-kit/debug";
7
8
  import { ContentStore, serializeContentFrontmatter } from "@nebutra/content-store";
8
9
  import { CapabilityError } from "@nebutra/errors";
@@ -21,18 +22,8 @@ var CHECKPOINTS = [
21
22
  "video_rendered",
22
23
  "final_compose"
23
24
  ];
24
- function requireTenant(explicit, fallback) {
25
- const tenantId = explicit ?? fallback;
26
- if (!tenantId?.trim()) {
27
- throw new CapabilityError("brand-genesis", "Brand Genesis requires tenant context", {
28
- suggestion: "Pass tenantId on the input or construct BrandGenesis with tenantId.",
29
- statusCode: 400
30
- });
31
- }
32
- return tenantId;
33
- }
34
25
  function normalizeBrandId(name) {
35
- return name.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "").slice(0, 32);
26
+ return name.slice(0, 200).toLowerCase().replace(/[^a-z0-9]{1,200}/g, "_").replace(/^_{1,200}|_{1,200}$/g, "").slice(0, 32);
36
27
  }
37
28
  function pickName(idea) {
38
29
  const called = idea.match(/\bcalled\s+([A-Z][a-zA-Z0-9]*(?:\s+[A-Z][a-zA-Z0-9]*)?)/);
@@ -223,7 +214,14 @@ var BrandGenesis = class _BrandGenesis {
223
214
  return new _BrandGenesis({ ...options, tenantId, root, contentStore, eventLog });
224
215
  }
225
216
  async run(input) {
226
- const tenantId = requireTenant(input.tenantId, this.#tenantId);
217
+ const tenantId = requireCapabilityTenant({
218
+ explicit: input.tenantId,
219
+ fallback: this.#tenantId,
220
+ onMissing: () => new CapabilityError("brand-genesis", "Brand Genesis requires tenant context", {
221
+ suggestion: "Pass tenantId on the input or construct BrandGenesis with tenantId.",
222
+ statusCode: 400
223
+ })
224
+ });
227
225
  const draft = distillBrandIdea(input);
228
226
  const brand = brandContextFromDraft(draft, tenantId);
229
227
  const brandMarkdown = renderBrandMarkdown(draft, brand);
@@ -394,4 +392,4 @@ export {
394
392
  BrandGenesis,
395
393
  readBrandGenesisDebug
396
394
  };
397
- //# sourceMappingURL=chunk-SB4N3ZZW.js.map
395
+ //# sourceMappingURL=chunk-2UQ5N3IJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { mkdir } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport { type MeshAsset, MeshPipeline } from \"@nebutra/3d-pipeline\";\nimport { type AudioAsset, AudioPipeline } from \"@nebutra/audio-pipeline\";\nimport { requireCapabilityTenant } from \"@nebutra/capability-kit\";\nimport { appendCapabilityDebug, readCapabilityDebug } from \"@nebutra/capability-kit/debug\";\nimport { ContentStore, serializeContentFrontmatter } from \"@nebutra/content-store\";\nimport { CapabilityError } from \"@nebutra/errors\";\nimport { EventLog } from \"@nebutra/event-log\";\nimport {\n assetId,\n type BrandColor,\n type BrandContext,\n type VisualStyle,\n} from \"@nebutra/generation-context\";\nimport { type ImageAsset, ImagePipeline } from \"@nebutra/image-pipeline\";\nimport { type Storyboard, type VideoAsset, VideoPipeline } from \"@nebutra/video-pipeline\";\nimport { type VoiceAsset, VoiceRealtime } from \"@nebutra/voice-realtime\";\n\nexport type VisualDirectionHint =\n | \"cyberpunk\"\n | \"minimal\"\n | \"organic\"\n | \"playful\"\n | \"corporate\"\n | \"retro\"\n | \"futurist\";\n\nexport interface BrandFilmInput {\n readonly tenantId?: string;\n readonly idea: string;\n readonly founderVoiceId?: string;\n readonly visualDirectionHint?: VisualDirectionHint;\n}\n\nexport interface BrandIdentityDraft {\n readonly name: string;\n readonly oneLiner: string;\n readonly tagline: string;\n readonly targetAudience: string;\n readonly toneKeywords: readonly string[];\n readonly differentiation: string;\n readonly visualStyle: VisualStyle;\n}\n\nexport interface BrandPackage {\n readonly tenantId: string;\n readonly play: \"brand_film_60s\";\n readonly brand: BrandContext;\n readonly draft: BrandIdentityDraft;\n readonly brandMdPath: string;\n readonly palettePath: string;\n readonly landingPath: string;\n readonly logo: ImageAsset;\n readonly hero: ImageAsset;\n readonly icon: ImageAsset;\n readonly mesh: MeshAsset;\n readonly storyboard: Storyboard;\n readonly film: VideoAsset;\n readonly bgm: AudioAsset;\n readonly narration: VoiceAsset;\n readonly eventId: string;\n readonly checkpoints: readonly string[];\n}\n\nexport interface BrandGenesisDoctorReport {\n readonly capability: \"brand-genesis\";\n readonly ok: boolean;\n readonly checkedAt: string;\n readonly play: {\n readonly ok: boolean;\n readonly name: \"brand_film_60s\";\n readonly requiredSkills: readonly string[];\n };\n readonly media: {\n readonly image: readonly unknown[];\n readonly video: readonly unknown[];\n readonly audio: readonly unknown[];\n readonly voice: readonly unknown[];\n readonly mesh: readonly unknown[];\n };\n readonly suggestion?: string;\n}\n\nexport interface BrandGenesisOptions {\n readonly tenantId?: string;\n readonly root?: string;\n readonly debugRoot?: string;\n readonly contentStore?: ContentStore;\n readonly eventLog?: EventLog;\n readonly imagePipeline?: ImagePipeline;\n readonly videoPipeline?: VideoPipeline;\n readonly audioPipeline?: AudioPipeline;\n readonly voiceRealtime?: VoiceRealtime;\n readonly meshPipeline?: MeshPipeline;\n}\n\nconst PLAY_NAME = \"brand_film_60s\" as const;\nconst CHECKPOINTS = [\n \"brand_distillation\",\n \"visual_direction\",\n \"assets_generated\",\n \"video_rendered\",\n \"final_compose\",\n] as const;\n\nfunction normalizeBrandId(name: string): string {\n return name\n .slice(0, 200)\n .toLowerCase()\n .replace(/[^a-z0-9]{1,200}/g, \"_\")\n .replace(/^_{1,200}|_{1,200}$/g, \"\")\n .slice(0, 32);\n}\n\nfunction pickName(idea: string): string {\n const called = idea.match(/\\bcalled\\s+([A-Z][a-zA-Z0-9]*(?:\\s+[A-Z][a-zA-Z0-9]*)?)/);\n if (called?.[1]) return called[1].trim();\n const capitalized = [...idea.matchAll(/\\b[A-Z][a-zA-Z0-9]{2,}\\b/g)]\n .map((match) => match[0])\n .filter((value) => ![\"AI\", \"SaaS\", \"API\"].includes(value));\n return capitalized.at(-1) ?? \"Venture\";\n}\n\nfunction paletteFor(hint: VisualDirectionHint | undefined): readonly BrandColor[] {\n switch (hint) {\n case \"cyberpunk\":\n case \"futurist\":\n return [\n { name: \"electric cyan\", hex: \"#00D4FF\", role: \"primary\" },\n { name: \"carbon black\", hex: \"#111318\", role: \"background\" },\n { name: \"signal amber\", hex: \"#F3C14B\", role: \"accent\" },\n ];\n case \"organic\":\n return [\n { name: \"moss\", hex: \"#3D7A57\", role: \"primary\" },\n { name: \"paper\", hex: \"#F7F4EA\", role: \"background\" },\n { name: \"clay\", hex: \"#C86B4A\", role: \"accent\" },\n ];\n case \"playful\":\n return [\n { name: \"coral\", hex: \"#FF6B6B\", role: \"primary\" },\n { name: \"ink\", hex: \"#202124\", role: \"neutral\" },\n { name: \"mint\", hex: \"#7CE2C6\", role: \"accent\" },\n ];\n case \"corporate\":\n return [\n { name: \"trust blue\", hex: \"#2454D6\", role: \"primary\" },\n { name: \"slate\", hex: \"#202A36\", role: \"neutral\" },\n { name: \"clear sky\", hex: \"#E8F0FF\", role: \"background\" },\n ];\n case \"retro\":\n return [\n { name: \"oxide\", hex: \"#B95F3B\", role: \"primary\" },\n { name: \"night ink\", hex: \"#18202A\", role: \"neutral\" },\n { name: \"cream light\", hex: \"#F8E7C9\", role: \"background\" },\n ];\n default:\n return [\n { name: \"graphite\", hex: \"#1F2933\", role: \"primary\" },\n { name: \"white\", hex: \"#FFFFFF\", role: \"background\" },\n { name: \"signal green\", hex: \"#00A693\", role: \"accent\" },\n ];\n }\n}\n\nfunction styleFor(hint: VisualDirectionHint | undefined): VisualStyle {\n const name = hint ?? \"minimal\";\n const keywordsByHint: Record<VisualDirectionHint, readonly string[]> = {\n cyberpunk: [\"electric\", \"terminal-native\", \"high-contrast\"],\n minimal: [\"calm\", \"precise\", \"spacious\"],\n organic: [\"warm\", \"natural\", \"human\"],\n playful: [\"bright\", \"friendly\", \"kinetic\"],\n corporate: [\"credible\", \"structured\", \"clear\"],\n retro: [\"nostalgic\", \"tactile\", \"characterful\"],\n futurist: [\"clean\", \"technical\", \"forward\"],\n };\n return {\n name,\n keywords: keywordsByHint[name],\n avoid: [\"generic stock\", \"dark horror\", \"visual clutter\"],\n };\n}\n\nexport function distillBrandIdea(input: BrandFilmInput): BrandIdentityDraft {\n const idea = input.idea.trim();\n if (idea.length === 0) {\n throw new CapabilityError(\"brand-genesis\", \"Brand idea is empty\", {\n suggestion: \"Pass a one-sentence company idea before running Brand Genesis.\",\n statusCode: 400,\n });\n }\n const name = pickName(idea);\n const devAudience = /\\bdev|debug|code|developer|engineering/i.test(idea);\n const audience = devAudience\n ? \"Independent developers and small engineering teams shipping software quickly\"\n : \"Early-stage founders validating a focused product wedge\";\n const toneKeywords = devAudience\n ? [\"technical\", \"direct\", \"warm\"]\n : [\"clear\", \"confident\", \"useful\"];\n return {\n name,\n oneLiner: idea,\n tagline: devAudience ? \"Debug like it is a conversation\" : `${name} turns intent into launch`,\n targetAudience: audience,\n toneKeywords,\n differentiation: devAudience\n ? \"Understands the full production context instead of treating each error as an isolated message\"\n : \"Combines brand, execution, and company memory in one repeatable workflow\",\n visualStyle: styleFor(input.visualDirectionHint),\n };\n}\n\nexport function brandContextFromDraft(\n draft: BrandIdentityDraft,\n tenantId: string,\n sourcePath = \"company/BRAND.md\",\n palette = paletteFor(draft.visualStyle.name as VisualDirectionHint),\n): BrandContext {\n return {\n tenantId,\n brandId: normalizeBrandId(draft.name),\n name: draft.name,\n palette,\n typography: {\n heading: draft.visualStyle.name === \"cyberpunk\" ? \"Geist Mono\" : \"Geist Sans\",\n body: \"Geist Sans\",\n accent: \"Geist Mono\",\n },\n visualStyle: draft.visualStyle,\n referenceImages: [],\n forbidden: draft.visualStyle.avoid ?? [],\n toneKeywords: draft.toneKeywords,\n sourcePath,\n };\n}\n\nexport function renderBrandMarkdown(draft: BrandIdentityDraft, brand: BrandContext): string {\n return serializeContentFrontmatter(\n {\n type: \"brand_profile\",\n brand_id: brand.brandId,\n name: brand.name,\n },\n [\n `# ${brand.name}`,\n \"\",\n draft.oneLiner,\n \"\",\n \"## Tagline\",\n \"\",\n draft.tagline,\n \"\",\n \"## Audience\",\n \"\",\n draft.targetAudience,\n \"\",\n \"## Tone\",\n \"\",\n brand.toneKeywords.join(\", \"),\n \"\",\n \"## Visual Direction\",\n \"\",\n `${brand.visualStyle.name}: ${brand.visualStyle.keywords.join(\", \")}`,\n \"\",\n \"## Differentiation\",\n \"\",\n draft.differentiation,\n \"\",\n ].join(\"\\n\"),\n );\n}\n\nfunction renderLandingManifest(draft: BrandIdentityDraft, brand: BrandContext): string {\n return [\n \"<!doctype html>\",\n '<html lang=\"en\">',\n \"<head>\",\n ' <meta charset=\"utf-8\" />',\n ` <title>${brand.name}</title>`,\n \"</head>\",\n \"<body>\",\n ` <main data-brand-id=\"${brand.brandId}\">`,\n ` <h1>${brand.name}</h1>`,\n ` <p>${draft.tagline}</p>`,\n ` <p>${draft.oneLiner}</p>`,\n \" </main>\",\n \"</body>\",\n \"</html>\",\n \"\",\n ].join(\"\\n\");\n}\n\nexport class BrandGenesis {\n readonly #tenantId: string | undefined;\n readonly #root: string;\n readonly #debugRoot: string;\n readonly #contentStore: ContentStore;\n readonly #eventLog: EventLog;\n readonly #image: ImagePipeline;\n readonly #video: VideoPipeline;\n readonly #audio: AudioPipeline;\n readonly #voice: VoiceRealtime;\n readonly #mesh: MeshPipeline;\n\n private constructor(\n options: BrandGenesisOptions & { contentStore: ContentStore; eventLog: EventLog },\n ) {\n this.#tenantId = options.tenantId;\n this.#root = options.root ?? join(process.cwd(), \".nebutra\", \"brand-genesis\");\n this.#debugRoot = options.debugRoot ?? process.cwd();\n this.#contentStore = options.contentStore;\n this.#eventLog = options.eventLog;\n this.#image = options.imagePipeline ?? new ImagePipeline({ root: this.#root });\n this.#video = options.videoPipeline ?? new VideoPipeline({ root: this.#root });\n this.#audio = options.audioPipeline ?? new AudioPipeline({ root: this.#root });\n this.#voice = options.voiceRealtime ?? new VoiceRealtime({ root: this.#root });\n this.#mesh = options.meshPipeline ?? new MeshPipeline({ root: this.#root });\n }\n\n static async open(\n root = \".nebutra/brand-genesis\",\n options: Omit<BrandGenesisOptions, \"root\" | \"contentStore\" | \"eventLog\"> = {},\n ): Promise<BrandGenesis> {\n const tenantId = options.tenantId ?? \"local\";\n await mkdir(root, { recursive: true });\n const contentStore = await ContentStore.open(join(root, \"content\"), { tenantId });\n const eventLog = await EventLog.open(join(root, \"event-log\"), { tenantId });\n return new BrandGenesis({ ...options, tenantId, root, contentStore, eventLog });\n }\n\n async run(input: BrandFilmInput): Promise<BrandPackage> {\n const tenantId = requireCapabilityTenant({\n explicit: input.tenantId,\n fallback: this.#tenantId,\n onMissing: () =>\n new CapabilityError(\"brand-genesis\", \"Brand Genesis requires tenant context\", {\n suggestion: \"Pass tenantId on the input or construct BrandGenesis with tenantId.\",\n statusCode: 400,\n }),\n });\n const draft = distillBrandIdea(input);\n const brand = brandContextFromDraft(draft, tenantId);\n const brandMarkdown = renderBrandMarkdown(draft, brand);\n await this.#contentStore.write(brand.sourcePath, brandMarkdown);\n const palettePath = \"company/assets/palette.json\";\n await this.#contentStore.write(\n palettePath,\n `${JSON.stringify({ brandId: brand.brandId, colors: brand.palette }, null, 2)}\\n`,\n );\n await this.#debug({\n type: \"checkpoint\",\n step: CHECKPOINTS[0],\n tenantId,\n brandId: brand.brandId,\n });\n await this.#debug({\n type: \"checkpoint\",\n step: CHECKPOINTS[1],\n tenantId,\n brandId: brand.brandId,\n });\n\n const [logo, hero, icon] = await Promise.all([\n this.#image.generate({ type: \"logo\", company: brand.name, oneLiner: draft.oneLiner }, brand),\n this.#image.generate({ type: \"hero\", headline: draft.tagline }, brand),\n this.#image.generate({ type: \"icon\", subject: brand.name }, brand),\n ]);\n const mesh = await this.#mesh.fromImage(logo, brand);\n await this.#debug({\n type: \"checkpoint\",\n step: CHECKPOINTS[2],\n tenantId,\n brandId: brand.brandId,\n });\n\n const storyboard = await this.#video.plan(\n { type: \"brand-film\", durationS: 60, theme: draft.tagline },\n brand,\n );\n const rendered = await this.#video.render(storyboard, brand);\n await this.#debug({\n type: \"checkpoint\",\n step: CHECKPOINTS[3],\n tenantId,\n brandId: brand.brandId,\n });\n\n const bgm = await this.#audio.generate(\n { type: \"bgm\", durationS: rendered.durationS, mood: brand.toneKeywords.join(\" \") },\n brand,\n true,\n );\n const narration = await this.#voice.synthesizeNarration(\n {\n script: `${draft.tagline}. ${draft.oneLiner}. ${draft.differentiation}.`,\n targetDurationS: Math.max(8, Math.min(20, rendered.durationS - 3)),\n ...(input.founderVoiceId !== undefined ? { voiceProfileId: input.founderVoiceId } : {}),\n },\n brand,\n );\n const film = await this.#video.compose({\n videoTrack: [rendered],\n audioTrack: [bgm],\n voiceTrack: [narration],\n captionTrack: [{ startS: 0, endS: narration.durationS, text: narration.transcript }],\n });\n const landingPath = \"company/landing/index.html\";\n await this.#contentStore.write(landingPath, renderLandingManifest(draft, brand));\n await this.#debug({\n type: \"checkpoint\",\n step: CHECKPOINTS[4],\n tenantId,\n brandId: brand.brandId,\n });\n\n const eventId = await this.#eventLog.commit({\n traceId: assetId(\"brand_genesis\", brand.brandId),\n kind: \"content_write\",\n affected: [\n brand.sourcePath,\n palettePath,\n landingPath,\n logo.path,\n hero.path,\n icon.path,\n film.path,\n ],\n parent: null,\n snapshot: {\n [brand.sourcePath]: brandMarkdown,\n [palettePath]: JSON.stringify({ brandId: brand.brandId, colors: brand.palette }, null, 2),\n [landingPath]: renderLandingManifest(draft, brand),\n },\n });\n\n const result: BrandPackage = {\n tenantId,\n play: PLAY_NAME,\n brand,\n draft,\n brandMdPath: brand.sourcePath,\n palettePath,\n landingPath,\n logo,\n hero,\n icon,\n mesh,\n storyboard,\n film,\n bgm,\n narration,\n eventId,\n checkpoints: CHECKPOINTS,\n };\n await this.#debug({ type: \"run\", tenantId, brandId: brand.brandId, eventId });\n return result;\n }\n\n async doctor(): Promise<BrandGenesisDoctorReport> {\n const [image, video, audio, rawVoice, mesh] = await Promise.all([\n this.#image.doctor(),\n this.#video.doctor(),\n this.#audio.doctor(),\n this.#voice.doctor(),\n this.#mesh.doctor(),\n ]);\n const voice = [{ provider: \"narration-local\", ok: true }, ...rawVoice];\n const localOk = [image, video, audio, voice, mesh].every((checks) =>\n checks.some((check) => Boolean((check as { ok?: boolean }).ok)),\n );\n return {\n capability: \"brand-genesis\",\n ok: localOk,\n checkedAt: new Date().toISOString(),\n play: {\n ok: true,\n name: PLAY_NAME,\n requiredSkills: [\n \"image_pipeline.generate\",\n \"video_pipeline.plan\",\n \"video_pipeline.render\",\n \"video_pipeline.compose\",\n \"audio_pipeline.generate\",\n \"voice_realtime.synthesize_narration\",\n \"mesh_pipeline.from_image\",\n \"content_store.write\",\n ],\n },\n media: { image, video, audio, voice, mesh },\n ...(!localOk\n ? {\n suggestion:\n \"Run the individual media doctor commands and configure missing local or remote providers.\",\n }\n : {}),\n };\n }\n\n async close(): Promise<void> {\n await this.#contentStore.close();\n }\n\n async #debug(entry: Record<string, unknown>): Promise<void> {\n await mkdir(dirname(join(this.#debugRoot, \".nebutra\", \"debug\", \"brand-genesis.jsonl\")), {\n recursive: true,\n });\n await appendCapabilityDebug(\"brand-genesis\", entry, { root: this.#debugRoot });\n }\n}\n\nexport async function readBrandGenesisDebug(root = process.cwd(), limit = 20): Promise<unknown[]> {\n return readCapabilityDebug(\"brand-genesis\", { root, limit });\n}\n"],"mappings":";AAAA,SAAS,aAAa;AACtB,SAAS,SAAS,YAAY;AAC9B,SAAyB,oBAAoB;AAC7C,SAA0B,qBAAqB;AAC/C,SAAS,+BAA+B;AACxC,SAAS,uBAAuB,2BAA2B;AAC3D,SAAS,cAAc,mCAAmC;AAC1D,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,OAIK;AACP,SAA0B,qBAAqB;AAC/C,SAA2C,qBAAqB;AAChE,SAA0B,qBAAqB;AAgF/C,IAAM,YAAY;AAClB,IAAM,cAAc;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,iBAAiB,MAAsB;AAC9C,SAAO,KACJ,MAAM,GAAG,GAAG,EACZ,YAAY,EACZ,QAAQ,qBAAqB,GAAG,EAChC,QAAQ,wBAAwB,EAAE,EAClC,MAAM,GAAG,EAAE;AAChB;AAEA,SAAS,SAAS,MAAsB;AACtC,QAAM,SAAS,KAAK,MAAM,yDAAyD;AACnF,MAAI,SAAS,CAAC,EAAG,QAAO,OAAO,CAAC,EAAE,KAAK;AACvC,QAAM,cAAc,CAAC,GAAG,KAAK,SAAS,2BAA2B,CAAC,EAC/D,IAAI,CAAC,UAAU,MAAM,CAAC,CAAC,EACvB,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,QAAQ,KAAK,EAAE,SAAS,KAAK,CAAC;AAC3D,SAAO,YAAY,GAAG,EAAE,KAAK;AAC/B;AAEA,SAAS,WAAW,MAA8D;AAChF,UAAQ,MAAM;AAAA,IACZ,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,QACL,EAAE,MAAM,iBAAiB,KAAK,WAAW,MAAM,UAAU;AAAA,QACzD,EAAE,MAAM,gBAAgB,KA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YAAY;AAAA,MAClC,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,gBAAgB;AAAA,UACd;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,MACA,OAAO,EAAE,OAAO,OAAO,OAAO,OAAO,KAAK;AAAA,MAC1C,GAAI,CAAC,UACD;AAAA,QACE,YACE;AAAA,MACJ,IACA,CAAC;AAAA,IACP;AAAA,EACF;AAAA,EAEA,MAAM,QAAuB;AAC3B,UAAM,KAAK,cAAc,MAAM;AAAA,EACjC;AAAA,EAEA,MAAM,OAAO,OAA+C;AAC1D,UAAM,MAAM,QAAQ,KAAK,KAAK,YAAY,YAAY,SAAS,qBAAqB,CAAC,GAAG;AAAA,MACtF,WAAW;AAAA,IACb,CAAC;AACD,UAAM,sBAAsB,iBAAiB,OAAO,EAAE,MAAM,KAAK,WAAW,CAAC;AAAA,EAC/E;AACF;AAEA,eAAsB,sBAAsB,OAAO,QAAQ,IAAI,GAAG,QAAQ,IAAwB;AAChG,SAAO,oBAAoB,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC7D;","names":[]}
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BrandGenesis,
3
3
  readBrandGenesisDebug
4
- } from "./chunk-SB4N3ZZW.js";
4
+ } from "./chunk-2UQ5N3IJ.js";
5
5
 
6
6
  // src/cli.ts
7
7
  import { mkdir, rm, stat } from "fs/promises";
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  distillBrandIdea,
5
5
  readBrandGenesisDebug,
6
6
  renderBrandMarkdown
7
- } from "./chunk-SB4N3ZZW.js";
7
+ } from "./chunk-2UQ5N3IJ.js";
8
8
  export {
9
9
  BrandGenesis,
10
10
  brandContextFromDraft,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nebutra/brand-genesis",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "BrandContext-first flagship play for creating a complete brand package from one idea",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -19,7 +19,7 @@
19
19
  "gaps": [
20
20
  "Generated media uses deterministic local fallbacks until model-backed providers are configured",
21
21
  "Storyboard editing is represented as an orchestration checkpoint, not yet a GUI step",
22
- "Landing page handoff is a manifest placeholder until landing-builder is implemented"
22
+ "Landing page handoff is minimal inside Brand Genesis; @nebutra/landing-builder owns the standalone site Play"
23
23
  ],
24
24
  "featureId": "brand-genesis",
25
25
  "category": "ai",
@@ -31,20 +31,20 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@nebutra/3d-pipeline": "0.1.0",
35
- "@nebutra/content-store": "0.1.0",
36
- "@nebutra/capability-kit": "0.2.0",
37
- "@nebutra/audio-pipeline": "0.1.0",
38
- "@nebutra/errors": "0.1.0",
39
- "@nebutra/event-log": "0.1.0",
40
- "@nebutra/generation-context": "0.1.0",
41
- "@nebutra/image-pipeline": "0.1.0",
42
- "@nebutra/play-loader": "0.1.0",
43
- "@nebutra/video-pipeline": "0.1.0",
44
- "@nebutra/voice-realtime": "0.1.0"
34
+ "@nebutra/audio-pipeline": "0.1.2",
35
+ "@nebutra/capability-kit": "0.2.2",
36
+ "@nebutra/content-store": "0.1.2",
37
+ "@nebutra/3d-pipeline": "0.1.2",
38
+ "@nebutra/errors": "0.1.2",
39
+ "@nebutra/generation-context": "0.1.2",
40
+ "@nebutra/event-log": "0.1.2",
41
+ "@nebutra/image-pipeline": "0.1.2",
42
+ "@nebutra/play-loader": "0.1.2",
43
+ "@nebutra/video-pipeline": "0.1.2",
44
+ "@nebutra/voice-realtime": "0.1.2"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/node": "^22.19.15",
47
+ "@types/node": "^25.9.1",
48
48
  "tsup": "^8.5.1",
49
49
  "tsx": "^4.21.0",
50
50
  "typescript": "^5.9.3",
@@ -37,7 +37,7 @@ required_skills:
37
37
  - mesh_pipeline.from_image
38
38
  - content_store.write
39
39
  required_plays:
40
- - landing_page_v1
40
+ - one_pager
41
41
  sub_agents:
42
42
  - role: brand_strategist
43
43
  allowed_skills: [llm_gateway.complete, content_store.write]
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@ import { mkdir } from "node:fs/promises";
2
2
  import { dirname, join } from "node:path";
3
3
  import { type MeshAsset, MeshPipeline } from "@nebutra/3d-pipeline";
4
4
  import { type AudioAsset, AudioPipeline } from "@nebutra/audio-pipeline";
5
+ import { requireCapabilityTenant } from "@nebutra/capability-kit";
5
6
  import { appendCapabilityDebug, readCapabilityDebug } from "@nebutra/capability-kit/debug";
6
7
  import { ContentStore, serializeContentFrontmatter } from "@nebutra/content-store";
7
8
  import { CapabilityError } from "@nebutra/errors";
@@ -103,22 +104,12 @@ const CHECKPOINTS = [
103
104
  "final_compose",
104
105
  ] as const;
105
106
 
106
- function requireTenant(explicit: string | undefined, fallback: string | undefined): string {
107
- const tenantId = explicit ?? fallback;
108
- if (!tenantId?.trim()) {
109
- throw new CapabilityError("brand-genesis", "Brand Genesis requires tenant context", {
110
- suggestion: "Pass tenantId on the input or construct BrandGenesis with tenantId.",
111
- statusCode: 400,
112
- });
113
- }
114
- return tenantId;
115
- }
116
-
117
107
  function normalizeBrandId(name: string): string {
118
108
  return name
109
+ .slice(0, 200)
119
110
  .toLowerCase()
120
- .replace(/[^a-z0-9]+/g, "_")
121
- .replace(/^_+|_+$/g, "")
111
+ .replace(/[^a-z0-9]{1,200}/g, "_")
112
+ .replace(/^_{1,200}|_{1,200}$/g, "")
122
113
  .slice(0, 32);
123
114
  }
124
115
 
@@ -339,7 +330,15 @@ export class BrandGenesis {
339
330
  }
340
331
 
341
332
  async run(input: BrandFilmInput): Promise<BrandPackage> {
342
- const tenantId = requireTenant(input.tenantId, this.#tenantId);
333
+ const tenantId = requireCapabilityTenant({
334
+ explicit: input.tenantId,
335
+ fallback: this.#tenantId,
336
+ onMissing: () =>
337
+ new CapabilityError("brand-genesis", "Brand Genesis requires tenant context", {
338
+ suggestion: "Pass tenantId on the input or construct BrandGenesis with tenantId.",
339
+ statusCode: 400,
340
+ }),
341
+ });
343
342
  const draft = distillBrandIdea(input);
344
343
  const brand = brandContextFromDraft(draft, tenantId);
345
344
  const brandMarkdown = renderBrandMarkdown(draft, brand);
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { mkdir } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport { type MeshAsset, MeshPipeline } from \"@nebutra/3d-pipeline\";\nimport { type AudioAsset, AudioPipeline } from \"@nebutra/audio-pipeline\";\nimport { appendCapabilityDebug, readCapabilityDebug } from \"@nebutra/capability-kit/debug\";\nimport { ContentStore, serializeContentFrontmatter } from \"@nebutra/content-store\";\nimport { CapabilityError } from \"@nebutra/errors\";\nimport { EventLog } from \"@nebutra/event-log\";\nimport {\n assetId,\n type BrandColor,\n type BrandContext,\n type VisualStyle,\n} from \"@nebutra/generation-context\";\nimport { type ImageAsset, ImagePipeline } from \"@nebutra/image-pipeline\";\nimport { type Storyboard, type VideoAsset, VideoPipeline } from \"@nebutra/video-pipeline\";\nimport { type VoiceAsset, VoiceRealtime } from \"@nebutra/voice-realtime\";\n\nexport type VisualDirectionHint =\n | \"cyberpunk\"\n | \"minimal\"\n | \"organic\"\n | \"playful\"\n | \"corporate\"\n | \"retro\"\n | \"futurist\";\n\nexport interface BrandFilmInput {\n readonly tenantId?: string;\n readonly idea: string;\n readonly founderVoiceId?: string;\n readonly visualDirectionHint?: VisualDirectionHint;\n}\n\nexport interface BrandIdentityDraft {\n readonly name: string;\n readonly oneLiner: string;\n readonly tagline: string;\n readonly targetAudience: string;\n readonly toneKeywords: readonly string[];\n readonly differentiation: string;\n readonly visualStyle: VisualStyle;\n}\n\nexport interface BrandPackage {\n readonly tenantId: string;\n readonly play: \"brand_film_60s\";\n readonly brand: BrandContext;\n readonly draft: BrandIdentityDraft;\n readonly brandMdPath: string;\n readonly palettePath: string;\n readonly landingPath: string;\n readonly logo: ImageAsset;\n readonly hero: ImageAsset;\n readonly icon: ImageAsset;\n readonly mesh: MeshAsset;\n readonly storyboard: Storyboard;\n readonly film: VideoAsset;\n readonly bgm: AudioAsset;\n readonly narration: VoiceAsset;\n readonly eventId: string;\n readonly checkpoints: readonly string[];\n}\n\nexport interface BrandGenesisDoctorReport {\n readonly capability: \"brand-genesis\";\n readonly ok: boolean;\n readonly checkedAt: string;\n readonly play: {\n readonly ok: boolean;\n readonly name: \"brand_film_60s\";\n readonly requiredSkills: readonly string[];\n };\n readonly media: {\n readonly image: readonly unknown[];\n readonly video: readonly unknown[];\n readonly audio: readonly unknown[];\n readonly voice: readonly unknown[];\n readonly mesh: readonly unknown[];\n };\n readonly suggestion?: string;\n}\n\nexport interface BrandGenesisOptions {\n readonly tenantId?: string;\n readonly root?: string;\n readonly debugRoot?: string;\n readonly contentStore?: ContentStore;\n readonly eventLog?: EventLog;\n readonly imagePipeline?: ImagePipeline;\n readonly videoPipeline?: VideoPipeline;\n readonly audioPipeline?: AudioPipeline;\n readonly voiceRealtime?: VoiceRealtime;\n readonly meshPipeline?: MeshPipeline;\n}\n\nconst PLAY_NAME = \"brand_film_60s\" as const;\nconst CHECKPOINTS = [\n \"brand_distillation\",\n \"visual_direction\",\n \"assets_generated\",\n \"video_rendered\",\n \"final_compose\",\n] as const;\n\nfunction requireTenant(explicit: string | undefined, fallback: string | undefined): string {\n const tenantId = explicit ?? fallback;\n if (!tenantId?.trim()) {\n throw new CapabilityError(\"brand-genesis\", \"Brand Genesis requires tenant context\", {\n suggestion: \"Pass tenantId on the input or construct BrandGenesis with tenantId.\",\n statusCode: 400,\n });\n }\n return tenantId;\n}\n\nfunction normalizeBrandId(name: string): string {\n return name\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"_\")\n .replace(/^_+|_+$/g, \"\")\n .slice(0, 32);\n}\n\nfunction pickName(idea: string): string {\n const called = idea.match(/\\bcalled\\s+([A-Z][a-zA-Z0-9]*(?:\\s+[A-Z][a-zA-Z0-9]*)?)/);\n if (called?.[1]) return called[1].trim();\n const capitalized = [...idea.matchAll(/\\b[A-Z][a-zA-Z0-9]{2,}\\b/g)]\n .map((match) => match[0])\n .filter((value) => ![\"AI\", \"SaaS\", \"API\"].includes(value));\n return capitalized.at(-1) ?? \"Venture\";\n}\n\nfunction paletteFor(hint: VisualDirectionHint | undefined): readonly BrandColor[] {\n switch (hint) {\n case \"cyberpunk\":\n case \"futurist\":\n return [\n { name: \"electric cyan\", hex: \"#00D4FF\", role: \"primary\" },\n { name: \"carbon black\", hex: \"#111318\", role: \"background\" },\n { name: \"signal amber\", hex: \"#F3C14B\", role: \"accent\" },\n ];\n case \"organic\":\n return [\n { name: \"moss\", hex: \"#3D7A57\", role: \"primary\" },\n { name: \"paper\", hex: \"#F7F4EA\", role: \"background\" },\n { name: \"clay\", hex: \"#C86B4A\", role: \"accent\" },\n ];\n case \"playful\":\n return [\n { name: \"coral\", hex: \"#FF6B6B\", role: \"primary\" },\n { name: \"ink\", hex: \"#202124\", role: \"neutral\" },\n { name: \"mint\", hex: \"#7CE2C6\", role: \"accent\" },\n ];\n case \"corporate\":\n return [\n { name: \"trust blue\", hex: \"#2454D6\", role: \"primary\" },\n { name: \"slate\", hex: \"#202A36\", role: \"neutral\" },\n { name: \"clear sky\", hex: \"#E8F0FF\", role: \"background\" },\n ];\n case \"retro\":\n return [\n { name: \"oxide\", hex: \"#B95F3B\", role: \"primary\" },\n { name: \"night ink\", hex: \"#18202A\", role: \"neutral\" },\n { name: \"cream light\", hex: \"#F8E7C9\", role: \"background\" },\n ];\n default:\n return [\n { name: \"graphite\", hex: \"#1F2933\", role: \"primary\" },\n { name: \"white\", hex: \"#FFFFFF\", role: \"background\" },\n { name: \"signal green\", hex: \"#00A693\", role: \"accent\" },\n ];\n }\n}\n\nfunction styleFor(hint: VisualDirectionHint | undefined): VisualStyle {\n const name = hint ?? \"minimal\";\n const keywordsByHint: Record<VisualDirectionHint, readonly string[]> = {\n cyberpunk: [\"electric\", \"terminal-native\", \"high-contrast\"],\n minimal: [\"calm\", \"precise\", \"spacious\"],\n organic: [\"warm\", \"natural\", \"human\"],\n playful: [\"bright\", \"friendly\", \"kinetic\"],\n corporate: [\"credible\", \"structured\", \"clear\"],\n retro: [\"nostalgic\", \"tactile\", \"characterful\"],\n futurist: [\"clean\", \"technical\", \"forward\"],\n };\n return {\n name,\n keywords: keywordsByHint[name],\n avoid: [\"generic stock\", \"dark horror\", \"visual clutter\"],\n };\n}\n\nexport function distillBrandIdea(input: BrandFilmInput): BrandIdentityDraft {\n const idea = input.idea.trim();\n if (idea.length === 0) {\n throw new CapabilityError(\"brand-genesis\", \"Brand idea is empty\", {\n suggestion: \"Pass a one-sentence company idea before running Brand Genesis.\",\n statusCode: 400,\n });\n }\n const name = pickName(idea);\n const devAudience = /\\bdev|debug|code|developer|engineering/i.test(idea);\n const audience = devAudience\n ? \"Independent developers and small engineering teams shipping software quickly\"\n : \"Early-stage founders validating a focused product wedge\";\n const toneKeywords = devAudience\n ? [\"technical\", \"direct\", \"warm\"]\n : [\"clear\", \"confident\", \"useful\"];\n return {\n name,\n oneLiner: idea,\n tagline: devAudience ? \"Debug like it is a conversation\" : `${name} turns intent into launch`,\n targetAudience: audience,\n toneKeywords,\n differentiation: devAudience\n ? \"Understands the full production context instead of treating each error as an isolated message\"\n : \"Combines brand, execution, and company memory in one repeatable workflow\",\n visualStyle: styleFor(input.visualDirectionHint),\n };\n}\n\nexport function brandContextFromDraft(\n draft: BrandIdentityDraft,\n tenantId: string,\n sourcePath = \"company/BRAND.md\",\n palette = paletteFor(draft.visualStyle.name as VisualDirectionHint),\n): BrandContext {\n return {\n tenantId,\n brandId: normalizeBrandId(draft.name),\n name: draft.name,\n palette,\n typography: {\n heading: draft.visualStyle.name === \"cyberpunk\" ? \"Geist Mono\" : \"Geist Sans\",\n body: \"Geist Sans\",\n accent: \"Geist Mono\",\n },\n visualStyle: draft.visualStyle,\n referenceImages: [],\n forbidden: draft.visualStyle.avoid ?? [],\n toneKeywords: draft.toneKeywords,\n sourcePath,\n };\n}\n\nexport function renderBrandMarkdown(draft: BrandIdentityDraft, brand: BrandContext): string {\n return serializeContentFrontmatter(\n {\n type: \"brand_profile\",\n brand_id: brand.brandId,\n name: brand.name,\n },\n [\n `# ${brand.name}`,\n \"\",\n draft.oneLiner,\n \"\",\n \"## Tagline\",\n \"\",\n draft.tagline,\n \"\",\n \"## Audience\",\n \"\",\n draft.targetAudience,\n \"\",\n \"## Tone\",\n \"\",\n brand.toneKeywords.join(\", \"),\n \"\",\n \"## Visual Direction\",\n \"\",\n `${brand.visualStyle.name}: ${brand.visualStyle.keywords.join(\", \")}`,\n \"\",\n \"## Differentiation\",\n \"\",\n draft.differentiation,\n \"\",\n ].join(\"\\n\"),\n );\n}\n\nfunction renderLandingManifest(draft: BrandIdentityDraft, brand: BrandContext): string {\n return [\n \"<!doctype html>\",\n '<html lang=\"en\">',\n \"<head>\",\n ' <meta charset=\"utf-8\" />',\n ` <title>${brand.name}</title>`,\n \"</head>\",\n \"<body>\",\n ` <main data-brand-id=\"${brand.brandId}\">`,\n ` <h1>${brand.name}</h1>`,\n ` <p>${draft.tagline}</p>`,\n ` <p>${draft.oneLiner}</p>`,\n \" </main>\",\n \"</body>\",\n \"</html>\",\n \"\",\n ].join(\"\\n\");\n}\n\nexport class BrandGenesis {\n readonly #tenantId: string | undefined;\n readonly #root: string;\n readonly #debugRoot: string;\n readonly #contentStore: ContentStore;\n readonly #eventLog: EventLog;\n readonly #image: ImagePipeline;\n readonly #video: VideoPipeline;\n readonly #audio: AudioPipeline;\n readonly #voice: VoiceRealtime;\n readonly #mesh: MeshPipeline;\n\n private constructor(\n options: BrandGenesisOptions & { contentStore: ContentStore; eventLog: EventLog },\n ) {\n this.#tenantId = options.tenantId;\n this.#root = options.root ?? join(process.cwd(), \".nebutra\", \"brand-genesis\");\n this.#debugRoot = options.debugRoot ?? process.cwd();\n this.#contentStore = options.contentStore;\n this.#eventLog = options.eventLog;\n this.#image = options.imagePipeline ?? new ImagePipeline({ root: this.#root });\n this.#video = options.videoPipeline ?? new VideoPipeline({ root: this.#root });\n this.#audio = options.audioPipeline ?? new AudioPipeline({ root: this.#root });\n this.#voice = options.voiceRealtime ?? new VoiceRealtime({ root: this.#root });\n this.#mesh = options.meshPipeline ?? new MeshPipeline({ root: this.#root });\n }\n\n static async open(\n root = \".nebutra/brand-genesis\",\n options: Omit<BrandGenesisOptions, \"root\" | \"contentStore\" | \"eventLog\"> = {},\n ): Promise<BrandGenesis> {\n const tenantId = options.tenantId ?? \"local\";\n await mkdir(root, { recursive: true });\n const contentStore = await ContentStore.open(join(root, \"content\"), { tenantId });\n const eventLog = await EventLog.open(join(root, \"event-log\"), { tenantId });\n return new BrandGenesis({ ...options, tenantId, root, contentStore, eventLog });\n }\n\n async run(input: BrandFilmInput): Promise<BrandPackage> {\n const tenantId = requireTenant(input.tenantId, this.#tenantId);\n const draft = distillBrandIdea(input);\n const brand = brandContextFromDraft(draft, tenantId);\n const brandMarkdown = renderBrandMarkdown(draft, brand);\n await this.#contentStore.write(brand.sourcePath, brandMarkdown);\n const palettePath = \"company/assets/palette.json\";\n await this.#contentStore.write(\n palettePath,\n `${JSON.stringify({ brandId: brand.brandId, colors: brand.palette }, null, 2)}\\n`,\n );\n await this.#debug({\n type: \"checkpoint\",\n step: CHECKPOINTS[0],\n tenantId,\n brandId: brand.brandId,\n });\n await this.#debug({\n type: \"checkpoint\",\n step: CHECKPOINTS[1],\n tenantId,\n brandId: brand.brandId,\n });\n\n const [logo, hero, icon] = await Promise.all([\n this.#image.generate({ type: \"logo\", company: brand.name, oneLiner: draft.oneLiner }, brand),\n this.#image.generate({ type: \"hero\", headline: draft.tagline }, brand),\n this.#image.generate({ type: \"icon\", subject: brand.name }, brand),\n ]);\n const mesh = await this.#mesh.fromImage(logo, brand);\n await this.#debug({\n type: \"checkpoint\",\n step: CHECKPOINTS[2],\n tenantId,\n brandId: brand.brandId,\n });\n\n const storyboard = await this.#video.plan(\n { type: \"brand-film\", durationS: 60, theme: draft.tagline },\n brand,\n );\n const rendered = await this.#video.render(storyboard, brand);\n await this.#debug({\n type: \"checkpoint\",\n step: CHECKPOINTS[3],\n tenantId,\n brandId: brand.brandId,\n });\n\n const bgm = await this.#audio.generate(\n { type: \"bgm\", durationS: rendered.durationS, mood: brand.toneKeywords.join(\" \") },\n brand,\n true,\n );\n const narration = await this.#voice.synthesizeNarration(\n {\n script: `${draft.tagline}. ${draft.oneLiner}. ${draft.differentiation}.`,\n targetDurationS: Math.max(8, Math.min(20, rendered.durationS - 3)),\n ...(input.founderVoiceId !== undefined ? { voiceProfileId: input.founderVoiceId } : {}),\n },\n brand,\n );\n const film = await this.#video.compose({\n videoTrack: [rendered],\n audioTrack: [bgm],\n voiceTrack: [narration],\n captionTrack: [{ startS: 0, endS: narration.durationS, text: narration.transcript }],\n });\n const landingPath = \"company/landing/index.html\";\n await this.#contentStore.write(landingPath, renderLandingManifest(draft, brand));\n await this.#debug({\n type: \"checkpoint\",\n step: CHECKPOINTS[4],\n tenantId,\n brandId: brand.brandId,\n });\n\n const eventId = await this.#eventLog.commit({\n traceId: assetId(\"brand_genesis\", brand.brandId),\n kind: \"content_write\",\n affected: [\n brand.sourcePath,\n palettePath,\n landingPath,\n logo.path,\n hero.path,\n icon.path,\n film.path,\n ],\n parent: null,\n snapshot: {\n [brand.sourcePath]: brandMarkdown,\n [palettePath]: JSON.stringify({ brandId: brand.brandId, colors: brand.palette }, null, 2),\n [landingPath]: renderLandingManifest(draft, brand),\n },\n });\n\n const result: BrandPackage = {\n tenantId,\n play: PLAY_NAME,\n brand,\n draft,\n brandMdPath: brand.sourcePath,\n palettePath,\n landingPath,\n logo,\n hero,\n icon,\n mesh,\n storyboard,\n film,\n bgm,\n narration,\n eventId,\n checkpoints: CHECKPOINTS,\n };\n await this.#debug({ type: \"run\", tenantId, brandId: brand.brandId, eventId });\n return result;\n }\n\n async doctor(): Promise<BrandGenesisDoctorReport> {\n const [image, video, audio, rawVoice, mesh] = await Promise.all([\n this.#image.doctor(),\n this.#video.doctor(),\n this.#audio.doctor(),\n this.#voice.doctor(),\n this.#mesh.doctor(),\n ]);\n const voice = [{ provider: \"narration-local\", ok: true }, ...rawVoice];\n const localOk = [image, video, audio, voice, mesh].every((checks) =>\n checks.some((check) => Boolean((check as { ok?: boolean }).ok)),\n );\n return {\n capability: \"brand-genesis\",\n ok: localOk,\n checkedAt: new Date().toISOString(),\n play: {\n ok: true,\n name: PLAY_NAME,\n requiredSkills: [\n \"image_pipeline.generate\",\n \"video_pipeline.plan\",\n \"video_pipeline.render\",\n \"video_pipeline.compose\",\n \"audio_pipeline.generate\",\n \"voice_realtime.synthesize_narration\",\n \"mesh_pipeline.from_image\",\n \"content_store.write\",\n ],\n },\n media: { image, video, audio, voice, mesh },\n ...(!localOk\n ? {\n suggestion:\n \"Run the individual media doctor commands and configure missing local or remote providers.\",\n }\n : {}),\n };\n }\n\n async close(): Promise<void> {\n await this.#contentStore.close();\n }\n\n async #debug(entry: Record<string, unknown>): Promise<void> {\n await mkdir(dirname(join(this.#debugRoot, \".nebutra\", \"debug\", \"brand-genesis.jsonl\")), {\n recursive: true,\n });\n await appendCapabilityDebug(\"brand-genesis\", entry, { root: this.#debugRoot });\n }\n}\n\nexport async function readBrandGenesisDebug(root = process.cwd(), limit = 20): Promise<unknown[]> {\n return readCapabilityDebug(\"brand-genesis\", { root, limit });\n}\n"],"mappings":";AAAA,SAAS,aAAa;AACtB,SAAS,SAAS,YAAY;AAC9B,SAAyB,oBAAoB;AAC7C,SAA0B,qBAAqB;AAC/C,SAAS,uBAAuB,2BAA2B;AAC3D,SAAS,cAAc,mCAAmC;AAC1D,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,OAIK;AACP,SAA0B,qBAAqB;AAC/C,SAA2C,qBAAqB;AAChE,SAA0B,qBAAqB;AAgF/C,IAAM,YA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