@slatesvideo/shared 0.7.7 → 0.7.9
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 +3 -6
- package/dist/analytics/events.d.ts +1 -1
- package/dist/analytics/events.js +7 -0
- package/dist/auth.d.ts +2 -0
- package/dist/auth.js +5 -0
- package/dist/clients/cloud.d.ts +2 -0
- package/dist/clients/cloud.js +5 -1
- package/dist/clients/desktop.js +6 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.js +7 -3
- package/dist/manual/content.d.ts +1 -1
- package/dist/manual/content.js +1 -1
- package/dist/operations/index.d.ts +724 -173
- package/dist/operations/index.js +875 -65
- package/dist/operations/surface.d.ts +2 -2
- package/dist/operations/surface.js +26 -6
- package/dist/prompts/agent-doctrine.d.ts +12 -2
- package/dist/prompts/agent-doctrine.js +56 -28
- package/dist/prompts/banned-tokens.js +23 -13
- package/dist/prompts/brain.d.ts +29 -0
- package/dist/prompts/brain.js +72 -0
- package/dist/prompts/craft-cards.d.ts +15 -4
- package/dist/prompts/craft-cards.js +71 -9
- package/dist/prompts/generation-policy.d.ts +1 -1
- package/dist/prompts/guide-discovery.d.ts +6 -6
- package/dist/prompts/guide-retrieval.d.ts +7 -1
- package/dist/prompts/guide-retrieval.js +33 -5
- package/dist/prompts/partials.generated.js +1 -13
- package/dist/prompts/shot-grammar.d.ts +1 -1
- package/dist/prompts/shot-grammar.js +1 -1
- package/dist/skills/brain-check.d.ts +44 -0
- package/dist/skills/brain-check.js +174 -0
- package/dist/skills/content.d.ts +3 -0
- package/dist/skills/content.js +81 -44
- package/dist/skills/hyperframes-content.js +4 -4
- package/dist/skills/my-brain.d.ts +52 -0
- package/dist/skills/my-brain.js +218 -0
- package/dist/skills/served.d.ts +56 -0
- package/dist/skills/served.js +232 -0
- package/package.json +2 -4
- package/skills/hyperframes/NOTICE +19 -3
- package/skills/hyperframes/SLATES-MAPPING.md +1 -1
- package/skills/hyperframes/embedded-captions/CATALOG.md +3 -0
- package/skills/hyperframes/embedded-captions/SKILL.md +6 -6
- package/skills/hyperframes/embedded-captions/assets/fonts/char-widths.json +227 -1
- package/skills/hyperframes/embedded-captions/modes/standard/fonts/build-fonts-css.cjs +19 -2
- package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/archivo-latin-wdth-italic.woff2 +0 -0
- package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/archivo-latin-wdth-normal.woff2 +0 -0
- package/skills/hyperframes/embedded-captions/scripts/make-theme.cjs +438 -3
- package/skills/hyperframes/embedded-captions/scripts/make-theme.test.mjs +1 -0
- package/skills/hyperframes/embedded-captions/themes/README.md +26 -1
- package/skills/hyperframes/embedded-captions/themes/lesson.json +31 -0
- package/skills/slates-start-here.md +78 -0
- package/exports/slates-chatgpt-images/generated/SKILL.md +0 -113
- package/exports/slates-chatgpt-images/generated/slates-chatgpt-images.skill +0 -0
- package/exports/slates-prompt-builder/generated/SKILL.md +0 -71
- package/exports/slates-prompt-builder/generated/reference-character.md +0 -92
- package/exports/slates-prompt-builder/generated/reference-content-policy.md +0 -81
- package/exports/slates-prompt-builder/generated/reference-gpt-image-2-5.md +0 -191
- package/exports/slates-prompt-builder/generated/reference-kling.md +0 -295
- package/exports/slates-prompt-builder/generated/reference-nano-banana.md +0 -240
- package/exports/slates-prompt-builder/generated/reference-omni-flash.md +0 -97
- package/exports/slates-prompt-builder/generated/reference-seedance-2-5.md +0 -392
- package/exports/slates-prompt-builder/generated/reference-seedance.md +0 -441
- package/exports/slates-prompt-builder/generated/slates-prompt-builder-manifest.json +0 -133
- package/exports/slates-prompt-builder/generated/slates-prompt-builder.skill +0 -0
- package/skills/_partials/blender-action-curves.md +0 -24
- package/skills/_partials/cinematic-card.md +0 -8
- package/skills/_partials/decision-log.md +0 -1
- package/skills/_partials/image-defaults.md +0 -9
- package/skills/_partials/iteration-diagnosis.md +0 -5
- package/skills/_partials/living-performance.md +0 -22
- package/skills/_partials/model-routing.md +0 -35
- package/skills/_partials/references-read-literally.md +0 -11
- package/skills/_partials/seedance-25-timestamps.md +0 -34
- package/skills/_partials/sheet-tool-defaults.md +0 -6
- package/skills/_partials/still-gate.md +0 -3
- package/skills/_partials/thresholds.md +0 -19
- package/skills/slates-blocking-to-prompt.md +0 -279
- package/skills/slates-camera-language.md +0 -234
- package/skills/slates-captions.md +0 -81
- package/skills/slates-character-identity.md +0 -117
- package/skills/slates-chatgpt-images.md +0 -113
- package/skills/slates-cinematic-look.md +0 -237
- package/skills/slates-content-policy.md +0 -88
- package/skills/slates-cost-discipline.md +0 -150
- package/skills/slates-cuts.md +0 -46
- package/skills/slates-dialogue-blocking.md +0 -134
- package/skills/slates-direct-response-ad.md +0 -26
- package/skills/slates-edit-and-iterate.md +0 -76
- package/skills/slates-layer-brand-captions.md +0 -87
- package/skills/slates-layer-lower-third.md +0 -85
- package/skills/slates-layer-title.md +0 -82
- package/skills/slates-model-selection.md +0 -129
- package/skills/slates-motion.md +0 -57
- package/skills/slates-one-prompt-film.md +0 -38
- package/skills/slates-previs-blocking.md +0 -186
- package/skills/slates-project-organization.md +0 -42
- package/skills/slates-prompting-elevenlabs.md +0 -128
- package/skills/slates-prompting-flux-3.md +0 -157
- package/skills/slates-prompting-gpt-image-2-5.md +0 -196
- package/skills/slates-prompting-inworld-tts.md +0 -174
- package/skills/slates-prompting-kling-v3.md +0 -303
- package/skills/slates-prompting-lip-sync.md +0 -216
- package/skills/slates-prompting-ltx-2-5.md +0 -245
- package/skills/slates-prompting-minimax-h3.md +0 -383
- package/skills/slates-prompting-motion-transfer.md +0 -202
- package/skills/slates-prompting-nano-banana-2-1.md +0 -250
- package/skills/slates-prompting-omni-flash.md +0 -117
- package/skills/slates-prompting-seed-audio.md +0 -168
- package/skills/slates-prompting-seedance-2-5.md +0 -420
- package/skills/slates-prompting-seedance.md +0 -462
- package/skills/slates-prompting-seedream-5-lite.md +0 -122
- package/skills/slates-prompting-wan-3.md +0 -143
- package/skills/slates-restyle-from-blocking.md +0 -121
- package/skills/slates-script-craft.md +0 -45
- package/skills/slates-shot-variety.md +0 -24
- package/skills/slates-storyboard-from-script.md +0 -32
- package/skills/slates-style-prompting.md +0 -56
- package/skills/slates-transitions.md +0 -40
- package/skills/slates-ugc-influencer-ad.md +0 -32
- package/skills/slates-vision-feedback-loop.md +0 -118
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { craftCardOf } from './craft-cards.js';
|
|
2
|
+
import { BRAIN_ROUTER, OVERLAY_LEAD, OVERLAY_SHARED_LEAD, PLAYBOOKS, operativeSummary, splitOverlay } from './brain.js';
|
|
2
3
|
/** Parse headings outside code fences; maintainer comments never reach agents. */
|
|
3
4
|
export function guideSections(content) {
|
|
4
5
|
const clean = content.replace(/<!--[\s\S]*?-->/g, '').trimStart().replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, '').trim();
|
|
@@ -20,12 +21,39 @@ export function guideSections(content) {
|
|
|
20
21
|
sections.push(current);
|
|
21
22
|
return sections;
|
|
22
23
|
}
|
|
24
|
+
/** What a file leads with: a model guide's craft card, else its operative summary, else the top of its first section. */
|
|
25
|
+
function leadOf(skill, content) {
|
|
26
|
+
return craftCardOf(skill, content) ?? operativeSummary(content) ?? guideSections(content)[0]?.body.trim().slice(0, 1600) ?? 'No overview available.';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The depth a request is served at. The router, the index of the brain, and every playbook, whose steps the
|
|
30
|
+
* Director card says to follow (a summary of steps is not the steps), are served whole at the default depth;
|
|
31
|
+
* rules and model guides stay at their card.
|
|
32
|
+
*/
|
|
33
|
+
export function servedDepth(skill, depth, query) {
|
|
34
|
+
return (skill === BRAIN_ROUTER || PLAYBOOKS.has(skill)) && depth === 'card' && !query?.trim() ? 'full' : depth;
|
|
35
|
+
}
|
|
23
36
|
/** Bounded retrieval. A missing card never silently expands to the full guide. */
|
|
24
|
-
export function retrieveGuide(skill, content,
|
|
37
|
+
export function retrieveGuide(skill, content, requested, query) {
|
|
38
|
+
const depth = servedDepth(skill, requested, query);
|
|
39
|
+
const overlay = splitOverlay(content);
|
|
40
|
+
if (overlay) {
|
|
41
|
+
// Their file over a shared guide: their summary or card, then the shared one; a deeper read takes both bodies.
|
|
42
|
+
if (depth === 'full')
|
|
43
|
+
return retrieveOne(skill, content, depth);
|
|
44
|
+
if (depth === 'index' || query?.trim())
|
|
45
|
+
return `${OVERLAY_LEAD}\n\n${retrieveOne(skill, content, depth, query)}`;
|
|
46
|
+
const index = guideSections(content).map((s) => `- ${s.title}`).join('\n');
|
|
47
|
+
return `${OVERLAY_LEAD}\n\n${leadOf(skill, overlay.theirs)}\n\n${OVERLAY_SHARED_LEAD}\n\n${leadOf(skill, overlay.shared)}\n\nSections (request with query, or depth "full"):\n${index}`;
|
|
48
|
+
}
|
|
49
|
+
return retrieveOne(skill, content, depth, query);
|
|
50
|
+
}
|
|
51
|
+
function retrieveOne(skill, content, depth, query) {
|
|
25
52
|
const sections = guideSections(content);
|
|
26
53
|
const index = sections.map((s) => `- ${s.title}`).join('\n');
|
|
54
|
+
// Stripped maintainer comments leave runs of blank lines behind.
|
|
27
55
|
if (depth === 'full')
|
|
28
|
-
return sections.map((s) => s.body.trim()).join('\n\n');
|
|
56
|
+
return sections.map((s) => s.body.trim()).join('\n\n').replace(/\n{3,}/g, '\n\n');
|
|
29
57
|
if (depth === 'index')
|
|
30
58
|
return index;
|
|
31
59
|
if (query?.trim()) {
|
|
@@ -47,7 +75,7 @@ export function retrieveGuide(skill, content, depth, query) {
|
|
|
47
75
|
// Never cut a table row or a worked prompt mid-sentence.
|
|
48
76
|
return `Section "${ranked[0].s.title}" is too large for a selective response. Use a technique ID or depth "full".\n${index}`;
|
|
49
77
|
}
|
|
50
|
-
|
|
51
|
-
return `${
|
|
78
|
+
// A model guide's summary is its craft card; every other file leads with an operative summary.
|
|
79
|
+
return `${leadOf(skill, content)}\n\nSections (request with query, or depth "full"):\n${index}`;
|
|
52
80
|
}
|
|
53
81
|
//# sourceMappingURL=guide-retrieval.js.map
|
|
@@ -1,28 +1,16 @@
|
|
|
1
|
-
// GENERATED — do not edit. Source: packages/shared/skills/_partials/*.md
|
|
1
|
+
// GENERATED — do not edit. Source: packages/shared/skills/_partials/*.md, the public partials
|
|
2
2
|
// Regenerated by scripts/sync-partials.mjs on every build.
|
|
3
3
|
//
|
|
4
4
|
// This is the SAME text injected between the @inject markers in the
|
|
5
5
|
// per-model skills, so the TS consumers and the markdown consumers can
|
|
6
6
|
// no longer disagree. Edit the partial, not this file, not the skills.
|
|
7
7
|
export const PARTIALS = {
|
|
8
|
-
"blender-action-curves": "## Read animation curves from the active action layout\n\nBlender 5 uses layered actions: curves belong to the channelbag for `animation_data.action_slot`, inside each layer's strips. A direct `action.fcurves` lookup failed on Blender 5.2.1 in the 2026-08-28 blocking run. Feature-detect the layout before changing interpolation or noise; an unanimated object can legitimately have no curves.\n\nThe snippets below use this small Blender-side iterator. It runs inside Blender; no add-on code is imported into the MCP package.\n\n```python\ndef action_curves(datablock):\n anim = getattr(datablock, \"animation_data\", None)\n action = getattr(anim, \"action\", None)\n if action is None:\n return\n if hasattr(action, \"fcurves\"):\n yield from action.fcurves\n elif getattr(anim, \"action_slot\", None) is not None:\n for layer in action.layers:\n for strip in layer.strips:\n if hasattr(strip, \"channelbag\"):\n bag = strip.channelbag(anim.action_slot)\n if bag is not None:\n yield from bag.fcurves\n```\n\nUse the datablock that owns the keyed property: the curve data for `eval_time`, the object for location and rotation, the camera data for lens. Confirm a named channel exists before assuming a keyframe operation created it.",
|
|
9
|
-
"cinematic-card": "**For a photographic look, use only what this frame needs.** Image models default to clean, evenly lit and fully exposed. Describe what the camera sees, not just gear or mood:\n- **Inspect every reference first.** Write its grade and imperfections in words: darkness, contrast, muddy or true blacks, colour, softness/noise, subject separation. Never grade cleaner or brighter than the look reference unless asked.\n- **One light system** — `low sun behind her`, `her face falls into deep shadow`, `no light in front of her`.\n- **Visible exposure** — `the sky burns out to white`, `dense, slightly crushed shadows`.\n- **Lens name plus effect** — `200mm telephoto`, `peaks loom huge behind her and melt into soft shapes`.\n- **Name every garment and close the foreground.** Omissions invite reference leakage or invented props.\nBind references inline. A scene reference owns the grade; for a look-only reference, write the new scene's light. References are optional. For owned-frame edits, describe only the change and what stays.\n<!-- slates-only -->Use `slates-cinematic-look` with a technique ID or section query for more.<!-- /slates-only -->",
|
|
10
8
|
"cinematic-routes-short": "Two routes: describe a new frame, or change a frame you own. For a new scene, name references where you use them, write the look reference's grade and imperfections in plain words, then describe one light system, visible exposure, lens plus effect, every garment and a closed foreground. Use only what the shot needs. For your own plate, sheet, photo, footage or Blender render, say only what changes and what stays. Never use a released film frame as the edit base; use it as an art-direction brief for a new scene.",
|
|
11
9
|
"cinematic-tips-short": "Image models tend toward clean, evenly lit, fully exposed pictures. For a filmed look, describe what you see: one light source and its effect, a face almost in silhouette, a sky burned white. Name the lens and its visible effect together. Look at every reference first and describe its own darkness, contrast, colour, softness, noise and subject separation. Keep muddy blacks muddy; never clean up or brighten the reference's grade unless that is the change you want. Name every garment and exactly what is in the foreground. Use only what the shot needs; references are optional.",
|
|
12
|
-
"decision-log": "Record production choices in the editable shot fields. Explain only consequential judgments the user did not specify and no field already records: for example, why a particular light or performance register supports the brief. Do not repeat the shot list in prose or turn this explanation into an approval gate. Follow the separate generation authorization policy before spending.",
|
|
13
|
-
"image-defaults": "**Image default:** gpt-image-2-5-sunburst, quality `high`, 3k. User overrides take priority. Without a project, generation uses the headless Nano Banana 2.1 seat. When to reroll a frame on Nano Banana 2.1 instead: `slates-cinematic-look` § Model notes.\n\n| Model | Default resolution |\n|---|---|\n| nano-banana-2-1 | 2k |\n| gpt-image-2-5-flare | 2k |\n| gpt-image-2-5-sunburst | 3k |\n| flux-3 | 1k |\n| seedream-5-lite | 2k |",
|
|
14
|
-
"iteration-diagnosis": "## Diagnose repeated failures\n\nAfter three failed attempts at the same requirement, pause unchanged re-rolls and diagnose the source reference, prompt structure, model fit and tool result. Three is a review checkpoint, not a universal limit or proof that the seed cannot matter. Preserve the attempts and name what each test changed.\n\nContinue autonomously when the brief is clear, a specific correction is supported and the next request is already authorized. Hand control back when taste or intent cannot be inferred, the next request needs fresh consent, or the available tool cannot meet the requirement. A failed roll never authorizes an additional charge. Follow the existing batch and per-request cost policy.",
|
|
15
10
|
"lens-video-split": "Named lenses, apertures, film stocks and camera bodies (`85mm f/1.4`, `Kodak Portra 400`, `ARRI Alexa 65`) are an image-model lever. On a video model, translate the look instead of pasting the gear list: `85mm f/1.4, Portra 400` becomes `close-up, shallow depth of field, warm natural colors, cinematic texture, film-grain texture`. ByteDance's Seedance 2.0 guide never mentions fps, shutter angle, f-stop or lens millimetres. Its Seedance 2.5 guide does, once: the visual-style line of its own storyboard example names one camera body and one 35 mm cinema lens. On 2.5 a single line like that is vendor-sanctioned; a stacked gear list still is not.",
|
|
16
|
-
"living-performance": "**Nobody holds still. Write every person a performance that changes on every beat.** A video model\nanimates what the prompt describes and nothing more. Describe one expression (\"she screams, mouth\nopen\") and the person freezes in it for the whole take, which reads as dead and fake however good the\ncamera is.\n\n- **Every person, every beat:** what their hands do, where their head and body go, what they say or\n shout and to whom, and how the expression shifts, then shifts again. \"Yelling at him with both hands\n up, then grabs the dash as the car snaps sideways\" moves; \"terrified\" is a still.\n- **Escalate and turn.** A scene's emotion travels: fear into fury into a stunned laugh. Each beat\n gives the next state, never a repeat of the last.\n- **One calm character may stay still in the face, never in the body.** The stoic one still blinks,\n breathes, glances, and works their hands, and reacts once the scene earns it (a smirk, a look across).\n A held beat before a spoken line is the same: the face settles, the body keeps small movement.\n- **Keep it physical.** Write the visible action, not the feeling: a jabbed finger, a slap on the\n shoulder, a hand clawing hair out of a mouth. Name the lines or shouts when the audio matters.\n- **A blocking or previs reference makes stillness worse.** Its stand-in figures are frozen\n mannequins, and the model copies their stillness unless the prompt says so. Say it in the prompt:\n \"its figures are frozen stand-ins and their stillness is not the acting; take only the camera and\n the timing from video 1, and the people perform as written below, moving in every second.\"\n- **On a model that reads timestamps (Seedance 2.5), write the acting inside every interval,** beside\n the camera and the action, so no range leaves a person without something to do. On a model that\n reads shots instead, give every shot its own acting the same way.",
|
|
17
11
|
"living-performance-short": "A video model animates only what you describe: one held expression (\"she screams\") freezes the person in it for the whole take. Give every person a changing performance on every beat: hands, head, body, what they shout and to whom, and the expression shifting again. One calm character may keep a still face, but still blinks, breathes and works their hands. A blocking clip's stand-in figures are frozen, so say in the prompt that their stillness is not the acting.",
|
|
18
|
-
"model-routing": "**Current model routing, generated from the operation routing source:**\n\n### image generate\n\nNano Banana 2.1: The all-rounder and the only image seat with a headless path: holds many subjects coherently in one frame, keeps what an edit leaves alone, and is the start-frame for legible in-scene text. It reasons before it draws, so dense compositions and hero frames land without a premium tier.\nGPT Image 2.5 Flare: THE FAST GPT IMAGE SEAT — OpenAI's small model, optimized for SPEED, quality COMPARABLE to GPT Image 2 (not better) at roughly half the latency. Route here when speed matters: drafts, exploration, volume. TEXT / DIAGRAM / PANEL work — character sheets, shot grids, text-bearing panels. When quality outranks speed, escalate to Sunburst. Own content filter, distinct from Gemini's. Killed by a head-to-head at the intended crop going the other way.\nGPT Image 2.5 Sunburst: THE QUALITY GPT IMAGE SEAT — OpenAI's most capable image model, higher quality than GPT Image 2, same price as Flare, deliberately SLOWER. Route here unless speed is the point: finals, hero frames, photoreal people, and multi-reference edits where every reference must survive into one frame — its widest lead. Explore on Flare, finish on Sunburst.\nFLUX 3 Image: The premium less-filtered image seat: photoreal frames, precise layout and in-image text, at its loosest safety setting, which can still reject a prompt. Auto-routes to its edit endpoint when references are present.\nSeedream 5 Lite: Cheapest flat-priced image seat (GPT Image 2.5 at low quality costs less per image). Less filtered, though it can still reject a prompt. Routes to its edit endpoint when references are present.\n\n### video generate\n\nSeedance 2.0: THE 4K AND VALUE SEAT beside the 2.5 default — the only Seedance with native 4K (Pro-gated; base accounts get PRO_REQUIRED) and cheaper than 2.5 at every resolution they share, with the same physics, effects and scale strengths; shorter takes, fewer references, no timestamps. VIDEO-ONLY. A bare \"seedance\" still resolves here for older CLIs that expect 4K.\nSeedance 2.5: DEFAULT VIDEO MODEL — the strongest seat for physics, effects, scale and hero shots, and the only Seedance that takes long single takes, many references, audio-only references and integer-second timestamps. No 4K, and dearer than 2.0 at every shared resolution: go to 2.0 for 4K or the same resolution cheaper. LENGTH is the price dial — quote long takes first. VIDEO-ONLY. Timestamp grammar and the edit/extend words that make the provider reclassify and fail a generation are in slates-prompting-seedance-2-5.\nKling 3.0: THE COST-EFFECTIVE SEAT — strong start-frame adherence (identity, layout, text), acting, dialogue and lip-sync; pick it when the budget matters and the shot is a performance or a start-frame animation. Kling is also the ONLY engine behind the Motion Transfer and Lip Sync tools.\nKling 4.0: The newest Kling, for single takes longer than Kling 3.0 reaches. Dearer per second and slower than 3.0, and on the same start frame 3.0 Pro won on camera and feel, so Kling 3.0 stays the Kling seat for everything else. Sound is always on at no extra cost. Start frame with an optional last frame, multi-shot sequences, or text alone; no reference images. VIDEO-ONLY.\nGemini Omni Flash 1.1: Google's video model, version 1.1 since 2026-10-17, with native synced audio in the same pass; 1080p and 4K are upscales of its 720p render. Takes a start frame with an optional last frame, or reference images plus short reference videos that carry a likeness (their audio is ignored), with no audio references. It cuts between shots by default, so ask for a single shot. Route here for cheap takes with sound and reference-driven character consistency; LTX, H3 and H3 Max Turbo cost less per second. VIDEO-ONLY. Hero-shot quality against Seedance is not yet measured.\nMiniMax H3: THE AUTHORED-AUDIO SEAT — reach for H3 when the sound is part of the shot rather than a switch on it: synchronised dialogue, scene sound and an audience-only score directed as three separate layers in ONE pass, across eleven languages. Kling and Seedance treat audio as on/off. Only H3 also carries a DECLARED REFERENCE RELATIONSHIP (kept whole, partly kept, transferred, or a loose echo). VIDEO-ONLY. Its top two resolution tiers are UPSCALES of the native render, not larger generations — judge at native and upscale in post. Reference images past the fifth are a PAID key dimension: pass referenceImages when quoting.\nMiniMax H3 Max: THE SPEED SEAT, dearer than base H3 at 768p and equal at 480p — never the cheap H3 and never the default. A post-train of the H3 weights: MEASURED 2026-08-27 at about 12x faster than base H3 on the same prompt and params, queue to finished file, plus a thin vendor-reported quality edge. It tops out at a 1080p refinement of its 768p render. It takes the same omni-reference set as base H3 and animates start and end frames — but not both in one call, the same as base H3: frames and references go to different endpoints. Never describe this row as taking no image or reference input. Route here when a fast turnaround on text-to-video or a start-frame shot is worth the premium.\nMiniMax H3 Max Turbo: THE BUDGET SEAT of the MiniMax family: a second post-train of the H3 weights, billed at half H3 Max's rate at every tier. Its 1080p is a refinement of the native 768p render, not a native 1080p generation. INPUTS ARE FRAMES, NOT REFERENCES: text-to-video and start/end frames only, with no reference endpoint, so reference-driven consistency goes to H3 Max or base H3. Route here for drafts, volume and cheap coverage, then re-run the keeper on H3 Max or a hero seat.\nWan 3.0: Alibaba's video model, added 2026-10-17: first on Artificial Analysis text-to-video that day, at about a third of Seedance 2.5's price per second at 1080p. Long single takes, multi-shot sequences with timestamps, sound on or off. Start frame with an optional last frame, or references across images, videos and audio cited as Image N / Video N / Audio N (audio-only allowed); frames and references never mix. Reference video seconds bill on top of the output. Route here for long takes, timed multi-shot scenes and reference-driven shots on a budget; Seedance 2.5 stays the default. VIDEO-ONLY.\nLTX-2.5: THE VOLUME SEAT — the cheapest native 1080p second with sound included (H3 Max Turbo's 1080p is refined from 768p), and the row for MANY takes rather than one hero shot. Native synced audio is included free at every tier, unlike Kling where sound is a paid key dimension. It reaches higher resolutions and longer takes than most seats; use the capability surface for its resolution-dependent duration limits. VIDEO-ONLY. INPUTS ARE FRAMES, NOT REFERENCES: start frame plus an optional end frame, and no reference endpoint at all — for character consistency across shots use H3 or Kling. Route here for batch coverage, long takes, and anything where the credit budget is the binding constraint.\nLTX-2.5 Pro: THE FIDELITY SEAT of the LTX pair — the full diffusion build against the base row's distilled one. 🚨 IT IS NOT A SUPERSET OF THE BASE ROW, which is the opposite of every other Pro seat here: it reaches a SHORTER resolution ladder and makes SHORTER clips, and it costs more at both tiers they share. Reaching for it because the name says Pro costs more AND takes away reach. Everything else matches the base row. Route here only when a specific shot needs the fidelity and fits inside its narrower envelope.\n\n### video edit\n\nSeedance 2.5 Edit: VIDEO-TO-VIDEO EDIT via slates_edit_video, and the only edit engine that takes a clip longer than the other two reach — that length is the whole reason to route here. Inside their range, compare on fidelity instead: Omni Flash edit won the prompt-only head-to-head, and Kling edit is the one that takes reference images. Edits audio on the same row (re-voice, re-accent, translate with re-fitted lips, replace BGM). Costs about 1.2x a plain 2.5 generation of the same length: an edit bills at twice the reduced video-reference rate.\nKling O3 Video Edit: VIDEO-TO-VIDEO EDIT, the REF-DRIVEN one: it is the only edit seat that takes element/style reference images to lock subject identity, and its keepAudio preserves the original audio verbatim. Route here when an edit NEEDS reference images or bit-exact audio; for prompt-only footage-synced VFX, omni-flash-edit won the fidelity head-to-head. One instruction beat per pass — multi-beat prompts get under-executed.\nOmni Flash 1.1 Edit: VIDEO-TO-VIDEO EDIT, prompt-only, on Omni Flash 1.1 since 2026-10-17. The 1.0 edit won the head-to-head against Kling edit on real talking footage (lips held, audio near-identical, both action beats landed); 1.1 has not been re-measured against it yet. Footage-synced prop, effect, environment and lighting swaps; 1080p and 4K output are upscales. Takes NO reference images — identity swaps needing refs go to Kling edit. Fidelity is EARNED by prompt discipline; the exact form is in slates-prompting-omni-flash.\n\n### audio generate\n\nSeed Audio 1.0: DEFAULT audio model — the one-pass SCENE workhorse: dialogue, SFX and ambience together from ONE plain sentence. Route here for continuity beds, room tone, crowd and nature soundscapes, and quick scratch VO. AUDIO-ONLY. Takes one image XOR up to three audio clips as references, never both. Prompt form and the length rule are in slates-prompting-seed-audio.\nElevenLabs Sound Effects v2: ONE-SHOT SOUND EFFECT with an EXACT duration — route here for a single hit that must land on a frame (door slam, whoosh, impact, UI blip) or for a seamless loop. AUDIO-ONLY. For layered scenes with dialogue or room tone, seed-audio does it in one pass instead.\nInworld Realtime TTS-2: THE VOICE SEAT — one named voice saying one line, billed per CHARACTER not per second. Route here when WHO is speaking matters. NOT scene audio — that is seed-audio; a single effect is eleven-sfx.",
|
|
19
12
|
"reference-rules-core": "Identity = a few flat-lit neutral angles; one reference per role, named inline; 2-4 refs not 12; describe environments instead of feeding a grid.\n\n1. **2-4 strong references beat both extremes.** Not 1 (warps toward itself), not 12 (averages worse). Start with 2-3 focused refs — each one adds context AND another variable to balance.\n2. **One reference per ROLE, named in the prompt** — identity / style-grade / environment. The model does **not** infer a reference's role from its position in the list; the inline name carries it. Same-role competitors drift (two \"identity\" refs of different people blend into a third face). Slates resolves `@mentions` / `#tags` into numbered citations. You can also bind references directly in scene prose, naming what each image supplies.\n3. **One identity sheet per character, named inline.** A character's identity is a single asset (dominant portrait + body panels), so attach that one asset rather than a pile of views: **fewer competing renderings of a face is better, because the model cannot tell which one is authoritative and averages them.** Slates cites it as `Marcus (image 1)`. **Do NOT hand-write a \"Reference Image Instructions\" block or role essays** (\"use for identity, ignore the outfit, render a neutral expression\") — that drags the sheet's studio lighting and wardrobe into a scene that asked for neither. The prompt leads; the user's words own wardrobe, expression, lighting, and action.\n4. **Flat-light identity refs.** Prep identity references with flat, even, shadowless lighting on a plain neutral background. A studio-lit or scene-lit character sheet bleeds its lighting into every generation — the failure looks like the subject was green-screen-pasted in front of the location. Reference prep beats prompting here.\n5. **Environment: describe it, don't feed a grid.** Default to describing the location in words and let the model build a space that fits the shot. Reserve an environment reference for a mandatory exact-match, and then use ONE clean establishing image with natural ambient light that reads as the location's real light — never a multi-panel grid fed whole.\n6. **Grids: explore, don't input.** Use grids to explore compositions cheaply, then pick a cell. Never feed a grid back in as a reference — the cells share a split detail budget and were generated jointly, so their flaws propagate.\n7. **Reuse the same refs across every shot** in a sequence. Lock a set and keep it; swapping references mid-sequence causes drift, because the model adapts each reference to the current prompt rather than copying it.\n8. **Legible in-shot text → bake it into a still start frame, never trust text-to-video.** Have an image model render the text, then animate from that locked frame. Video models smear type.\n9. **Working from existing media — describe ONLY what changes.** The source already carries its composition, motion, timing, and performance; re-describing them fights the model. Narrate the delta. (Video lane: restyle your own clip while keeping the performance; delayed-VFX on \"video one\"; marker-object insertion; video-as-reference for a series.)\n10. **Style transforms happen in natural language.** By default the source's artistic medium and visual style are inherited. To change it, add a plain-text instruction (\"anime → real person\"). There are no preset pickers, and there is no style slider.",
|
|
20
13
|
"reference-tips-short": "Name each reference inline; never write role essays. Slates does this for you: `@mention` a subject or environment and it composes `Marcus (image 1) in the cafe (image 2)`, citing them in the exact order it sends them. One canonical identity image avoids competing facial renderings; a \"Reference Image Instructions\" block drags reference lighting into your scene. Start with 2-3 focused refs.",
|
|
21
|
-
"references-read-literally": "> **The general law: the model reads a reference literally.**\n> A reference image is not a suggestion. Whatever is baked into it — lighting, medium, texture, symmetry, competing identities — is read as a **property of the subject** and reproduced downstream. A baked rim light tints every shot made from that sheet. A sheet that looks like a 3D game render gets animated like game footage. Two competing renderings of one face get averaged into a third face.\n\nEvery reference rule below is a corollary of that one sentence, which is why \"prep the reference\" beats \"prompt around the reference\" every time:\n\n- **Flat, plain identity refs** — because scene lighting in the sheet becomes scene lighting in the output (Slates' own receipt: a studio-lit sheet produced a subject that looked green-screen-pasted in front of mountains).\n- **One authoritative rendering per subject** — because the model cannot tell which panel is the real one. ByteDance documents this failure directly: multi-view character assets \"confuse the model's character recognition, causing it to generate duplicate characters of the same appearance.\"\n- **No 3D-game-render look in a reference** — the model recognizes the render mood and inherits its motion character, so the *animation* comes out looking like game footage. This is not a taste rule; it is the same literal-reading mechanism applied to the temporal layer.\n- **Break perfect symmetry** — mirrored faces and dead-square framing read as synthetic, and the model preserves that reading rather than correcting it.\n\n**What this means in practice:** when output is wrong in a way that tracks the *subject* rather than the *scene* — the lighting is wrong the same way in every shot, the face drifts, the material looks synthetic everywhere — fix the reference, not the prompt. Prompting around a baked-in property is the expensive way to lose.",
|
|
22
|
-
"seedance-25-timestamps": "**2.0 does not respond to timestamps and answers only to shot numbers. 2.5 responds to\ninteger-second timestamps.** That is ByteDance's own first line under \"Differences from Seedance\n2.0\", and it is why a 30-second take is usable at all: the length is only worth buying if you can\nsay *when* things happen inside it.\n\nBoth formats are valid on 2.5, and you can mix them — `Shot N` blocks for a storyboard whose\npacing you are happy to leave to the model, timestamps when a beat has to land at a moment.\n\n**Three ways to control time, all first-party:**\n\n| Form | Write it like |\n|---|---|\n| **Interval** | `0-3 seconds… 3-7 seconds… 7-15 seconds` or `[1s-4s]… [4s-8s]… [8s-12s]` |\n| **Time point** | *\"Quick left sideways transition at the 5-second mark.\"* |\n| **Relative** | *\"After 3 seconds, everyone around him shakes their head.\"* · *\"The frame freezes for 1 second after he presses the shutter.\"* |\n\n**The rules that come with them:**\n\n- **One second is the smallest unit.** Integers only — no `2.5s`, no frames.\n- **No gaps in the timeline.** `0-3s… 5-6s…` leaves 3-5s unspecified and the model fills it however\n it likes. Intervals must abut: `0-3s`, `3-7s`, `7-15s`.\n- **Budget the plot to the seconds.** Too little content in a range and the model improvises to\n fill it; too much and you get extra cuts or dropped beats. This is the actual craft of a 30s take.\n- **Never time-code a high-frequency action.** *\"Shake your head three times per second\"* is\n explicitly called out as a misuse — timestamps schedule beats, they don't choreograph frames.\n- **Transitions want both halves:** the moment AND the method — *\"At the 5-second mark, the camera\n transitions leftward with a left wipe into a natural dissolve.\"*\n- **Timestamps work on an EDIT too**, and that is where they earn the most: they scope a change in\n time as well as in content — *\"Change the man's action from drinking coffee to mopping the floor\n from 4-6 seconds in Video 1, and leave the rest of the content unchanged.\"* Without a range, a\n whole-clip instruction is applied to the whole clip.\n\nDo **not** carry this back to 2.0, and do not write `[00:00-00:02]` minute-second brackets (another\nvendor's syntax) into either — 2.0 ignores time entirely, and the cross-model syntax swap is its own known failure.",
|
|
23
14
|
"seedance-25-timestamps-short": "Seedance 2.0 ignores timing and answers only to \"Shot 1 / Shot 2\"; 2.5 acts on whole-second timestamps, and that is what makes a 30-second take controllable rather than just long. Three forms work: intervals (\"0-3 seconds…3-7 seconds\"), a point (\"at the 5-second mark\"), or relative (\"after 3 seconds\"). Whole seconds only, no gaps between intervals, and never to choreograph fast repeated motion. They work on edits too, where a range scopes the change: \"…from 4-6 seconds…\".",
|
|
24
|
-
"sheet-tool-defaults": "**What the sheet tools render on** (you do not pick these; omit `model`):\n\n- **Character identity sheet:** `gpt-image-2-5-sunburst` at 3k, quality `high`, one 16:9 image.\n- **Establishing image:** `gpt-image-2-5-sunburst` at 3k, quality `high`, one 16:9 image.\n\nPrice a sheet for that model at 16:9, with resolution and quality left at their defaults. **Never 4K** — no identity gain at sheet scale, wasted spend.",
|
|
25
|
-
"still-gate": "**Inspect a start frame before animating it.** Repair a visible defect that would make the intended crop or performance unusable before spending on motion. A clean frame can be animated whenever the brief calls for movement; this check does not require an image stage for text-to-video.\n\nThis is a cost rule as well as craft: a premium video call can cost many times an image correction. Broken geometry can turn to mush, oily textures can crawl and malformed objects can fall apart in motion. Fix a known source defect at the source instead of buying a more expensive copy. Judge intentional stylisation against the brief, not a universal photoreal standard. Additional image or video requests still follow the existing generation authorization.",
|
|
26
|
-
"thresholds": "<!-- GENERATED from @slatesvideo/shared — do not edit between the markers.\n Source: CONFIRM_CREDITS, DEVIATION_FACTOR and the audio bounds in\n packages/shared/src/operations/index.ts. Every number here is REFUSED by an\n op when a prompt gets it wrong, which is why none of them is typed by hand\n any more: this block replaced four claims that contradicted the code. -->\n\n**The thresholds, from the code that enforces them:**\n\n- **Confirm gate:** above **17 credits** an op returns `requires_confirm` and will not\n proceed until you re-call with `confirm: true`. This is a code gate, not permission to spend: every generation still needs the user-approved plan or quote.\n- **Deviation pause:** the desktop Slates Director stops and re-asks when projected generation spend\n exceeds the approved plan by more than **20%**. You do not trigger this; the app does.\n- **Seed Audio duration:** **3–120 seconds.** There is no duration\n parameter on the model — the number you pass is written into the prompt AND is what the user is\n billed. Outside that range the op refuses rather than clamping.\n- **Sound Effects duration:** **1–22 seconds**, billed per second, never left for the\n model to pick.\n\nNever quote a credit figure from memory: `slates_estimate_generation_cost` returns the real one.",
|
|
27
15
|
};
|
|
28
16
|
//# sourceMappingURL=partials.generated.js.map
|
|
@@ -142,7 +142,7 @@ export const SPEECH_RATE = {
|
|
|
142
142
|
* 250, not p90: those are rates real ads actually hit, and flagging an
|
|
143
143
|
* achievable read is exactly how a check gets ignored.
|
|
144
144
|
*/
|
|
145
|
-
ceiling: { wpm: 283, n:
|
|
145
|
+
ceiling: { wpm: 283, n: 71, segment: 'max over every marked row' },
|
|
146
146
|
};
|
|
147
147
|
/**
|
|
148
148
|
* The default register, and there is deliberately no picker for it.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** The parts of scripts/brain-shape.json the code reads. */
|
|
2
|
+
export interface BrainShape {
|
|
3
|
+
layers: Record<string, string[]>;
|
|
4
|
+
caps: {
|
|
5
|
+
fileWords: Record<string, number>;
|
|
6
|
+
layerWords: Record<string, number>;
|
|
7
|
+
mine: {
|
|
8
|
+
fileWords: number;
|
|
9
|
+
layerWords: number;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
duplicates: {
|
|
13
|
+
shingleWords: number;
|
|
14
|
+
failAt: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** Words an agent reads: frontmatter, comments and bare table or list punctuation left out. */
|
|
18
|
+
export declare function words(text: string): number;
|
|
19
|
+
/** The words a passage check compares: prose only, with injected partials, comments, frontmatter and code left out. */
|
|
20
|
+
export declare function passageWords(text: string): string[];
|
|
21
|
+
/** Per pair of files (`a + b`, sorted), how many runs of `n` words they share, with one as a sample. */
|
|
22
|
+
export declare function overlaps(skills: Readonly<Record<string, string>>, n: number): Map<string, {
|
|
23
|
+
count: number;
|
|
24
|
+
sample: string;
|
|
25
|
+
}>;
|
|
26
|
+
export interface MyBrainProblem {
|
|
27
|
+
/** The user's file that is not loaded, by name. */
|
|
28
|
+
name: string;
|
|
29
|
+
reason: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Every My brain file that should not load, with why: no readable summary, over the file cap, a lesson already in
|
|
33
|
+
* another of their files or in a bundled skill (one home per lesson, at the shape's failAt), or one file too many
|
|
34
|
+
* for the folder's cap. Files are checked in `order` (the loader passes the profile first); a file that fails is
|
|
35
|
+
* left out of the checks after it, so one problem never names two files. Of two of their files sharing a passage
|
|
36
|
+
* the later one is named. Every bundled skill counts, a same-name one included: a user's file adds to the shared
|
|
37
|
+
* guide of its name (my-brain.ts), so a passage copied from it would be served twice.
|
|
38
|
+
*/
|
|
39
|
+
export declare function myBrainProblems(files: Readonly<Record<string, string>>, { shape, bundled, order }: {
|
|
40
|
+
shape: BrainShape;
|
|
41
|
+
bundled?: Readonly<Record<string, string>>;
|
|
42
|
+
order?: string[];
|
|
43
|
+
}): MyBrainProblem[];
|
|
44
|
+
//# sourceMappingURL=brain-check.d.ts.map
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// THE BRAIN'S COUNTS AND THE MY BRAIN CHECKS, in one place for both readers.
|
|
3
|
+
//
|
|
4
|
+
// The My brain loader (my-brain.ts) runs these on the user's machine on every
|
|
5
|
+
// load, and scripts/brain-lint.mjs (`--root <dir> --mine`) runs the same code,
|
|
6
|
+
// so a file the lint passes is a file the loader serves, and a word is counted
|
|
7
|
+
// the same way by both. The lint adds what needs a person at a keyboard: the
|
|
8
|
+
// summary's exact shape and a source on every block.
|
|
9
|
+
//
|
|
10
|
+
// The numbers are not here: the caller passes the shape, which is
|
|
11
|
+
// scripts/brain-shape.json (read by the lint, embedded into content.ts as
|
|
12
|
+
// BRAIN_SHAPE by scripts/embed-skills.mjs for the loader).
|
|
13
|
+
//
|
|
14
|
+
// A dependency-free leaf: brain-lint.mjs loads it through load-typescript.mjs
|
|
15
|
+
// before any build, so it imports nothing.
|
|
16
|
+
// ============================================================
|
|
17
|
+
const OPERATIVE_RE = /<!--\s*@operative:start\s*-->([\s\S]*?)<!--\s*@operative:end\s*-->/;
|
|
18
|
+
const CARD_START_RE = /<!--\s*@card:start\s*-->/;
|
|
19
|
+
const CARD_RE = /<!--\s*@card:start\s*-->([\s\S]*?)<!--\s*@card:end\s*-->/;
|
|
20
|
+
const INJECT_RE = /<!--\s*@inject:([a-z0-9-]+)\s*-->[\s\S]*?<!--\s*@end:\1\s*-->/g;
|
|
21
|
+
const COMMENT_RE = /<!--[\s\S]*?-->/g;
|
|
22
|
+
const FRONTMATTER_RE = /^?---\r?\n[\s\S]*?\r?\n---\r?\n/;
|
|
23
|
+
const prose = (text) => text.replace(COMMENT_RE, '').replace(FRONTMATTER_RE, '');
|
|
24
|
+
/** Words an agent reads: frontmatter, comments and bare table or list punctuation left out. */
|
|
25
|
+
export function words(text) {
|
|
26
|
+
return prose(text).split(/\s+/).filter((w) => w && !/^[|:\-#*>]+$/.test(w)).length;
|
|
27
|
+
}
|
|
28
|
+
/** The words a passage check compares: prose only, with injected partials, comments, frontmatter and code left out. */
|
|
29
|
+
export function passageWords(text) {
|
|
30
|
+
return text.replace(INJECT_RE, ' ').replace(COMMENT_RE, ' ').replace(FRONTMATTER_RE, '').replace(/```[\s\S]*?```/g, ' ')
|
|
31
|
+
.toLowerCase().replace(/[^a-z0-9 ]+/g, ' ').split(/\s+/).filter(Boolean);
|
|
32
|
+
}
|
|
33
|
+
/** A file's distinct runs of `n` words. */
|
|
34
|
+
function shingles(text, n) {
|
|
35
|
+
const w = passageWords(text);
|
|
36
|
+
const out = new Set();
|
|
37
|
+
for (let i = 0; i + n <= w.length; i++)
|
|
38
|
+
out.add(w.slice(i, i + n).join(' '));
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
/** Per pair of files (`a + b`, sorted), how many runs of `n` words they share, with one as a sample. */
|
|
42
|
+
export function overlaps(skills, n) {
|
|
43
|
+
const seen = new Map();
|
|
44
|
+
for (const [name, text] of Object.entries(skills)) {
|
|
45
|
+
for (const key of shingles(text, n)) {
|
|
46
|
+
if (!seen.has(key))
|
|
47
|
+
seen.set(key, new Set());
|
|
48
|
+
seen.get(key).add(name);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const pairs = new Map();
|
|
52
|
+
for (const [key, where] of seen) {
|
|
53
|
+
if (where.size < 2)
|
|
54
|
+
continue;
|
|
55
|
+
const files = [...where].sort();
|
|
56
|
+
for (let i = 0; i < files.length; i++) {
|
|
57
|
+
for (let j = i + 1; j < files.length; j++) {
|
|
58
|
+
const pair = `${files[i]} + ${files[j]}`;
|
|
59
|
+
const hit = pairs.get(pair) ?? { count: 0, sample: key };
|
|
60
|
+
hit.count++;
|
|
61
|
+
pairs.set(pair, hit);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return pairs;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Each bundled run of words and the files that hold it, built once per bundled record (`brainFiles()` returns one
|
|
69
|
+
* object per served file set) and only when a file reaches the check: the loader checks the user's files against
|
|
70
|
+
* all of them on every load, and re-reading tens of thousands of words each time is waste.
|
|
71
|
+
*/
|
|
72
|
+
const bundledIndexes = new WeakMap();
|
|
73
|
+
function bundledIndex(bundled, n) {
|
|
74
|
+
const cached = bundledIndexes.get(bundled);
|
|
75
|
+
if (cached && cached.n === n)
|
|
76
|
+
return cached.index;
|
|
77
|
+
const index = new Map();
|
|
78
|
+
for (const [name, text] of Object.entries(bundled)) {
|
|
79
|
+
for (const key of shingles(text, n)) {
|
|
80
|
+
const at = index.get(key);
|
|
81
|
+
if (at)
|
|
82
|
+
at.push(name);
|
|
83
|
+
else
|
|
84
|
+
index.set(key, [name]);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
bundledIndexes.set(bundled, { n, index });
|
|
88
|
+
return index;
|
|
89
|
+
}
|
|
90
|
+
/** Why a file has no summary an agent can read first, or null when it has one. */
|
|
91
|
+
function summaryMissing(text) {
|
|
92
|
+
const op = OPERATIVE_RE.exec(text);
|
|
93
|
+
if (op)
|
|
94
|
+
return op[1].replace(COMMENT_RE, '').trim() ? null : 'the operative summary is empty; it is what an agent reads first';
|
|
95
|
+
if (!CARD_START_RE.test(text))
|
|
96
|
+
return 'no <!-- @operative:start --> summary (or, on a model guide, a <!-- @card:start --> card) leading the file; it is what an agent reads first';
|
|
97
|
+
const card = CARD_RE.exec(text);
|
|
98
|
+
if (!card)
|
|
99
|
+
return 'the <!-- @card:start --> has no <!-- @card:end -->';
|
|
100
|
+
return card[1].replace(COMMENT_RE, '').trim() ? null : "the @card is empty; it is the file's summary";
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Every My brain file that should not load, with why: no readable summary, over the file cap, a lesson already in
|
|
104
|
+
* another of their files or in a bundled skill (one home per lesson, at the shape's failAt), or one file too many
|
|
105
|
+
* for the folder's cap. Files are checked in `order` (the loader passes the profile first); a file that fails is
|
|
106
|
+
* left out of the checks after it, so one problem never names two files. Of two of their files sharing a passage
|
|
107
|
+
* the later one is named. Every bundled skill counts, a same-name one included: a user's file adds to the shared
|
|
108
|
+
* guide of its name (my-brain.ts), so a passage copied from it would be served twice.
|
|
109
|
+
*/
|
|
110
|
+
export function myBrainProblems(files, { shape, bundled = {}, order = Object.keys(files).sort() }) {
|
|
111
|
+
const problems = [];
|
|
112
|
+
const caps = shape.caps.mine;
|
|
113
|
+
const n = shape.duplicates.shingleWords;
|
|
114
|
+
const failAt = shape.duplicates.failAt;
|
|
115
|
+
let index;
|
|
116
|
+
const kept = [];
|
|
117
|
+
let total = 0;
|
|
118
|
+
for (const name of order) {
|
|
119
|
+
const text = files[name];
|
|
120
|
+
if (text === undefined)
|
|
121
|
+
continue;
|
|
122
|
+
const missing = summaryMissing(text);
|
|
123
|
+
if (missing) {
|
|
124
|
+
problems.push({ name, reason: missing });
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
const count = words(text);
|
|
128
|
+
if (count > caps.fileWords) {
|
|
129
|
+
problems.push({ name, reason: `${count} words, over My brain's file cap of ${caps.fileWords}` });
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const runs = shingles(text, n);
|
|
133
|
+
// How many of this file's runs each bundled skill holds, then each of their files already kept.
|
|
134
|
+
const hits = [];
|
|
135
|
+
const inBundled = new Map();
|
|
136
|
+
index ??= bundledIndex(bundled, n);
|
|
137
|
+
for (const key of runs) {
|
|
138
|
+
for (const other of index.get(key) ?? []) {
|
|
139
|
+
const hit = inBundled.get(other) ?? { count: 0, sample: key };
|
|
140
|
+
hit.count++;
|
|
141
|
+
inBundled.set(other, hit);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
for (const [other, hit] of inBundled)
|
|
145
|
+
hits.push({ other, theirs: false, ...hit });
|
|
146
|
+
for (const other of kept) {
|
|
147
|
+
let count = 0;
|
|
148
|
+
let sample = '';
|
|
149
|
+
for (const key of runs)
|
|
150
|
+
if (other.runs.has(key)) {
|
|
151
|
+
count++;
|
|
152
|
+
sample ||= key;
|
|
153
|
+
}
|
|
154
|
+
if (count)
|
|
155
|
+
hits.push({ other: other.name, theirs: true, count, sample });
|
|
156
|
+
}
|
|
157
|
+
const dup = hits.filter((hit) => hit.count >= failAt).sort((a, b) => b.count - a.count)[0];
|
|
158
|
+
if (dup) {
|
|
159
|
+
const fix = dup.theirs ? 'keep it in one file and point the other there'
|
|
160
|
+
: dup.other === name ? 'keep only what differs, since the shared guide is served with it'
|
|
161
|
+
: `point at ${dup.other} instead of repeating it`;
|
|
162
|
+
problems.push({ name, reason: `shares ${dup.count} ${n}-word runs with ${dup.theirs ? 'their' : 'the shared'} ${dup.other} ("${dup.sample} …"); one home per lesson: ${fix}` });
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (total + count > caps.layerWords) {
|
|
166
|
+
problems.push({ name, reason: `${count} words would take My brain to ${total + count}, over its cap of ${caps.layerWords}; consolidate first` });
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
total += count;
|
|
170
|
+
kept.push({ name, runs });
|
|
171
|
+
}
|
|
172
|
+
return problems;
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=brain-check.js.map
|
package/dist/skills/content.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export declare const SKILLS: Record<string, string>;
|
|
2
|
+
import type { BrainShape } from './brain-check.js';
|
|
3
|
+
/** scripts/brain-shape.json: the layers, the caps and the duplicate bar (src/skills/brain-check.ts). */
|
|
4
|
+
export declare const BRAIN_SHAPE: BrainShape;
|
|
2
5
|
//# sourceMappingURL=content.d.ts.map
|