@odla-ai/brand 0.7.1 → 0.8.0
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 +1 -1
- package/dist/{index-r36KQK5n.d.cts → index-r6SGidYT.d.cts} +6 -1
- package/dist/{index-r36KQK5n.d.ts → index-r6SGidYT.d.ts} +6 -1
- package/dist/index.cjs +133 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -3
- package/dist/index.d.ts +15 -3
- package/dist/index.js +135 -5
- package/dist/index.js.map +1 -1
- package/dist/tokens/index.d.cts +1 -1
- package/dist/tokens/index.d.ts +1 -1
- package/package.json +4 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { P as ProposalKind, a as ProposalStatus, A as AssetKind, b as AssetAnalysis, B as BookStatus, c as BrandTokensSnapshot, d as PaletteStatus, S as Swatch, e as PaletteSource, f as SectionKind, g as SectionStatus, h as SwatchRole } from './index-
|
|
2
|
-
export { i as ASSET_KINDS, j as BOOK_STATUSES, k as BRAND_CHART_TOKENS, l as BRAND_CHAT_TOKENS, m as BRAND_DERIVED_TOKENS, n as BRAND_EMITTED_TOKENS, o as BRAND_NS, p as BRAND_REQUIRED_TOKENS, q as BrandTokens, C as CompileInput, r as CompiledBrandTokens, D as DARK_FLIP_L_MAX, s as DARK_FLIP_L_MIN, t as DEFAULT_ACCENT_SEED, u as DESIGN_ASSET_KIND, I as ImagerySection, L as LogoSection, M as MapResult, v as PALETTE_SOURCES, w as PALETTE_STATUSES, x as PROPOSAL_KINDS, y as PROPOSAL_STATUSES, z as PaletteSection, R as ROLE_TOKEN, E as RenderTokensCssOptions, F as SECTION_KINDS, G as SECTION_STATUSES, H as SWATCH_ROLES, T as TokenWarning, J as TypographySection, V as VoiceSection, K as compileBrandTokens, N as deriveDarkTokens, O as mapPaletteToTokens, Q as renderTokensCss } from './index-
|
|
1
|
+
import { P as ProposalKind, a as ProposalStatus, A as AssetKind, b as AssetAnalysis, B as BookStatus, c as BrandTokensSnapshot, d as PaletteStatus, S as Swatch, e as PaletteSource, f as SectionKind, g as SectionStatus, h as SwatchRole } from './index-r6SGidYT.cjs';
|
|
2
|
+
export { i as ASSET_KINDS, j as BOOK_STATUSES, k as BRAND_CHART_TOKENS, l as BRAND_CHAT_TOKENS, m as BRAND_DERIVED_TOKENS, n as BRAND_EMITTED_TOKENS, o as BRAND_NS, p as BRAND_REQUIRED_TOKENS, q as BrandTokens, C as CompileInput, r as CompiledBrandTokens, D as DARK_FLIP_L_MAX, s as DARK_FLIP_L_MIN, t as DEFAULT_ACCENT_SEED, u as DESIGN_ASSET_KIND, I as ImagerySection, L as LogoSection, M as MapResult, v as PALETTE_SOURCES, w as PALETTE_STATUSES, x as PROPOSAL_KINDS, y as PROPOSAL_STATUSES, z as PaletteSection, R as ROLE_TOKEN, E as RenderTokensCssOptions, F as SECTION_KINDS, G as SECTION_STATUSES, H as SWATCH_ROLES, T as TokenWarning, J as TypographySection, V as VoiceSection, K as compileBrandTokens, N as deriveDarkTokens, O as mapPaletteToTokens, Q as renderTokensCss } from './index-r6SGidYT.cjs';
|
|
3
3
|
import { ToolHandler, Skill, ToolDef, Persona, Inference, AgentRunInput, ImageBlock, OracleContentBlock } from '@odla-ai/ai';
|
|
4
|
+
import { PromotionAdapterResult } from '@odla-ai/promotion';
|
|
4
5
|
|
|
5
6
|
/** One entry of the bundle's base64 asset manifest, without its payload. */
|
|
6
7
|
interface DesignBundleAsset {
|
|
@@ -1901,4 +1902,15 @@ interface CreateBrandIntegrationOptions {
|
|
|
1901
1902
|
*/
|
|
1902
1903
|
declare function createBrandIntegration(options?: CreateBrandIntegrationOptions): BrandIntegrationDescriptor;
|
|
1903
1904
|
|
|
1904
|
-
|
|
1905
|
+
/** Stable adapter identity bound into Brand artifact provenance. */
|
|
1906
|
+
declare const BRAND_PROMOTION_ADAPTER = "@odla-ai/brand/v1";
|
|
1907
|
+
/** Approved Brand rows required to export one bounded promotion selection. */
|
|
1908
|
+
interface BrandPromotionInput {
|
|
1909
|
+
book: BrandBook;
|
|
1910
|
+
sections: readonly BrandSection[];
|
|
1911
|
+
palettes: readonly BrandPalette[];
|
|
1912
|
+
}
|
|
1913
|
+
/** Export only human-approved, provider-independent Brand state. */
|
|
1914
|
+
declare function exportBrandPromotion(input: BrandPromotionInput): PromotionAdapterResult;
|
|
1915
|
+
|
|
1916
|
+
export { ASSET_CONTENT_TYPES, type AcceptProposalInput, AssetAnalysis, AssetKind, type AttrType, type AudienceChildren, BRAND_AGENT_PROFILE, BRAND_DISCUSSION_REFERENCE_KINDS, BRAND_INSTRUCTIONS, BRAND_PROMOTION_ADAPTER, BRAND_RULES, BRAND_SCHEMA, BookStatus, type BrandActor, type BrandAgentBridge, type BrandAgentProfile, type BrandApprovalReceipt, type BrandAsset, type BrandAttrs, type BrandBook, type BrandBotTriggerOpts, type BrandCapabilityAuthority, BrandConflictError, type BrandDb, type BrandDecisionBinding, type BrandDeps, type BrandDiscussionReference, type BrandDiscussionReferenceKind, type BrandDiscussionReferenceTarget, type BrandDiscussionSwatch, type BrandDispatchBody, type BrandDispatchDeps, type BrandEntityRef, type BrandFetchedBytes, type BrandFileRecord, BrandForbiddenError, BrandGoneError, type BrandHumanAuthorityConsumption, BrandInputError, type BrandIntegrationDescriptor, type BrandIntegrationProbe, type BrandLookup, BrandNotFoundError, type BrandOp, type BrandPalette, type BrandPrincipalProjection, type BrandPromotionInput, type BrandProposal, type BrandProposalProvenance, type BrandProposalReviewSnapshot, type BrandResult, BrandReviewStateChangedError, type BrandRouteCtx, type BrandRouteOpts, type BrandRow, type BrandRule, type BrandRules, type BrandScalar, type BrandSection, type BrandSkillOpts, type BrandSkillSelf, type BrandSourceAssetSnapshot, type BrandStorage, BrandTokensSnapshot, type BrandToolCtx, type BrandTransactGuard, type BrandTransactOptions, type BrandTrigger, type BrandUploadBody, type BrandVisionCapabilities, type BrandVisionSpec, CHART_DELTA_MIN, CHAT_MESSAGE_NS, CSS_NAMED_COLORS, type ContrastKind, type CreateAssetInput, type CreateBookInput, type CreateBrandIntegrationOptions, type CreateBrandPersonaOpts, DEFAULT_BRAND_SYSTEM, DESIGN_CONTENT_TYPES, type DeriveChartOptions, type DerivePaletteOptions, type DesignAssetGroup, type DesignBundle, type DesignBundleAsset, type DesignColorUse, type DesignDecompilation, type DesignDigest, type DesignManifestEntry, type DesignOutlineEntry, type DesignProp, type DesignTokenSets, type DesignTokenSkip, type Hsl, type IntegrationProvision, type IntegrationSecret, type IntegrationSetting, type LightnessDirection, MAX_COLORS, MAX_EXTERNALS, MAX_FONTS, MAX_HEADING_CHARS, MAX_OUTLINE_ENTRIES, MAX_PROPS, MAX_SWATCHES, MAX_THUMBNAIL_CHARS, MAX_VIEW_BYTES, type NamedColor, type NearestNamedColor, type Oklab, type Oklch, PICK_TEXT_DEFAULT_CANDIDATES, PaletteSource, PaletteStatus, ProposalKind, ProposalStatus, type ProposePaletteInput, type ProposeSectionInput, RAMP_L_MAX, RAMP_L_MIN, type RejectProposalInput, type ResolvedBrandDeps, type Rgb, type ScannedDeclaration, SectionKind, SectionStatus, type SerializedAttr, type SerializedEntity, type SerializedLink, type SerializedLinkEnd, type SerializedSchema, Swatch, SwatchRole, type UpsertSectionInput, acceptProposalOps, adjustLightnessUntil, analogous, assertAnalysis, assertAssetContentType, assertHex, assertSectionContent, assertSwatches, assetTools, attachedBrandAssetIds, audienceFanoutOps, base64ByteLength, base64FromBytes, beginAssetDeleteOps, bookForChannel, bookTools, brandAuthorityRef, brandBotTrigger, brandDiscussionReferenceHref, brandDiscussionReferenceId, brandInputFor, brandIntegration, brandJsonDigest, brandRules, brandSkill, canonicalBrandJson, capString, capStringArray, clamp01, clampToGamut, collapseWhitespace, complementary, contrastRatio, contrastReport, createAssetOps, createBookOps, createBrandIntegration, createBrandPersona, createBrandRoutes, cssColorToHex, decodeEntities, deltaEOK, deltaEOKLab, deriveChartColors, derivePalette, digestDesignBundle, digestDesignHtml, dispatchBrandTurn, exportBrandPromotion, extractColors, extractDesignTokens, extractFonts, extractOutline, extractProps, extractThumbnailSvg, extractTitle, finishAssetDeleteOps, formatBrandDiscussionReference, groupAssets, hexToOklch, hslToRgb, htmlToText, inSrgbGamut, isBoundedBrandJson, isBrandHumanAuthorityConsumption, isDesignBundle, linearToSrgb, meetsAA, meetsAAA, monochrome, nearestNamedColor, normalizeHex, oklabToOklch, oklabToRgb, oklchToHex, oklchToOklab, paletteTools, parseBrandDiscussionReference, parseBrandDispatch, parseDesignBundle, parseHex, pickTextOn, proposalAsWritten, proposalReviewSnapshot, proposePaletteOps, proposeSectionOps, readDesignManifest, readTools, receiptAsWritten, recordAnalysisOps, rejectProposalOps, relativeLuminance, resolveDeps, resolveVarRefs, rgbToHsl, rgbToOklab, rotateHue, rowAsWritten, safeFileName, scanCustomProperties, sectionKey, splitComplementary, srgbToLinear, stripCssComments, styleSheetText, supportsBrandVision, swatchesFromDesignTokens, tetradic, tintShadeRamp, toHex, triadic, updateBookOps, upsertSectionOps, verifyBrandApprovalReceipt };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { P as ProposalKind, a as ProposalStatus, A as AssetKind, b as AssetAnalysis, B as BookStatus, c as BrandTokensSnapshot, d as PaletteStatus, S as Swatch, e as PaletteSource, f as SectionKind, g as SectionStatus, h as SwatchRole } from './index-
|
|
2
|
-
export { i as ASSET_KINDS, j as BOOK_STATUSES, k as BRAND_CHART_TOKENS, l as BRAND_CHAT_TOKENS, m as BRAND_DERIVED_TOKENS, n as BRAND_EMITTED_TOKENS, o as BRAND_NS, p as BRAND_REQUIRED_TOKENS, q as BrandTokens, C as CompileInput, r as CompiledBrandTokens, D as DARK_FLIP_L_MAX, s as DARK_FLIP_L_MIN, t as DEFAULT_ACCENT_SEED, u as DESIGN_ASSET_KIND, I as ImagerySection, L as LogoSection, M as MapResult, v as PALETTE_SOURCES, w as PALETTE_STATUSES, x as PROPOSAL_KINDS, y as PROPOSAL_STATUSES, z as PaletteSection, R as ROLE_TOKEN, E as RenderTokensCssOptions, F as SECTION_KINDS, G as SECTION_STATUSES, H as SWATCH_ROLES, T as TokenWarning, J as TypographySection, V as VoiceSection, K as compileBrandTokens, N as deriveDarkTokens, O as mapPaletteToTokens, Q as renderTokensCss } from './index-
|
|
1
|
+
import { P as ProposalKind, a as ProposalStatus, A as AssetKind, b as AssetAnalysis, B as BookStatus, c as BrandTokensSnapshot, d as PaletteStatus, S as Swatch, e as PaletteSource, f as SectionKind, g as SectionStatus, h as SwatchRole } from './index-r6SGidYT.js';
|
|
2
|
+
export { i as ASSET_KINDS, j as BOOK_STATUSES, k as BRAND_CHART_TOKENS, l as BRAND_CHAT_TOKENS, m as BRAND_DERIVED_TOKENS, n as BRAND_EMITTED_TOKENS, o as BRAND_NS, p as BRAND_REQUIRED_TOKENS, q as BrandTokens, C as CompileInput, r as CompiledBrandTokens, D as DARK_FLIP_L_MAX, s as DARK_FLIP_L_MIN, t as DEFAULT_ACCENT_SEED, u as DESIGN_ASSET_KIND, I as ImagerySection, L as LogoSection, M as MapResult, v as PALETTE_SOURCES, w as PALETTE_STATUSES, x as PROPOSAL_KINDS, y as PROPOSAL_STATUSES, z as PaletteSection, R as ROLE_TOKEN, E as RenderTokensCssOptions, F as SECTION_KINDS, G as SECTION_STATUSES, H as SWATCH_ROLES, T as TokenWarning, J as TypographySection, V as VoiceSection, K as compileBrandTokens, N as deriveDarkTokens, O as mapPaletteToTokens, Q as renderTokensCss } from './index-r6SGidYT.js';
|
|
3
3
|
import { ToolHandler, Skill, ToolDef, Persona, Inference, AgentRunInput, ImageBlock, OracleContentBlock } from '@odla-ai/ai';
|
|
4
|
+
import { PromotionAdapterResult } from '@odla-ai/promotion';
|
|
4
5
|
|
|
5
6
|
/** One entry of the bundle's base64 asset manifest, without its payload. */
|
|
6
7
|
interface DesignBundleAsset {
|
|
@@ -1901,4 +1902,15 @@ interface CreateBrandIntegrationOptions {
|
|
|
1901
1902
|
*/
|
|
1902
1903
|
declare function createBrandIntegration(options?: CreateBrandIntegrationOptions): BrandIntegrationDescriptor;
|
|
1903
1904
|
|
|
1904
|
-
|
|
1905
|
+
/** Stable adapter identity bound into Brand artifact provenance. */
|
|
1906
|
+
declare const BRAND_PROMOTION_ADAPTER = "@odla-ai/brand/v1";
|
|
1907
|
+
/** Approved Brand rows required to export one bounded promotion selection. */
|
|
1908
|
+
interface BrandPromotionInput {
|
|
1909
|
+
book: BrandBook;
|
|
1910
|
+
sections: readonly BrandSection[];
|
|
1911
|
+
palettes: readonly BrandPalette[];
|
|
1912
|
+
}
|
|
1913
|
+
/** Export only human-approved, provider-independent Brand state. */
|
|
1914
|
+
declare function exportBrandPromotion(input: BrandPromotionInput): PromotionAdapterResult;
|
|
1915
|
+
|
|
1916
|
+
export { ASSET_CONTENT_TYPES, type AcceptProposalInput, AssetAnalysis, AssetKind, type AttrType, type AudienceChildren, BRAND_AGENT_PROFILE, BRAND_DISCUSSION_REFERENCE_KINDS, BRAND_INSTRUCTIONS, BRAND_PROMOTION_ADAPTER, BRAND_RULES, BRAND_SCHEMA, BookStatus, type BrandActor, type BrandAgentBridge, type BrandAgentProfile, type BrandApprovalReceipt, type BrandAsset, type BrandAttrs, type BrandBook, type BrandBotTriggerOpts, type BrandCapabilityAuthority, BrandConflictError, type BrandDb, type BrandDecisionBinding, type BrandDeps, type BrandDiscussionReference, type BrandDiscussionReferenceKind, type BrandDiscussionReferenceTarget, type BrandDiscussionSwatch, type BrandDispatchBody, type BrandDispatchDeps, type BrandEntityRef, type BrandFetchedBytes, type BrandFileRecord, BrandForbiddenError, BrandGoneError, type BrandHumanAuthorityConsumption, BrandInputError, type BrandIntegrationDescriptor, type BrandIntegrationProbe, type BrandLookup, BrandNotFoundError, type BrandOp, type BrandPalette, type BrandPrincipalProjection, type BrandPromotionInput, type BrandProposal, type BrandProposalProvenance, type BrandProposalReviewSnapshot, type BrandResult, BrandReviewStateChangedError, type BrandRouteCtx, type BrandRouteOpts, type BrandRow, type BrandRule, type BrandRules, type BrandScalar, type BrandSection, type BrandSkillOpts, type BrandSkillSelf, type BrandSourceAssetSnapshot, type BrandStorage, BrandTokensSnapshot, type BrandToolCtx, type BrandTransactGuard, type BrandTransactOptions, type BrandTrigger, type BrandUploadBody, type BrandVisionCapabilities, type BrandVisionSpec, CHART_DELTA_MIN, CHAT_MESSAGE_NS, CSS_NAMED_COLORS, type ContrastKind, type CreateAssetInput, type CreateBookInput, type CreateBrandIntegrationOptions, type CreateBrandPersonaOpts, DEFAULT_BRAND_SYSTEM, DESIGN_CONTENT_TYPES, type DeriveChartOptions, type DerivePaletteOptions, type DesignAssetGroup, type DesignBundle, type DesignBundleAsset, type DesignColorUse, type DesignDecompilation, type DesignDigest, type DesignManifestEntry, type DesignOutlineEntry, type DesignProp, type DesignTokenSets, type DesignTokenSkip, type Hsl, type IntegrationProvision, type IntegrationSecret, type IntegrationSetting, type LightnessDirection, MAX_COLORS, MAX_EXTERNALS, MAX_FONTS, MAX_HEADING_CHARS, MAX_OUTLINE_ENTRIES, MAX_PROPS, MAX_SWATCHES, MAX_THUMBNAIL_CHARS, MAX_VIEW_BYTES, type NamedColor, type NearestNamedColor, type Oklab, type Oklch, PICK_TEXT_DEFAULT_CANDIDATES, PaletteSource, PaletteStatus, ProposalKind, ProposalStatus, type ProposePaletteInput, type ProposeSectionInput, RAMP_L_MAX, RAMP_L_MIN, type RejectProposalInput, type ResolvedBrandDeps, type Rgb, type ScannedDeclaration, SectionKind, SectionStatus, type SerializedAttr, type SerializedEntity, type SerializedLink, type SerializedLinkEnd, type SerializedSchema, Swatch, SwatchRole, type UpsertSectionInput, acceptProposalOps, adjustLightnessUntil, analogous, assertAnalysis, assertAssetContentType, assertHex, assertSectionContent, assertSwatches, assetTools, attachedBrandAssetIds, audienceFanoutOps, base64ByteLength, base64FromBytes, beginAssetDeleteOps, bookForChannel, bookTools, brandAuthorityRef, brandBotTrigger, brandDiscussionReferenceHref, brandDiscussionReferenceId, brandInputFor, brandIntegration, brandJsonDigest, brandRules, brandSkill, canonicalBrandJson, capString, capStringArray, clamp01, clampToGamut, collapseWhitespace, complementary, contrastRatio, contrastReport, createAssetOps, createBookOps, createBrandIntegration, createBrandPersona, createBrandRoutes, cssColorToHex, decodeEntities, deltaEOK, deltaEOKLab, deriveChartColors, derivePalette, digestDesignBundle, digestDesignHtml, dispatchBrandTurn, exportBrandPromotion, extractColors, extractDesignTokens, extractFonts, extractOutline, extractProps, extractThumbnailSvg, extractTitle, finishAssetDeleteOps, formatBrandDiscussionReference, groupAssets, hexToOklch, hslToRgb, htmlToText, inSrgbGamut, isBoundedBrandJson, isBrandHumanAuthorityConsumption, isDesignBundle, linearToSrgb, meetsAA, meetsAAA, monochrome, nearestNamedColor, normalizeHex, oklabToOklch, oklabToRgb, oklchToHex, oklchToOklab, paletteTools, parseBrandDiscussionReference, parseBrandDispatch, parseDesignBundle, parseHex, pickTextOn, proposalAsWritten, proposalReviewSnapshot, proposePaletteOps, proposeSectionOps, readDesignManifest, readTools, receiptAsWritten, recordAnalysisOps, rejectProposalOps, relativeLuminance, resolveDeps, resolveVarRefs, rgbToHsl, rgbToOklab, rotateHue, rowAsWritten, safeFileName, scanCustomProperties, sectionKey, splitComplementary, srgbToLinear, stripCssComments, styleSheetText, supportsBrandVision, swatchesFromDesignTokens, tetradic, tintShadeRamp, toHex, triadic, updateBookOps, upsertSectionOps, verifyBrandApprovalReceipt };
|
package/dist/index.js
CHANGED
|
@@ -463,6 +463,7 @@ var DESIGN_CONTENT_TYPES = /* @__PURE__ */ new Set(["text/html"]);
|
|
|
463
463
|
var HEX_RGB = /^#[0-9a-f]{3}$/;
|
|
464
464
|
var HEX_RRGGBB = /^#[0-9a-f]{6}$/;
|
|
465
465
|
var HEX_ALPHA = /^#[0-9a-f]{4}$|^#[0-9a-f]{8}$/;
|
|
466
|
+
var UI_TOKEN_NAME = /^--ui-[a-z0-9-]+$/;
|
|
466
467
|
var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
467
468
|
function assertHex(value, label = "color") {
|
|
468
469
|
if (typeof value !== "string")
|
|
@@ -529,6 +530,21 @@ function assertTypographySection(c) {
|
|
|
529
530
|
out.scale = c.scale;
|
|
530
531
|
}
|
|
531
532
|
if (c.notes !== void 0) out.notes = capString(c.notes, "content.notes", 2e3);
|
|
533
|
+
if (c.tokenOverrides !== void 0) {
|
|
534
|
+
if (!isRecord(c.tokenOverrides))
|
|
535
|
+
throw new BrandInputError("content.tokenOverrides must be an object");
|
|
536
|
+
const entries = Object.entries(c.tokenOverrides);
|
|
537
|
+
if (entries.length > 64)
|
|
538
|
+
throw new BrandInputError("content.tokenOverrides must have at most 64 entries");
|
|
539
|
+
out.tokenOverrides = Object.fromEntries(entries.map(([name, raw]) => {
|
|
540
|
+
if (!UI_TOKEN_NAME.test(name))
|
|
541
|
+
throw new BrandInputError(`content.tokenOverrides.${name} must be a --ui-* token name`);
|
|
542
|
+
const value = capString(raw, `content.tokenOverrides.${name}`, 500);
|
|
543
|
+
if (/[;{}]/.test(value) || /url\s*\(/i.test(value))
|
|
544
|
+
throw new BrandInputError(`content.tokenOverrides.${name} contains an unsafe CSS value`);
|
|
545
|
+
return [name, value];
|
|
546
|
+
}));
|
|
547
|
+
}
|
|
532
548
|
return out;
|
|
533
549
|
}
|
|
534
550
|
function assertVoiceSection(c) {
|
|
@@ -692,14 +708,14 @@ var SNAPSHOT_REQUIRED = [
|
|
|
692
708
|
];
|
|
693
709
|
function validSnapshotShape(value) {
|
|
694
710
|
if (!record3(value) || !exactKeys(value, SNAPSHOT_REQUIRED)) return false;
|
|
695
|
-
const
|
|
696
|
-
return boundedString(value.id) && boundedString(value.bookId) && typeof value.kind === "string" && PROPOSAL_KINDS.includes(value.kind) && value.status === "open" && record3(value.payload) && boundedString(value.rationale, 2e3) && record3(
|
|
711
|
+
const provenance2 = value.provenance;
|
|
712
|
+
return boundedString(value.id) && boundedString(value.bookId) && typeof value.kind === "string" && PROPOSAL_KINDS.includes(value.kind) && value.status === "open" && record3(value.payload) && boundedString(value.rationale, 2e3) && record3(provenance2) && exactKeys(provenance2, [
|
|
697
713
|
"sourceAssetId",
|
|
698
714
|
"sourceAsset",
|
|
699
715
|
"messageId",
|
|
700
716
|
"turnId",
|
|
701
717
|
"taintLabels"
|
|
702
|
-
]) && (
|
|
718
|
+
]) && (provenance2.sourceAssetId === null || boundedString(provenance2.sourceAssetId)) && (provenance2.sourceAsset === null || record3(provenance2.sourceAsset) && exactKeys(provenance2.sourceAsset, [
|
|
703
719
|
"assetId",
|
|
704
720
|
"contentDigest",
|
|
705
721
|
"objectEtag",
|
|
@@ -708,7 +724,7 @@ function validSnapshotShape(value) {
|
|
|
708
724
|
"contentType",
|
|
709
725
|
"analysisRevision",
|
|
710
726
|
"analysisDigest"
|
|
711
|
-
]) && boundedString(
|
|
727
|
+
]) && boundedString(provenance2.sourceAsset.assetId) && typeof provenance2.sourceAsset.contentDigest === "string" && DIGEST.test(provenance2.sourceAsset.contentDigest) && boundedString(provenance2.sourceAsset.objectEtag) && Number.isSafeInteger(provenance2.sourceAsset.objectSize) && provenance2.sourceAsset.objectSize > 0 && typeof provenance2.sourceAsset.pathDigest === "string" && DIGEST.test(provenance2.sourceAsset.pathDigest) && (provenance2.sourceAsset.contentType === null || boundedString(provenance2.sourceAsset.contentType, 160)) && (provenance2.sourceAsset.analysisRevision === null || Number.isSafeInteger(provenance2.sourceAsset.analysisRevision) && provenance2.sourceAsset.analysisRevision >= 0) && (provenance2.sourceAsset.analysisDigest === null || typeof provenance2.sourceAsset.analysisDigest === "string" && DIGEST.test(provenance2.sourceAsset.analysisDigest))) && (provenance2.sourceAssetId === null && provenance2.sourceAsset === null || provenance2.sourceAssetId !== null && provenance2.sourceAsset !== null && provenance2.sourceAsset.assetId === provenance2.sourceAssetId) && (provenance2.messageId === null || boundedString(provenance2.messageId)) && (provenance2.turnId === null || boundedString(provenance2.turnId)) && Array.isArray(provenance2.taintLabels) && provenance2.taintLabels.length <= 16 && provenance2.taintLabels.every((label) => boundedString(label, 120)) && new Set(provenance2.taintLabels).size === provenance2.taintLabels.length && typeof value.reviewDigest === "string" && DIGEST.test(value.reviewDigest) && Array.isArray(value.audience) && value.audience.length > 0 && value.audience.length <= 100 && value.audience.every((id) => boundedString(id)) && new Set(value.audience).size === value.audience.length && boundedString(value.createdBy) && boundedString(value.createdAuthorityRef) && safeTime(value.createdAt);
|
|
712
728
|
}
|
|
713
729
|
var CONSUMPTION_REQUIRED = [
|
|
714
730
|
"id",
|
|
@@ -3053,7 +3069,10 @@ var proposalGuardEquals = (snapshot) => ({ ...snapshot });
|
|
|
3053
3069
|
|
|
3054
3070
|
// src/routes/proposal-effects.ts
|
|
3055
3071
|
async function tokenSnapshot(swatches, typography, input, paletteId, paletteReceiptId, paletteActionDigest, typographyReceiptId, typographyActionDigest) {
|
|
3056
|
-
const compiled = compileBrandTokens({
|
|
3072
|
+
const compiled = compileBrandTokens({
|
|
3073
|
+
swatches,
|
|
3074
|
+
...typography ? { typography, overrides: typography.tokenOverrides } : {}
|
|
3075
|
+
});
|
|
3057
3076
|
const sources = {
|
|
3058
3077
|
paletteId,
|
|
3059
3078
|
paletteReceiptId,
|
|
@@ -4346,6 +4365,115 @@ function createBrandIntegration(options = {}) {
|
|
|
4346
4365
|
probes: [{ path: `${basePath}/books`, expectedStatus: 401 }]
|
|
4347
4366
|
};
|
|
4348
4367
|
}
|
|
4368
|
+
|
|
4369
|
+
// src/promotion.ts
|
|
4370
|
+
import {
|
|
4371
|
+
canonicalPromotionValue
|
|
4372
|
+
} from "@odla-ai/promotion";
|
|
4373
|
+
var BRAND_PROMOTION_ADAPTER = "@odla-ai/brand/v1";
|
|
4374
|
+
var provenance = (sourceIds, receiptDigests = []) => ({
|
|
4375
|
+
adapter: BRAND_PROMOTION_ADAPTER,
|
|
4376
|
+
sourceIds: [...sourceIds].sort(),
|
|
4377
|
+
receiptDigests: [...receiptDigests].sort()
|
|
4378
|
+
});
|
|
4379
|
+
var exclusions = (book) => [
|
|
4380
|
+
{
|
|
4381
|
+
kind: "brand.runtime",
|
|
4382
|
+
id: book.slug,
|
|
4383
|
+
reason: "environment_local",
|
|
4384
|
+
paths: [`${BRAND_NS.book}.ownerId`, `${BRAND_NS.book}.memberIds`, `${BRAND_NS.book}.channelId`, `${BRAND_NS.book}.*At`],
|
|
4385
|
+
detail: "Ownership, roster, channel, and timestamps remain local to the target environment."
|
|
4386
|
+
},
|
|
4387
|
+
{
|
|
4388
|
+
kind: "brand.drafts",
|
|
4389
|
+
id: book.slug,
|
|
4390
|
+
reason: "draft_state",
|
|
4391
|
+
paths: [`${BRAND_NS.proposal}.*`, `${BRAND_NS.section}[status=draft]`],
|
|
4392
|
+
detail: "Open proposals and unapproved sections are review state, not published brand content."
|
|
4393
|
+
},
|
|
4394
|
+
{
|
|
4395
|
+
kind: "brand.assets",
|
|
4396
|
+
id: book.slug,
|
|
4397
|
+
reason: "provider_identity",
|
|
4398
|
+
paths: [`${BRAND_NS.asset}.storageObjectId`, `${BRAND_NS.asset}.path`, `${BRAND_NS.asset}.*AuthorityRef`],
|
|
4399
|
+
detail: "Stored files and provider object identities require a separate asset-transfer contract."
|
|
4400
|
+
},
|
|
4401
|
+
{
|
|
4402
|
+
kind: "brand.authority",
|
|
4403
|
+
id: book.slug,
|
|
4404
|
+
reason: "authority_history",
|
|
4405
|
+
paths: [`${BRAND_NS.approvalReceipt}.*`, `${BRAND_NS.palette}.audience`],
|
|
4406
|
+
detail: "Authority rows stay immutable in their source environment; artifacts retain only receipt digests and ids."
|
|
4407
|
+
}
|
|
4408
|
+
];
|
|
4409
|
+
function exportBrandPromotion(input) {
|
|
4410
|
+
const { book } = input;
|
|
4411
|
+
if (book.status !== "active") throw new TypeError(`brand book ${book.slug} is not active`);
|
|
4412
|
+
const revision = `brand:${book.slug}:${book.activationRevision}`;
|
|
4413
|
+
const artifacts = [];
|
|
4414
|
+
if (book.tokens) {
|
|
4415
|
+
const {
|
|
4416
|
+
compiledAt: _compiledAt,
|
|
4417
|
+
paletteReceiptId,
|
|
4418
|
+
paletteActionDigest,
|
|
4419
|
+
typographyReceiptId,
|
|
4420
|
+
typographyActionDigest,
|
|
4421
|
+
sourceDigest,
|
|
4422
|
+
...stableTokens
|
|
4423
|
+
} = book.tokens;
|
|
4424
|
+
artifacts.push({
|
|
4425
|
+
kind: "brand.tokens",
|
|
4426
|
+
id: book.slug,
|
|
4427
|
+
sourceRevision: revision,
|
|
4428
|
+
provenance: provenance(
|
|
4429
|
+
[book.id, book.tokens.paletteId, paletteReceiptId, typographyReceiptId].filter((value) => Boolean(value)),
|
|
4430
|
+
[sourceDigest, paletteActionDigest, typographyActionDigest].filter((value) => Boolean(value))
|
|
4431
|
+
),
|
|
4432
|
+
content: canonicalPromotionValue({ bookSlug: book.slug, tokens: stableTokens })
|
|
4433
|
+
});
|
|
4434
|
+
}
|
|
4435
|
+
for (const section of input.sections.filter((row) => row.bookId === book.id && row.status === "approved")) {
|
|
4436
|
+
if (!section.approvalReceiptId || !section.approvalActionDigest) {
|
|
4437
|
+
throw new TypeError(`approved brand section ${section.key} lacks approval provenance`);
|
|
4438
|
+
}
|
|
4439
|
+
artifacts.push({
|
|
4440
|
+
kind: "brand.section",
|
|
4441
|
+
id: `${book.slug}/${section.kind}`,
|
|
4442
|
+
sourceRevision: revision,
|
|
4443
|
+
provenance: provenance([book.id, section.id, section.approvalReceiptId], [section.approvalActionDigest]),
|
|
4444
|
+
content: canonicalPromotionValue({ bookSlug: book.slug, kind: section.kind, content: section.content })
|
|
4445
|
+
});
|
|
4446
|
+
}
|
|
4447
|
+
const activePalette2 = input.palettes.find((row) => row.bookId === book.id && row.id === book.activePaletteId && row.status === "active");
|
|
4448
|
+
if (book.activePaletteId && !activePalette2) throw new TypeError(`active palette ${book.activePaletteId} is unavailable`);
|
|
4449
|
+
if (activePalette2) {
|
|
4450
|
+
artifacts.push({
|
|
4451
|
+
kind: "brand.palette",
|
|
4452
|
+
id: `${book.slug}/${activePalette2.id}`,
|
|
4453
|
+
sourceRevision: revision,
|
|
4454
|
+
provenance: provenance([book.id, activePalette2.id, activePalette2.proposalId, activePalette2.approvalReceiptId], [activePalette2.approvalActionDigest]),
|
|
4455
|
+
content: canonicalPromotionValue({
|
|
4456
|
+
bookSlug: book.slug,
|
|
4457
|
+
name: activePalette2.name,
|
|
4458
|
+
swatches: activePalette2.swatches,
|
|
4459
|
+
source: activePalette2.source,
|
|
4460
|
+
...activePalette2.seedHex ? { seedHex: activePalette2.seedHex } : {},
|
|
4461
|
+
...activePalette2.rationale ? { rationale: activePalette2.rationale } : {}
|
|
4462
|
+
})
|
|
4463
|
+
});
|
|
4464
|
+
}
|
|
4465
|
+
return {
|
|
4466
|
+
adapter: BRAND_PROMOTION_ADAPTER,
|
|
4467
|
+
artifacts,
|
|
4468
|
+
exclusions: exclusions(book),
|
|
4469
|
+
preconditions: [{
|
|
4470
|
+
code: "brand.schema",
|
|
4471
|
+
path: "services.brand.schemaVersion",
|
|
4472
|
+
expected: 1,
|
|
4473
|
+
detail: "The target must expose the Brand v1 approved-content schema."
|
|
4474
|
+
}]
|
|
4475
|
+
};
|
|
4476
|
+
}
|
|
4349
4477
|
export {
|
|
4350
4478
|
ASSET_CONTENT_TYPES,
|
|
4351
4479
|
ASSET_KINDS,
|
|
@@ -4358,6 +4486,7 @@ export {
|
|
|
4358
4486
|
BRAND_EMITTED_TOKENS,
|
|
4359
4487
|
BRAND_INSTRUCTIONS,
|
|
4360
4488
|
BRAND_NS,
|
|
4489
|
+
BRAND_PROMOTION_ADAPTER,
|
|
4361
4490
|
BRAND_REQUIRED_TOKENS,
|
|
4362
4491
|
BRAND_RULES,
|
|
4363
4492
|
BRAND_SCHEMA,
|
|
@@ -4446,6 +4575,7 @@ export {
|
|
|
4446
4575
|
digestDesignBundle,
|
|
4447
4576
|
digestDesignHtml,
|
|
4448
4577
|
dispatchBrandTurn,
|
|
4578
|
+
exportBrandPromotion,
|
|
4449
4579
|
extractColors,
|
|
4450
4580
|
extractDesignTokens,
|
|
4451
4581
|
extractFonts,
|