@odla-ai/brand 0.1.0 → 0.2.1
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 +11 -2
- package/dist/chunk-APLECQBR.js +1010 -0
- package/dist/chunk-APLECQBR.js.map +1 -0
- package/dist/index-bj73h3qo.d.cts +409 -0
- package/dist/index-bj73h3qo.d.ts +409 -0
- package/dist/index.cjs +11 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -409
- package/dist/index.d.ts +5 -409
- package/dist/index.js +65 -958
- package/dist/index.js.map +1 -1
- package/dist/tokens/index.cjs +912 -0
- package/dist/tokens/index.cjs.map +1 -0
- package/dist/tokens/index.d.cts +1 -0
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.js +29 -0
- package/dist/tokens/index.js.map +1 -0
- package/package.json +6 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,269 +1,7 @@
|
|
|
1
|
+
import { B as BrandDb, A as AssetAnalysis, S as Swatch, a as BrandBook, b as BrandOp, c as BrandEntityRef, d as SectionKind, e as SectionStatus, f as BrandProposal, g as AssetKind, h as BrandActor } from './index-bj73h3qo.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 BookStatus, r as BrandAsset, s as BrandAttrs, t as BrandFileRecord, u as BrandLookup, v as BrandPalette, w as BrandResult, x as BrandRow, y as BrandScalar, z as BrandSection, C as BrandStorage, D as BrandTokens, E as BrandTokensSnapshot, F as BrandUploadBody, G as CompileInput, H as CompiledBrandTokens, I as DARK_FLIP_L_MAX, J as DARK_FLIP_L_MIN, K as DEFAULT_ACCENT_SEED, L as ImagerySection, M as LogoSection, N as MapResult, P as PALETTE_SOURCES, O as PALETTE_STATUSES, Q as PROPOSAL_KINDS, R as PROPOSAL_STATUSES, T as PaletteSection, U as PaletteSource, V as PaletteStatus, W as ProposalKind, X as ProposalStatus, Y as RenderTokensCssOptions, Z as SECTION_KINDS, _ as SECTION_STATUSES, $ as SWATCH_ROLES, a0 as SwatchRole, a1 as TokenWarning, a2 as TypographySection, a3 as VoiceSection, a4 as compileBrandTokens, a5 as deriveDarkTokens, a6 as mapPaletteToTokens, a7 as renderTokensCss } from './index-bj73h3qo.js';
|
|
1
3
|
import { ToolHandler, Skill, ToolDef, Persona, Inference, AgentRunInput, ImageBlock, OracleContentBlock } from '@odla-ai/ai';
|
|
2
4
|
|
|
3
|
-
/** The odla-db namespaces @odla-ai/brand installs and writes. */
|
|
4
|
-
declare const BRAND_NS: {
|
|
5
|
-
readonly book: "brand_book";
|
|
6
|
-
readonly section: "brand_section";
|
|
7
|
-
readonly palette: "brand_palette";
|
|
8
|
-
readonly proposal: "brand_proposal";
|
|
9
|
-
readonly asset: "brand_asset";
|
|
10
|
-
};
|
|
11
|
-
/** Brand-book lifecycle: authored → adopted → retired (delete is owner-only). */
|
|
12
|
-
declare const BOOK_STATUSES: readonly ["draft", "active", "archived"];
|
|
13
|
-
/** Where a brand book stands in its lifecycle. */
|
|
14
|
-
type BookStatus = (typeof BOOK_STATUSES)[number];
|
|
15
|
-
/** The section kinds a book carries — one row per kind, upserted by natural key. */
|
|
16
|
-
declare const SECTION_KINDS: readonly ["palette", "typography", "voice", "logo", "imagery"];
|
|
17
|
-
/** Which facet of the brand a section documents. */
|
|
18
|
-
type SectionKind = (typeof SECTION_KINDS)[number];
|
|
19
|
-
/** Section review state: agent drafts, a human approves. */
|
|
20
|
-
declare const SECTION_STATUSES: readonly ["draft", "approved"];
|
|
21
|
-
/** Whether a section's content has human sign-off. */
|
|
22
|
-
type SectionStatus = (typeof SECTION_STATUSES)[number];
|
|
23
|
-
/** Palette lifecycle — palettes are never row-deleted, only archived. */
|
|
24
|
-
declare const PALETTE_STATUSES: readonly ["active", "archived"];
|
|
25
|
-
/** Whether a palette is the live one or a retired predecessor. */
|
|
26
|
-
type PaletteStatus = (typeof PALETTE_STATUSES)[number];
|
|
27
|
-
/** How a palette came to be: pulled from an asset, derived from a seed color,
|
|
28
|
-
* or entered by hand. */
|
|
29
|
-
declare const PALETTE_SOURCES: readonly ["extracted", "derived", "manual"];
|
|
30
|
-
/** Provenance of a palette's swatches. */
|
|
31
|
-
type PaletteSource = (typeof PALETTE_SOURCES)[number];
|
|
32
|
-
/** What a proposal proposes (palettes are the first-class case). */
|
|
33
|
-
declare const PROPOSAL_KINDS: readonly ["palette", "typography", "voice", "logo"];
|
|
34
|
-
/** Which brand facet a proposal targets. */
|
|
35
|
-
type ProposalKind = (typeof PROPOSAL_KINDS)[number];
|
|
36
|
-
/** Proposal lifecycle: open until a HUMAN accepts/rejects it (or a newer
|
|
37
|
-
* proposal supersedes it) — agents never resolve their own proposals. */
|
|
38
|
-
declare const PROPOSAL_STATUSES: readonly ["open", "accepted", "rejected", "superseded"];
|
|
39
|
-
/** Where a proposal stands in the human-gated review flow. */
|
|
40
|
-
type ProposalStatus = (typeof PROPOSAL_STATUSES)[number];
|
|
41
|
-
/** What kind of upload an asset row records. */
|
|
42
|
-
declare const ASSET_KINDS: readonly ["logo", "wordmark", "inspiration", "document", "font", "other"];
|
|
43
|
-
/** The declared purpose of an uploaded asset. */
|
|
44
|
-
type AssetKind = (typeof ASSET_KINDS)[number];
|
|
45
|
-
/** Every swatch role a palette may assign. `chart` may repeat (a series);
|
|
46
|
-
* `custom` is the escape hatch for roles the token compiler doesn't map. */
|
|
47
|
-
declare const SWATCH_ROLES: readonly ["primary", "secondary", "highlight", "bg", "surface", "text", "neutral", "good", "warn", "danger", "chart", "custom"];
|
|
48
|
-
|
|
49
|
-
/** Scalar values odla-db attrs and where-clauses accept. */
|
|
50
|
-
type BrandScalar = string | number | boolean | null;
|
|
51
|
-
/** Natural-key lookup ref for idempotent upserts (odla-db `Lookup` shape). */
|
|
52
|
-
interface BrandLookup {
|
|
53
|
-
ns: string;
|
|
54
|
-
attr: string;
|
|
55
|
-
value: BrandScalar;
|
|
56
|
-
}
|
|
57
|
-
/** How an op names its row: a raw entity id, or a natural-key lookup. */
|
|
58
|
-
type BrandEntityRef = string | BrandLookup;
|
|
59
|
-
/** Attr payload of one op. Typed `any` on purpose: the real odla-db
|
|
60
|
-
* `transact` constrains attrs to its own `Value` type, and `any` is the one
|
|
61
|
-
* shape assignable in both directions with no cast. */
|
|
62
|
-
type BrandAttrs = Record<string, any>;
|
|
63
|
-
/** One transact operation (update = attr-merge upsert; merge = deep-merge
|
|
64
|
-
* into a json attribute; retract = clear the named attributes, since a typed
|
|
65
|
-
* scalar can't store null). */
|
|
66
|
-
type BrandOp = {
|
|
67
|
-
t: "update";
|
|
68
|
-
ns: string;
|
|
69
|
-
id: BrandEntityRef;
|
|
70
|
-
attrs: BrandAttrs;
|
|
71
|
-
} | {
|
|
72
|
-
t: "merge";
|
|
73
|
-
ns: string;
|
|
74
|
-
id: BrandEntityRef;
|
|
75
|
-
attrs: BrandAttrs;
|
|
76
|
-
} | {
|
|
77
|
-
t: "retract";
|
|
78
|
-
ns: string;
|
|
79
|
-
id: BrandEntityRef;
|
|
80
|
-
attrs: string[];
|
|
81
|
-
} | {
|
|
82
|
-
t: "delete";
|
|
83
|
-
ns: string;
|
|
84
|
-
id: BrandEntityRef;
|
|
85
|
-
};
|
|
86
|
-
/** A row as odla-db returns it: hydrated id plus attrs. */
|
|
87
|
-
type BrandRow = {
|
|
88
|
-
id: string;
|
|
89
|
-
} & Record<string, unknown>;
|
|
90
|
-
/** Query result: namespace → rows. */
|
|
91
|
-
type BrandResult = Record<string, BrandRow[]>;
|
|
92
|
-
/** The role a swatch plays in the palette (what the token compiler maps). */
|
|
93
|
-
type SwatchRole = (typeof SWATCH_ROLES)[number];
|
|
94
|
-
/** One palette color: a role, a `#rrggbb` hex, and optional naming/why. */
|
|
95
|
-
interface Swatch {
|
|
96
|
-
role: SwatchRole;
|
|
97
|
-
hex: string;
|
|
98
|
-
name?: string;
|
|
99
|
-
rationale?: string;
|
|
100
|
-
}
|
|
101
|
-
/** `palette`-kind section content: the accepted palette, denormalized. */
|
|
102
|
-
interface PaletteSection {
|
|
103
|
-
paletteId: string;
|
|
104
|
-
name: string;
|
|
105
|
-
swatches: Swatch[];
|
|
106
|
-
}
|
|
107
|
-
/** `typography`-kind section content. `scale` is a modular type-scale ratio. */
|
|
108
|
-
interface TypographySection {
|
|
109
|
-
fontDisplay?: string;
|
|
110
|
-
fontBody?: string;
|
|
111
|
-
fontMono?: string;
|
|
112
|
-
scale?: number;
|
|
113
|
-
notes?: string;
|
|
114
|
-
}
|
|
115
|
-
/** `voice`-kind section content: tone plus writing principles/examples. */
|
|
116
|
-
interface VoiceSection {
|
|
117
|
-
tone: string;
|
|
118
|
-
principles: string[];
|
|
119
|
-
examples?: string[];
|
|
120
|
-
}
|
|
121
|
-
/** `logo`-kind section content: usage rules and don'ts. */
|
|
122
|
-
interface LogoSection {
|
|
123
|
-
clearspace?: string;
|
|
124
|
-
minSize?: string;
|
|
125
|
-
usage: string[];
|
|
126
|
-
donts: string[];
|
|
127
|
-
}
|
|
128
|
-
/** `imagery`-kind section content: photographic/illustration direction. */
|
|
129
|
-
interface ImagerySection {
|
|
130
|
-
style: string;
|
|
131
|
-
guidance: string[];
|
|
132
|
-
}
|
|
133
|
-
/** Agent-produced description of an uploaded asset (validated + capped). */
|
|
134
|
-
interface AssetAnalysis {
|
|
135
|
-
description: string;
|
|
136
|
-
dominantColors: string[];
|
|
137
|
-
tags: string[];
|
|
138
|
-
}
|
|
139
|
-
/** The compiled-token cache stored on `brand_book.tokens`. `warnings` carries
|
|
140
|
-
* the compiler's `TokenWarning[]` (typed loosely here so the row types don't
|
|
141
|
-
* depend on the token compiler's module). */
|
|
142
|
-
interface BrandTokensSnapshot {
|
|
143
|
-
light: Record<string, string>;
|
|
144
|
-
dark: Record<string, string>;
|
|
145
|
-
warnings: unknown[];
|
|
146
|
-
compiledAt: number;
|
|
147
|
-
}
|
|
148
|
-
/** A brand book row: the auth roster (`memberIds`, including the bot agent
|
|
149
|
-
* id) plus the active palette and compiled-token cache. */
|
|
150
|
-
interface BrandBook {
|
|
151
|
-
id: string;
|
|
152
|
-
slug: string;
|
|
153
|
-
name: string;
|
|
154
|
-
status: BookStatus;
|
|
155
|
-
ownerId: string;
|
|
156
|
-
memberIds: string[];
|
|
157
|
-
channelId?: string;
|
|
158
|
-
activePaletteId?: string;
|
|
159
|
-
tokens?: BrandTokensSnapshot;
|
|
160
|
-
summary?: string;
|
|
161
|
-
createdAt: number;
|
|
162
|
-
updatedAt: number;
|
|
163
|
-
}
|
|
164
|
-
/** A section row — one per (book, kind), upserted by its natural `key`. */
|
|
165
|
-
interface BrandSection {
|
|
166
|
-
id: string;
|
|
167
|
-
key: string;
|
|
168
|
-
bookId: string;
|
|
169
|
-
kind: SectionKind;
|
|
170
|
-
status: SectionStatus;
|
|
171
|
-
content: Record<string, unknown>;
|
|
172
|
-
audience: string[];
|
|
173
|
-
updatedBy: string;
|
|
174
|
-
updatedAt: number;
|
|
175
|
-
}
|
|
176
|
-
/** A palette row. Swatches are json ON the palette, not a namespace: the
|
|
177
|
-
* palette is the atomic proposal/approval unit and swatches are never
|
|
178
|
-
* queried across palettes. */
|
|
179
|
-
interface BrandPalette {
|
|
180
|
-
id: string;
|
|
181
|
-
bookId: string;
|
|
182
|
-
name: string;
|
|
183
|
-
status: PaletteStatus;
|
|
184
|
-
swatches: Swatch[];
|
|
185
|
-
seedHex?: string;
|
|
186
|
-
source: PaletteSource;
|
|
187
|
-
rationale?: string;
|
|
188
|
-
proposalId?: string;
|
|
189
|
-
audience: string[];
|
|
190
|
-
createdAt: number;
|
|
191
|
-
updatedAt: number;
|
|
192
|
-
}
|
|
193
|
-
/** A proposal row: agent output parked for explicit human resolution. */
|
|
194
|
-
interface BrandProposal {
|
|
195
|
-
id: string;
|
|
196
|
-
bookId: string;
|
|
197
|
-
kind: ProposalKind;
|
|
198
|
-
status: ProposalStatus;
|
|
199
|
-
payload: Record<string, unknown>;
|
|
200
|
-
rationale: string;
|
|
201
|
-
sourceAssetId?: string;
|
|
202
|
-
messageId?: string;
|
|
203
|
-
audience: string[];
|
|
204
|
-
createdBy: string;
|
|
205
|
-
createdAt: number;
|
|
206
|
-
resolvedBy?: string;
|
|
207
|
-
resolvedAt?: number;
|
|
208
|
-
resolutionNote?: string;
|
|
209
|
-
}
|
|
210
|
-
/** An asset row mirroring one real uploaded file (worker-mediated; rules
|
|
211
|
-
* close the namespace). Delete is a tombstone (`deletedAt`), never a row
|
|
212
|
-
* delete, so analyses/proposals referencing it stay coherent. */
|
|
213
|
-
interface BrandAsset {
|
|
214
|
-
id: string;
|
|
215
|
-
bookId: string;
|
|
216
|
-
kind: AssetKind;
|
|
217
|
-
path: string;
|
|
218
|
-
url: string;
|
|
219
|
-
contentType: string;
|
|
220
|
-
size: number;
|
|
221
|
-
title?: string;
|
|
222
|
-
analysis?: AssetAnalysis;
|
|
223
|
-
analyzedAt?: number;
|
|
224
|
-
audience: string[];
|
|
225
|
-
uploadedBy: string;
|
|
226
|
-
createdAt: number;
|
|
227
|
-
deletedAt?: number;
|
|
228
|
-
}
|
|
229
|
-
/** What `db.storage.upload` resolves to (odla-db's file record shape). */
|
|
230
|
-
interface BrandFileRecord {
|
|
231
|
-
id: string;
|
|
232
|
-
path: string;
|
|
233
|
-
url: string;
|
|
234
|
-
size: number;
|
|
235
|
-
contentType: string;
|
|
236
|
-
}
|
|
237
|
-
/** Bodies `storage.upload` accepts — a practical subset of the platform's
|
|
238
|
-
* `BodyInit` (which has no ambient type under a DOM-less lib). The real
|
|
239
|
-
* @odla-ai/db client accepts a superset, so it still structurally satisfies
|
|
240
|
-
* {@link BrandStorage}. */
|
|
241
|
-
type BrandUploadBody = string | Blob | ArrayBuffer | Uint8Array | ReadableStream<Uint8Array>;
|
|
242
|
-
/** The injected file store — @odla-ai/db's `storage` API satisfies this. */
|
|
243
|
-
interface BrandStorage {
|
|
244
|
-
upload(path: string, data: BrandUploadBody, contentType?: string): Promise<BrandFileRecord>;
|
|
245
|
-
delete(path: string): Promise<void>;
|
|
246
|
-
}
|
|
247
|
-
/** The injected odla client (structural — a real @odla-ai/db `AdminDb`
|
|
248
|
-
* satisfies it). `transact` accepts flat op arrays and `mutationId` gives
|
|
249
|
-
* exactly-once application (`duplicate: true` on replay). */
|
|
250
|
-
interface BrandDb {
|
|
251
|
-
query(q: Record<string, unknown>): Promise<Record<string, unknown[]>>;
|
|
252
|
-
transact(ops: unknown[], opts?: {
|
|
253
|
-
mutationId?: string;
|
|
254
|
-
}): Promise<{
|
|
255
|
-
txId: number;
|
|
256
|
-
duplicate?: boolean;
|
|
257
|
-
}>;
|
|
258
|
-
storage: BrandStorage;
|
|
259
|
-
}
|
|
260
|
-
/** Who is acting: a human member or the book's bot agent. */
|
|
261
|
-
interface BrandActor {
|
|
262
|
-
id: string;
|
|
263
|
-
kind: "human" | "agent";
|
|
264
|
-
email?: string;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
5
|
/** Caller-fault error (bad hex, oversized payload, blocked transition…) — the
|
|
268
6
|
* route layer maps it to a 400. `fields` carries per-field messages when the
|
|
269
7
|
* failure came from input validation. */
|
|
@@ -828,150 +566,6 @@ interface DerivePaletteOptions {
|
|
|
828
566
|
*/
|
|
829
567
|
declare function derivePalette(seedHex: string, opts?: DerivePaletteOptions): Swatch[];
|
|
830
568
|
|
|
831
|
-
/**
|
|
832
|
-
* The @odla-ai/ui required tier (js/tokens.js REQUIRED_TOKENS), in the ui
|
|
833
|
-
* contract's order. The compiler always emits a concrete value for every
|
|
834
|
-
* one of these.
|
|
835
|
-
*/
|
|
836
|
-
declare const BRAND_REQUIRED_TOKENS: readonly ["--ui-bg", "--ui-surface", "--ui-surface-2", "--ui-text", "--ui-text-muted", "--ui-text-faint", "--ui-border", "--ui-border-strong", "--ui-accent", "--ui-accent-strong", "--ui-accent-soft", "--ui-on-accent", "--ui-good", "--ui-good-soft", "--ui-warn", "--ui-warn-soft", "--ui-danger", "--ui-danger-soft", "--ui-code-bg", "--ui-code-text", "--ui-shadow", "--ui-font-sans", "--ui-font-serif", "--ui-font-mono", "--ui-font-display"];
|
|
837
|
-
/**
|
|
838
|
-
* Accent-composing derived roles from the ui defaulted tier. All five
|
|
839
|
-
* accent-family members of the :where([data-ui-accent]) re-declaration set
|
|
840
|
-
* (--ui-accent-glow, --ui-accent-2, --ui-accent-2-soft, --ui-highlight,
|
|
841
|
-
* --ui-focus) plus --ui-shadow-strong, which composes var(--ui-shadow) —
|
|
842
|
-
* a token this compiler re-declares, so the island rule applies to it too.
|
|
843
|
-
*/
|
|
844
|
-
declare const BRAND_DERIVED_TOKENS: readonly ["--ui-accent-glow", "--ui-accent-2", "--ui-accent-2-soft", "--ui-highlight", "--ui-focus", "--ui-shadow-strong"];
|
|
845
|
-
/**
|
|
846
|
-
* Chart roles the compiler emits: the six series slots (real palette
|
|
847
|
-
* swatches when the palette carries them, ui var() compositions otherwise)
|
|
848
|
-
* and the four accent-composing chart roles the :where([data-ui-accent])
|
|
849
|
-
* block re-declares (band, band-strong, flow, glow).
|
|
850
|
-
*/
|
|
851
|
-
declare const BRAND_CHART_TOKENS: readonly ["--ui-chart-1", "--ui-chart-2", "--ui-chart-3", "--ui-chart-4", "--ui-chart-5", "--ui-chart-6", "--ui-chart-band", "--ui-chart-band-strong", "--ui-chart-flow", "--ui-chart-glow"];
|
|
852
|
-
/**
|
|
853
|
-
* Chat surface roles (js/tokens.js CHAT_TOKENS, complete). Two are in the
|
|
854
|
-
* accent-swap set (user-bg, tool-accent); the other four compose surface /
|
|
855
|
-
* text tokens the compiler also re-declares, so an island stays coherent.
|
|
856
|
-
*/
|
|
857
|
-
declare const BRAND_CHAT_TOKENS: readonly ["--ui-chat-user-bg", "--ui-chat-user-text", "--ui-chat-assistant-bg", "--ui-chat-thinking-bg", "--ui-chat-thinking-text", "--ui-chat-tool-accent"];
|
|
858
|
-
/**
|
|
859
|
-
* Every token the compiler emits, in emission order — also the deterministic
|
|
860
|
-
* declaration order renderTokensCss uses, so golden CSS fixtures are stable.
|
|
861
|
-
*/
|
|
862
|
-
declare const BRAND_EMITTED_TOKENS: readonly string[];
|
|
863
|
-
|
|
864
|
-
/**
|
|
865
|
-
* A compiled token map: `--ui-*` custom-property name → CSS value. Values
|
|
866
|
-
* are either concrete (hex, font stack, shadow) or composition strings
|
|
867
|
-
* (`var(--ui-accent)`, `color-mix(in srgb, var(--ui-accent) 10%, transparent)`)
|
|
868
|
-
* that recompute wherever the map is declared — which is what lets one
|
|
869
|
-
* object serve as both a :root theme and a scoped override-island payload.
|
|
870
|
-
*/
|
|
871
|
-
type BrandTokens = Record<string, string>;
|
|
872
|
-
/**
|
|
873
|
-
* A non-fatal compiler note: a missing swatch role that fell back to a
|
|
874
|
-
* derived value, a dropped invalid input, or a color the compiler had to
|
|
875
|
-
* move to clear a WCAG contrast bar (then `adjustedFrom` carries the
|
|
876
|
-
* original hex).
|
|
877
|
-
*/
|
|
878
|
-
interface TokenWarning {
|
|
879
|
-
/** The `--ui-*` token the note is about. */
|
|
880
|
-
token: string;
|
|
881
|
-
/** Human-readable explanation, actionable for the brand author. */
|
|
882
|
-
message: string;
|
|
883
|
-
/** The original hex, when the compiler adjusted a color for contrast. */
|
|
884
|
-
adjustedFrom?: string;
|
|
885
|
-
}
|
|
886
|
-
/** Input to {@link import("./compile").compileBrandTokens}. */
|
|
887
|
-
interface CompileInput {
|
|
888
|
-
/** The palette to compile — typically a brand_palette row's swatches. */
|
|
889
|
-
swatches: Swatch[];
|
|
890
|
-
/** Optional typography section; fonts get system-stack fallbacks appended. */
|
|
891
|
-
typography?: TypographySection;
|
|
892
|
-
/** Author escape hatch: applied verbatim onto the light map, last. */
|
|
893
|
-
overrides?: BrandTokens;
|
|
894
|
-
}
|
|
895
|
-
/** The compiler's result: light + derived dark token maps, plus notes. */
|
|
896
|
-
interface CompiledBrandTokens {
|
|
897
|
-
/** Light-mode tokens (every name in BRAND_EMITTED_TOKENS, plus overrides). */
|
|
898
|
-
light: BrandTokens;
|
|
899
|
-
/** Dark-mode tokens derived from `light` — same key set. */
|
|
900
|
-
dark: BrandTokens;
|
|
901
|
-
/** Fallbacks taken and contrast adjustments made; empty on a clean palette. */
|
|
902
|
-
warnings: TokenWarning[];
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
/**
|
|
906
|
-
* Seed used when the palette has no usable chromatic swatch at all — the
|
|
907
|
-
* @odla-ai/ui neutral default accent (css/tokens.css restrained blue).
|
|
908
|
-
*/
|
|
909
|
-
declare const DEFAULT_ACCENT_SEED = "#3b5e8c";
|
|
910
|
-
/** What {@link mapPaletteToTokens} returns. */
|
|
911
|
-
interface MapResult {
|
|
912
|
-
/** The light-mode token map — every name in BRAND_EMITTED_TOKENS. */
|
|
913
|
-
tokens: BrandTokens;
|
|
914
|
-
/** Fallbacks taken and contrast adjustments made. */
|
|
915
|
-
warnings: TokenWarning[];
|
|
916
|
-
}
|
|
917
|
-
/**
|
|
918
|
-
* Maps a palette (+ optional typography) onto the full light-mode
|
|
919
|
-
* @odla-ai/ui token set. Never throws on bad palettes: invalid swatches are
|
|
920
|
-
* dropped, missing roles derive from the accent via derivePalette, and every
|
|
921
|
-
* degradation is recorded as a {@link TokenWarning}.
|
|
922
|
-
*/
|
|
923
|
-
declare function mapPaletteToTokens(input: CompileInput): MapResult;
|
|
924
|
-
|
|
925
|
-
/** Darkest OKLab L a flipped neutral may take — the dark bg floor (never black). */
|
|
926
|
-
declare const DARK_FLIP_L_MIN = 0.2;
|
|
927
|
-
/** Lightest OKLab L a flipped neutral may take — keeps flipped text off pure white. */
|
|
928
|
-
declare const DARK_FLIP_L_MAX = 0.95;
|
|
929
|
-
/**
|
|
930
|
-
* Derives the dark-mode token map from a light one (see the file header for
|
|
931
|
-
* the flip / re-lighten / passthrough rules). Pure and total: tokens the
|
|
932
|
-
* rules don't recognize — including non-hex values in recognized slots —
|
|
933
|
-
* pass through unchanged, and the result always has exactly the input's
|
|
934
|
-
* key set. Deterministic, never throws.
|
|
935
|
-
*/
|
|
936
|
-
declare function deriveDarkTokens(light: BrandTokens): BrandTokens;
|
|
937
|
-
|
|
938
|
-
/** Options for {@link renderTokensCss}. */
|
|
939
|
-
interface RenderTokensCssOptions {
|
|
940
|
-
/** Dark-mode tokens (deriveDarkTokens output). Omit for a light-only sheet. */
|
|
941
|
-
dark?: BrandTokens;
|
|
942
|
-
/**
|
|
943
|
-
* Selector the light block declares on (default ":root"). A scoped
|
|
944
|
-
* selector (e.g. `[data-brand="acme"]`) gets its dark blocks nested under
|
|
945
|
-
* the document-level theme guards instead of replacing them.
|
|
946
|
-
*/
|
|
947
|
-
selector?: string;
|
|
948
|
-
/**
|
|
949
|
-
* Also emit a `.ui-invert` block carrying the full dark payload, so the
|
|
950
|
-
* subtree renders dark regardless of the global mode. Requires `dark`.
|
|
951
|
-
*/
|
|
952
|
-
includeInvert?: boolean;
|
|
953
|
-
}
|
|
954
|
-
/**
|
|
955
|
-
* Renders a compiled token map (plus optional dark map) as CSS text shaped
|
|
956
|
-
* like an @odla-ai/ui theme tokens file — see the file header for the block
|
|
957
|
-
* structure and ordering guarantees. Deterministic for a given input.
|
|
958
|
-
*/
|
|
959
|
-
declare function renderTokensCss(light: BrandTokens, opts?: RenderTokensCssOptions): string;
|
|
960
|
-
|
|
961
|
-
/**
|
|
962
|
-
* Compiles a brand palette into @odla-ai/ui design tokens: a light map
|
|
963
|
-
* covering every name in BRAND_EMITTED_TOKENS (plus overrides), a dark map
|
|
964
|
-
* derived from it (same key set), and the warnings accumulated along the
|
|
965
|
-
* way — missing-role fallbacks and contrast adjustments (`adjustedFrom`).
|
|
966
|
-
*
|
|
967
|
-
* Both maps double as runtime override-island payloads: every derived
|
|
968
|
-
* default that composes the accent family is re-declared, so applying the
|
|
969
|
-
* map on any element recomputes charts, softs, focus and chat roles against
|
|
970
|
-
* the brand palette (see roles.ts). Deterministic; never throws on bad
|
|
971
|
-
* palettes.
|
|
972
|
-
*/
|
|
973
|
-
declare function compileBrandTokens(input: CompileInput): CompiledBrandTokens;
|
|
974
|
-
|
|
975
569
|
/** The bot identity the skill writes as (`selfId` = the agent id carried in
|
|
976
570
|
* the book's `memberIds` roster and every audience snapshot). */
|
|
977
571
|
interface BrandSkillSelf {
|
|
@@ -1197,6 +791,8 @@ interface BrandDispatchDeps {
|
|
|
1197
791
|
}>;
|
|
1198
792
|
/** Origin prefixed onto relative asset urls (skill + pre-turn attachments). */
|
|
1199
793
|
fileBaseUrl: string;
|
|
794
|
+
/** Optional stable id factory for durable whole-turn retries. */
|
|
795
|
+
newId?: () => string;
|
|
1200
796
|
/** Optional chat-skill factory (e.g. wrapping @odla-ai/chat's chatSkill) so
|
|
1201
797
|
* the bot can reply in the triggering channel. */
|
|
1202
798
|
chatSkillFor?: (channelId: string, self: BrandSkillSelf) => Skill;
|
|
@@ -1339,4 +935,4 @@ interface CreateBrandIntegrationOptions {
|
|
|
1339
935
|
*/
|
|
1340
936
|
declare function createBrandIntegration(options?: CreateBrandIntegrationOptions): BrandIntegrationDescriptor;
|
|
1341
937
|
|
|
1342
|
-
export { ASSET_CONTENT_TYPES,
|
|
938
|
+
export { ASSET_CONTENT_TYPES, type AcceptProposalInput, AssetAnalysis, AssetKind, type AttrType, type AudienceChildren, BRAND_INSTRUCTIONS, BRAND_RULES, BRAND_SCHEMA, BrandActor, BrandBook, type BrandBotTriggerOpts, BrandDb, type BrandDeps, type BrandDispatchBody, type BrandDispatchDeps, BrandEntityRef, type BrandFetchedBytes, BrandInputError, type BrandIntegrationDescriptor, type BrandIntegrationProbe, BrandNotFoundError, BrandOp, BrandProposal, type BrandRouteCtx, type BrandRouteOpts, type BrandRule, type BrandRules, type BrandSkillOpts, type BrandSkillSelf, type BrandToolCtx, type BrandTrigger, 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, type DeriveChartOptions, type DerivePaletteOptions, type Hsl, type IntegrationProvision, type IntegrationSecret, type IntegrationSetting, type LightnessDirection, MAX_SWATCHES, MAX_VIEW_BYTES, type NamedColor, type NearestNamedColor, type Oklab, type Oklch, PICK_TEXT_DEFAULT_CANDIDATES, type ProposePaletteInput, RAMP_L_MAX, RAMP_L_MIN, type RejectProposalInput, type ResolvedBrandDeps, type Rgb, SectionKind, SectionStatus, type SerializedAttr, type SerializedEntity, type SerializedLink, type SerializedLinkEnd, type SerializedSchema, Swatch, type UpsertSectionInput, acceptProposalOps, adjustLightnessUntil, analogous, assertAnalysis, assertAssetContentType, assertHex, assertSectionContent, assertSwatches, assetTools, audienceFanoutOps, base64FromBytes, bookForChannel, bookTools, brandBotTrigger, brandInputFor, brandIntegration, brandRules, brandSkill, capString, capStringArray, clamp01, clampToGamut, complementary, contrastRatio, createAssetOps, createBookOps, createBrandIntegration, createBrandPersona, createBrandRoutes, deltaEOK, deltaEOKLab, deriveChartColors, derivePalette, dispatchBrandTurn, hexToOklch, hslToRgb, inSrgbGamut, linearToSrgb, meetsAA, meetsAAA, monochrome, nearestNamedColor, normalizeHex, oklabToOklch, oklabToRgb, oklchToHex, oklchToOklab, paletteTools, parseBrandDispatch, parseHex, pickTextOn, proposePaletteOps, readTools, recordAnalysisOps, rejectProposalOps, relativeLuminance, resolveDeps, rgbToHsl, rgbToOklab, rotateHue, safeFileName, sectionKey, splitComplementary, srgbToLinear, supportsBrandVision, tetradic, tintShadeRamp, toHex, tombstoneAssetOps, triadic, updateBookOps, upsertSectionOps };
|