mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-14 23:26:39 +03:00
Call them compositions; single-source WELL_TIERS
The data layer has said compositions since the catalog was split, while the
code, the model-facing text, and the UI still said stagings. The rename was
held back by the selection logic existing twice; it exists once now, so this
is one pass instead of two coordinated ones.
Renamed: selectApprovedStagings, selectApprovedStaging, renderStaging, and
the model-facing STAGING GRAMMAR / STAGING CHALLENGERS / FIRST-SURFACE
STAGING INPUTS headings. The block that introduces them now states what
they are for rather than only what they are not: what is the cleverest way
to present, organize, or make interactive the problem in front of you.
Three places keep the old word on purpose:
- The rank salt, `${scope}:${key}:staging`. It is hash input, so renaming
it would re-deal every roll anyone has ever reproduced by key. Verified:
240 seeder rolls and 252 API rolls reproduce exactly.
- `Staging/hierarchy:`, the first composition grammar prefix. Inside a
composition, staging names one of its four aspects, which is a different
word-sense from staging as the name for the whole artifact. It is also a
schema constant that 317 catalog entries are validated against.
- The wire fields. The API keeps emitting `stagings` and `staging` beside
`compositions`, because the wire is the one place a rename cannot be
coordinated with already-installed skills. Clients prefer the new field
and fall back through both old ones.
Separately, WELL_TIERS had two definitions after the extraction.
roll-selection.mjs owns it now and concept-catalog.mjs imports it, in that
direction because concept-catalog reads the filesystem and a Pages Function
must not pull node:fs into its bundle. Imported and re-exported rather than
re-exported alone: a bare `export { X } from` does not bind X locally, and
validateConceptCatalog needs it, which cost one round of red tests.
Dropped concept-catalog's synchronous deterministicRank. Nothing imports it
since selection moved out, and leaving a second ranking implementation
around is how the first drift started.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
71d7b5e310
commit
a92ba5f2b0
@@ -2,7 +2,7 @@ import crypto from 'node:crypto';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { CONCEPT_STATUSES, normalizeConceptForm } from './concept-catalog.mjs';
|
||||
|
||||
// Catalog B: stagings rather than styles. A composition organizes attention,
|
||||
// Catalog B: compositions rather than styles. A composition organizes attention,
|
||||
// sequence, or manipulation on a surface and must survive being dressed in
|
||||
// any committed visual identity; it deliberately carries no palette or type
|
||||
// half. Surface-scope seeds draw from here (plus catalog A duals); direction
|
||||
@@ -15,8 +15,8 @@ export const COMPOSITION_GRAMMAR_PREFIXES = [
|
||||
'Adaptation:',
|
||||
];
|
||||
|
||||
// Surfaces align with the skill's modes: a persuade staging and an operate
|
||||
// staging are different species, and read/experience surfaces get their own.
|
||||
// Surfaces align with the skill's modes: a persuade composition and an operate
|
||||
// composition are different species, and read/experience surfaces get their own.
|
||||
export const COMPOSITION_SURFACES = new Set(['persuade', 'operate', 'read', 'experience']);
|
||||
|
||||
export function compositionContentHash(composition) {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import crypto from 'node:crypto';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { WELL_TIERS } from './roll-selection.mjs';
|
||||
|
||||
export const CONCEPT_STATUSES = new Set(['approved', 'rejected']);
|
||||
|
||||
// What a concept is actually strong at. Worlds carry a durable visual
|
||||
// identity (their palette/type half is the magnet); compositions carry a
|
||||
// staging or interaction idea (their topology half is the magnet) that can be
|
||||
// composition or interaction idea (their topology half is the magnet) that can be
|
||||
// dressed in any committed identity; duals fuse both inseparably. Direction
|
||||
// seeds draw world|dual, surface seeds draw composition|dual.
|
||||
export const CONCEPT_STRENGTHS = new Set(['world', 'composition', 'dual']);
|
||||
@@ -15,7 +16,13 @@ export const CONCEPT_STRENGTHS = new Set(['world', 'composition', 'dual']);
|
||||
// atmosphere worlds need the largest translation step. Every seed roll draws
|
||||
// one challenger from each tier so at least one directly-usable graphic
|
||||
// system is always on the table.
|
||||
export const WELL_TIERS = ['graphic', 'interaction', 'atmosphere'];
|
||||
// Defined in roll-selection.mjs, the dependency-free leaf both the seeder and
|
||||
// the roll API import. It cannot depend on this file: this one reads the
|
||||
// filesystem, and a Pages Function must not pull node:fs into its bundle.
|
||||
// Imported and re-exported rather than re-exported alone: a bare
|
||||
// `export { X } from` does not bind X in this module's own scope, and
|
||||
// validateConceptCatalog needs it.
|
||||
export { WELL_TIERS };
|
||||
|
||||
const WEB_LEVERAGE_RE = /(?:\b3d\b|\badaptive\b|\banimat(?:e|ed|ion)\b|\bapi\b|\baria\b|\baudio\b|\bautomated?\b|\bbarcode\b|\bbroadcastchannel\b|\bbrowser\b|\bcamera\b|canvas\b|\bcaption\b|\bcollaborat(?:e|ive|ion)\b|\bcompar(?:e|ison)\b|\bcomput(?:e|ed|ation)\b|\bcomputer[- ]vision\b|\bconstraint[- ]solving\b|\bcryptographic?\b|\bcss\b|\bdeep[- ]link(?:ing)?\b|\bdirect manipulation\b|\bdom\b|\bdrag\b|\bfilter\b|\bfocus\b|\bgenerative\b|\bgeolocat(?:e|ed|ion)\b|\bgesture\b|\bgpu\b|\bgraph\b|\bhistory\b|\bindexeddb\b|\binteractive\b|\bintersectionobserver\b|\bkeyboard\b|\blive\b|\blocal\b|\bmicrophone\b|\bmotion\b|\bmultiplayer\b|\bnative\b|\bnotification\b|\boffline\b|\bpersonaliz(?:e|ed|ation)\b|\bplayable\b|\bpointer\b|\bprocedural\b|\bprovenance\b|\breal[- ]?time\b|\bresizeobserver\b|\bresponsive\b|\breveal\b|\bscrub\b|\bsearch\b|\bsearchparams\b|\bsensor\b|\bserver[- ]sent\b|\bservice worker\b|\bshader\b|\bsimulat(?:e|ed|ion|or)\b|\bspatial\b|\bstate\b|\bstream(?:ing)?\b|\bsvg\b|\bsynchroniz(?:e|ed|ation)\b|\btimeline\b|\btouch\b|\burl|\bvideo\b|\bweb(?:gl|socket|vtt)?\b|\bworker\b|\bzoom\b)/i;
|
||||
export const SYSTEM_PREFIXES = [
|
||||
@@ -320,10 +327,3 @@ export function approvedPoolRevision(concepts) {
|
||||
return crypto.createHash('sha256').update(payload).digest('hex').slice(0, 12);
|
||||
}
|
||||
|
||||
export function deterministicRank(items, input, idFor = item => item.id) {
|
||||
return [...items].sort((a, b) => {
|
||||
const scoreA = crypto.createHash('sha256').update(`${input}:${idFor(a)}`).digest('hex');
|
||||
const scoreB = crypto.createHash('sha256').update(`${input}:${idFor(b)}`).digest('hex');
|
||||
return scoreB.localeCompare(scoreA) || idFor(a).localeCompare(idFor(b));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ function compositionTickets(pool) {
|
||||
export function* selectApprovedChallengers({ scope, key, reroll = 0, minRating = null, concepts }) {
|
||||
const approved = concepts.filter(concept => concept.status === 'approved');
|
||||
// Direction chooses a durable identity, so it draws worlds; surface designs
|
||||
// one page inside a committed identity, so it draws stagings. Duals serve
|
||||
// one page inside a committed identity, so it draws compositions. Duals serve
|
||||
// both. A tier with no matching-strength approvals falls back to its full
|
||||
// approved pool rather than starving the roll.
|
||||
const wanted = scope === 'direction'
|
||||
@@ -176,12 +176,12 @@ export function* selectApprovedChallengers({ scope, key, reroll = 0, minRating =
|
||||
}
|
||||
|
||||
/**
|
||||
* Three identity-free staging inputs from an explicit approved pool.
|
||||
* Three identity-free composition inputs from an explicit approved pool.
|
||||
* Drive with runSyncSelection or runAsyncSelection.
|
||||
*
|
||||
* One input was too weak a counterweight to a model's habitual page skeleton:
|
||||
* it became a single optional flourish beside six identity challengers rather
|
||||
* than a real search over composition. Distinct staging families are preferred
|
||||
* than a real search over composition. Distinct composition families are preferred
|
||||
* so a roll tests materially different hierarchy, sequence, and interaction
|
||||
* laws. Cross-mode fallback would make the input misleading, so an absent mode
|
||||
* returns nothing rather than borrowing. Re-rolls exclude every earlier set
|
||||
@@ -196,11 +196,11 @@ export function* selectApprovedChallengers({ scope, key, reroll = 0, minRating =
|
||||
* @param {number} [options.count]
|
||||
* @returns {Generator<string[], Array, string[]>}
|
||||
*/
|
||||
export function* selectApprovedStagings({ scope, key, reroll = 0, mode = null, compositions, count = 3 }) {
|
||||
// Stagings honour the same breadth gate as worlds: one too specific to serve
|
||||
export function* selectApprovedCompositions({ scope, key, reroll = 0, mode = null, compositions, count = 3 }) {
|
||||
// Compositions honour the same breadth gate as worlds: one too specific to serve
|
||||
// an arbitrary build stays approved for direct briefs and leaves the
|
||||
// challenger pool. Falls back to the full approved set rather than returning
|
||||
// nothing if every approved staging is niche.
|
||||
// nothing if every approved composition is niche.
|
||||
let approved = compositions.filter(composition => composition.status === 'approved');
|
||||
const broad = approved.filter(composition => composition.review?.breadth !== 'niche');
|
||||
if (broad.length > 0) approved = broad;
|
||||
@@ -218,15 +218,17 @@ export function* selectApprovedStagings({ scope, key, reroll = 0, mode = null, c
|
||||
const base = available.length >= Math.min(count, approved.length) ? available : approved;
|
||||
// Rating weights the draw as it does for worlds. It matters more here
|
||||
// because the per-surface pools are small, so an unweighted shuffle repeats
|
||||
// a weak staging far more often. Each ticket carries its index so the rank
|
||||
// a weak composition far more often. Each ticket carries its index so the rank
|
||||
// sees a distinct key per ticket: ranking bare duplicates would hash
|
||||
// identically and the pick loop's id-dedupe would silently discard the
|
||||
// second copy, making the weighting a no-op.
|
||||
let tickets = compositionTickets(base);
|
||||
// A pool of nothing but 1-star keeps still has to yield stagings.
|
||||
// A pool of nothing but 1-star keeps still has to yield compositions.
|
||||
if (tickets.length === 0) tickets = base.map(composition => ({ composition, ticket: 0 }));
|
||||
const ranked = (yield* rank(
|
||||
tickets,
|
||||
// The salt keeps the word "staging" deliberately. It is hash input, so
|
||||
// renaming it would re-deal every roll anyone has ever reproduced by key.
|
||||
round === 0 ? `${scope}:${key}:staging` : `${scope}:${key}:staging:reroll-${round}`,
|
||||
entry => `${entry.composition.id}#${entry.ticket}`
|
||||
)).map(entry => entry.composition);
|
||||
|
||||
Reference in New Issue
Block a user