@tangle-network/agent-app 0.53.9 → 0.53.11

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.
Files changed (32) hide show
  1. package/dist/{DesignCanvasEditor-ZQDWOGRV.js → DesignCanvasEditor-AG5TXCE4.js} +3 -3
  2. package/dist/chat-routes/index.js +4 -4
  3. package/dist/{chunk-LFMP73W3.js → chunk-3RJGWWVS.js} +2 -2
  4. package/dist/{chunk-5GYKS6WT.js → chunk-E6SY7ILK.js} +2 -2
  5. package/dist/{chunk-TUGR3FCS.js → chunk-F5CCOBCU.js} +1 -1
  6. package/dist/{chunk-TUGR3FCS.js.map → chunk-F5CCOBCU.js.map} +1 -1
  7. package/dist/{chunk-T52MKPHE.js → chunk-IZ52E7V4.js} +5 -5
  8. package/dist/{chunk-T52MKPHE.js.map → chunk-IZ52E7V4.js.map} +1 -1
  9. package/dist/{chunk-ZVNPAJ7Z.js → chunk-LUKLQDIK.js} +11 -3
  10. package/dist/chunk-LUKLQDIK.js.map +1 -0
  11. package/dist/{chunk-YFGV5ZBY.js → chunk-O627ODGW.js} +2 -2
  12. package/dist/{chunk-6JM5EWOP.js → chunk-P3UEWQGE.js} +2 -2
  13. package/dist/{chunk-P2GXQRFR.js → chunk-XQGON2X2.js} +4 -4
  14. package/dist/design-canvas-react/index.js +3 -3
  15. package/dist/design-canvas-react/lazy.js +1 -1
  16. package/dist/preset-cloudflare/index.js +2 -2
  17. package/dist/sandbox/index.js +4 -4
  18. package/dist/theme/brand.generated.d.ts +1 -1
  19. package/dist/theme/index.js +1 -1
  20. package/dist/theme/tokens.css +136 -24
  21. package/dist/theme-contract/cli.js +1 -1
  22. package/dist/theme-contract/index.js +1 -1
  23. package/dist/tools/index.js +4 -4
  24. package/dist/work-product/index.js +2 -2
  25. package/package.json +5 -5
  26. package/dist/chunk-ZVNPAJ7Z.js.map +0 -1
  27. /package/dist/{DesignCanvasEditor-ZQDWOGRV.js.map → DesignCanvasEditor-AG5TXCE4.js.map} +0 -0
  28. /package/dist/{chunk-LFMP73W3.js.map → chunk-3RJGWWVS.js.map} +0 -0
  29. /package/dist/{chunk-5GYKS6WT.js.map → chunk-E6SY7ILK.js.map} +0 -0
  30. /package/dist/{chunk-YFGV5ZBY.js.map → chunk-O627ODGW.js.map} +0 -0
  31. /package/dist/{chunk-6JM5EWOP.js.map → chunk-P3UEWQGE.js.map} +0 -0
  32. /package/dist/{chunk-P2GXQRFR.js.map → chunk-XQGON2X2.js.map} +0 -0
@@ -23,7 +23,8 @@ function buildUtilityRe(suffix) {
23
23
  function definedVars(cssFiles) {
24
24
  const defs = /* @__PURE__ */ new Set();
25
25
  const visited = /* @__PURE__ */ new Set();
26
- const visit = (file) => {
26
+ const visit = (inputFile) => {
27
+ const file = resolve(inputFile);
27
28
  if (visited.has(file)) return;
28
29
  visited.add(file);
29
30
  let css;
@@ -35,7 +36,14 @@ function definedVars(cssFiles) {
35
36
  for (const m of css.matchAll(/^\s*(--[a-z0-9-]+)\s*:/gim)) if (m[1]) defs.add(m[1]);
36
37
  for (const m of css.matchAll(/@import\s+['"]([^'"]+)['"]/g)) {
37
38
  if (!m[1]) continue;
38
- const imported = m[1].startsWith(".") ? resolve(dirname(file), m[1]) : createRequire(file).resolve(m[1]);
39
+ let imported;
40
+ try {
41
+ imported = m[1].startsWith(".") ? resolve(dirname(file), m[1]) : createRequire(file).resolve(m[1]);
42
+ } catch (error) {
43
+ const code = error.code;
44
+ if (code === "MODULE_NOT_FOUND" || code === "ERR_PACKAGE_PATH_NOT_EXPORTED") continue;
45
+ throw error;
46
+ }
39
47
  visit(imported);
40
48
  }
41
49
  };
@@ -96,4 +104,4 @@ function displayPath(file) {
96
104
  export {
97
105
  checkThemeContract
98
106
  };
99
- //# sourceMappingURL=chunk-ZVNPAJ7Z.js.map
107
+ //# sourceMappingURL=chunk-LUKLQDIK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/theme-contract/index.ts"],"sourcesContent":["/**\n * Exportable theme-token contract checker — the incident guard for the\n * invisible-popover class of bugs.\n *\n * The failure mode (tax-agent's transparent model dropdown; the whole\n * `bg-surface-container-*` family): a consumer app ships a component that\n * references a theme token — either as `var(--popover)` or as a Tailwind class\n * like `bg-surface-container-high` that the agent-app preset maps to\n * `hsl(var(--popover))` — but the app's OWN build never emits that custom\n * property (it forgot `import '@tangle-network/agent-app/styles'`, or dropped a\n * token in its local tokens.css). CSS resolves the missing var to nothing, the\n * surface paints transparent, and NOTHING errors. It ships invisible.\n *\n * `tests/theme/tokens-contract.test.ts` guards agent-app's OWN components. This\n * module lifts that walking logic into a function every CONSUMER app can run\n * against ITS OWN source in CI, comparing references to the tokens.css agent-app\n * ships plus any extra CSS the app defines.\n *\n * ── What each check covers (scope is deliberately honest) ────────────────────\n *\n * 1. var(--…) check — COMPLETE. Every `var(--name)` literal in the scanned\n * source (inline styles, `bg-[var(--name)]` arbitrary Tailwind values, CSS\n * template strings) is matched and compared against the defined token set.\n * This is exact: a `var(--x)` reference is unambiguous. It is a raw-text\n * scan (no AST), so a `var(--x)` written inside a comment or string literal\n * counts too — deliberate: it keeps the single-source logic identical to the\n * agent-app self-test, and a dangling `var(--x)` in a comment is a smell\n * worth surfacing. Suppress a deliberate one with `allowlist`.\n *\n * 2. Tailwind-utility check — INTENTIONALLY PARTIAL. Bare classes like\n * `bg-card` carry no `var(--)` and so are invisible to check 1; Tailwind\n * resolves them to `hsl(var(--card))` at build via the preset. Fully\n * resolving arbitrary Tailwind config is out of scope (it would mean\n * re-implementing Tailwind). Instead we check the SPECIFIC known-dangerous\n * families that have actually shipped invisible: the MD3 surface ladder\n * (`surface-container` / `-high` / `-highest`) and the `card` / `popover`\n * elevation pairs — exactly the utilities the agent-app tailwind-preset\n * registers onto elevation tokens (see src/theme/tailwind-preset.ts, the\n * source of truth for this mapping). The canvas/sequence aliases\n * (`--bg-input`, `--text-primary`, …) are consumed as `bg-[var(--…)]`\n * arbitrary values and so are already covered fully by check 1 — they need\n * no entry here.\n *\n * Node-only (reads the filesystem) → this lives in the `./theme-contract`\n * subpath, NOT `./theme`, which must stay browser-clean (it's in the\n * browser-safe manifest test).\n */\n\nimport { existsSync, readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { dirname, relative, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { walkSources } from '../legibility/walk-sources'\n\n/** Define options for scanning source directories and CSS token files in a theme contract */\nexport interface ThemeContractOptions {\n /** Consumer source directories to scan for token references (recursively). */\n srcDirs: string[]\n /**\n * Path to the base tokens.css whose `--name:` definitions are the ground\n * truth. Defaults to the tokens.css agent-app ships (`./styles`) — the set a\n * consumer gets from `import '@tangle-network/agent-app/styles'`.\n */\n tokensCss?: string\n /**\n * Additional CSS files whose `--name:` definitions also count as defined —\n * the app's own overrides/extensions layered on top of the base tokens.\n */\n extraTokensCss?: string[]\n /**\n * Token names (e.g. `--my-app-accent`) to treat as always-defined, suppressing\n * them from the missing list. For app-specific vars defined outside any CSS\n * the checker can see (injected at runtime, from a third-party stylesheet, …).\n */\n allowlist?: string[]\n}\n\n/** Describe a missing theme contract variable and where it was referenced */\nexport interface ThemeContractMiss {\n /** The undefined custom property, e.g. `--popover`. */\n varName: string\n /**\n * Where it was referenced: `path/to/file.tsx`, or\n * `path/to/file.tsx (via bg-surface-container-high)` when the reference is a\n * Tailwind utility that resolves to the token rather than a literal var().\n */\n referencedIn: string\n}\n\n/** Describe the result of validating a theme contract including success status and missing items */\nexport interface ThemeContractResult {\n ok: boolean\n missing: ThemeContractMiss[]\n}\n\n/**\n * Known-dangerous Tailwind utility families and the elevation token each\n * resolves to, mirroring src/theme/tailwind-preset.ts. Ordered longest-suffix\n * first so `surface-container-highest` is matched before `surface-container`.\n * The negative look-around in {@link buildUtilityRe} makes ordering belt-and-\n * suspenders rather than load-bearing.\n */\nconst DANGEROUS_UTILITIES: ReadonlyArray<{ suffix: string; varName: string }> = [\n { suffix: 'surface-container-highest', varName: '--md3-surface-container-highest' },\n { suffix: 'surface-container-high', varName: '--md3-surface-container-high' },\n { suffix: 'surface-container', varName: '--md3-surface-container' },\n { suffix: 'card-foreground', varName: '--card-foreground' },\n { suffix: 'popover-foreground', varName: '--popover-foreground' },\n { suffix: 'card', varName: '--card' },\n { suffix: 'popover', varName: '--popover' },\n]\n\n/** Tailwind color-utility prefixes that can carry a background/text/border color. */\nconst UTILITY_PREFIXES = 'bg|text|border|ring|fill|stroke'\n\n/**\n * Match a whole utility class for `suffix`, tolerant of variants (`hover:`,\n * `dark:`) and opacity (`/95`) but not of longer siblings: the trailing\n * `(?![\\w-])` stops `bg-surface-container` from matching inside\n * `bg-surface-container-high`, and `bg-card` from matching inside\n * `bg-card-foreground`.\n */\nfunction buildUtilityRe(suffix: string): RegExp {\n return new RegExp(`(?<![\\\\w-])(?:${UTILITY_PREFIXES})-${suffix}(?![\\\\w-])`, 'g')\n}\n\n/**\n * Every `--name:` DEFINITION across the given CSS files. A definition is\n * `--name:` at the start of a (trimmed) line; RHS references like\n * `hsl(var(--card))` are mid-line and are never counted as definitions.\n */\nfunction definedVars(cssFiles: string[]): Set<string> {\n const defs = new Set<string>()\n const visited = new Set<string>()\n const visit = (inputFile: string): void => {\n // CLI paths are relative to cwd; createRequire needs an absolute filename.\n const file = resolve(inputFile)\n if (visited.has(file)) return\n visited.add(file)\n let css: string\n try {\n css = readFileSync(file, 'utf8')\n } catch {\n return\n }\n for (const m of css.matchAll(/^\\s*(--[a-z0-9-]+)\\s*:/gim)) if (m[1]) defs.add(m[1])\n // Source tokens.css imports the published Brand sheet and its checked\n // projection. The packed public sheet has already inlined both. Follow\n // local imports here so the source and installed consumer see the same\n // definitions without making Brand a runtime dependency of the package.\n for (const m of css.matchAll(/@import\\s+['\"]([^'\"]+)['\"]/g)) {\n if (!m[1]) continue\n let imported: string\n try {\n imported = m[1].startsWith('.')\n ? resolve(dirname(file), m[1])\n : createRequire(file).resolve(m[1])\n } catch (error) {\n // CSS build tools can resolve packages/exports unavailable to Node\n // (e.g. tailwindcss). Keep scanning local definitions and imports;\n // references to any uncollected tokens still fail the contract.\n const code = (error as NodeJS.ErrnoException).code\n if (code === 'MODULE_NOT_FOUND' || code === 'ERR_PACKAGE_PATH_NOT_EXPORTED') continue\n throw error\n }\n visit(imported)\n }\n }\n for (const file of cssFiles) visit(file)\n return defs\n}\n\n/**\n * Default tokens.css: the one agent-app ships as `./styles`. Resolved relative\n * to this module's URL, but tolerant of where the bundler lands the running\n * code — tsup code-splits shared logic into a chunk at the dist ROOT, so the\n * tokens.css sits one directory DIFFERENTLY depending on layout:\n * - source (src/theme-contract/index.ts) → ../theme/tokens.css (src/theme)\n * - split chunk (dist/contract-*.js) → ./theme/tokens.css (dist/theme)\n * - unsplit entry (dist/theme-contract/index.js) → ../theme/tokens.css\n * Probe both and return the one that exists; fall back to the first for a\n * sensible error path if neither is present.\n */\nfunction defaultTokensCss(): string {\n const candidates = ['../theme/tokens.css', './theme/tokens.css'].map((rel) =>\n fileURLToPath(new URL(rel, import.meta.url)),\n )\n return candidates.find((p) => existsSync(p)) ?? candidates[0]!\n}\n\n/**\n * Check that every theme token a consumer's source references is actually\n * defined in the CSS that consumer ships. Returns the full missing set; the\n * caller decides how to fail (the bin exits non-zero on any miss).\n */\nexport function checkThemeContract(opts: ThemeContractOptions): ThemeContractResult {\n const tokensCss = opts.tokensCss ?? defaultTokensCss()\n const defined = definedVars([tokensCss, ...(opts.extraTokensCss ?? [])])\n const allow = new Set(opts.allowlist ?? [])\n const isDefined = (name: string) => defined.has(name) || allow.has(name)\n\n const files = opts.srcDirs.flatMap((dir) => walkSources(dir, ['.d.ts']))\n const utilityMatchers = DANGEROUS_UTILITIES.map((u) => ({ ...u, re: buildUtilityRe(u.suffix) }))\n\n // Dedupe by varName (literal check) and by varName+utility (utility check),\n // keeping the FIRST referencing file — enough to locate the offender without\n // drowning the report when one token is referenced across many files.\n const seenVar = new Map<string, string>()\n const seenUtility = new Map<string, string>()\n\n for (const file of files) {\n let text: string\n try {\n text = readFileSync(file, 'utf8')\n } catch {\n continue\n }\n const where = displayPath(file)\n\n // Check 1 — literal var(--…) references.\n for (const m of text.matchAll(/var\\(\\s*(--[a-z0-9-]+)/gi)) {\n const name = m[1]\n if (!name || isDefined(name) || seenVar.has(name)) continue\n seenVar.set(name, where)\n }\n\n // Check 2 — known-dangerous Tailwind utility classes.\n for (const u of utilityMatchers) {\n if (isDefined(u.varName)) continue\n const key = `${u.varName}::${u.suffix}`\n if (seenUtility.has(key)) continue\n u.re.lastIndex = 0\n if (u.re.test(text)) seenUtility.set(key, `${where} (via ${firstUtilityHit(text, u.suffix)})`)\n }\n }\n\n const missing: ThemeContractMiss[] = [\n ...[...seenVar].map(([varName, referencedIn]) => ({ varName, referencedIn })),\n ...[...seenUtility].map(([key, referencedIn]) => ({ varName: key.split('::')[0]!, referencedIn })),\n ]\n return { ok: missing.length === 0, missing }\n}\n\n/** The literal utility class (with prefix) first seen in `text` for `suffix`, for the report. */\nfunction firstUtilityHit(text: string, suffix: string): string {\n const m = buildUtilityRe(suffix).exec(text)\n return m?.[0] ?? `<utility>-${suffix}`\n}\n\n/** Path relative to cwd when it stays inside it, else the path as given — for readable reports. */\nfunction displayPath(file: string): string {\n const rel = relative(process.cwd(), file)\n return rel && !rel.startsWith('..') ? rel : file\n}\n"],"mappings":";;;;;AAgDA,SAAS,YAAY,oBAAoB;AACzC,SAAS,qBAAqB;AAC9B,SAAS,SAAS,UAAU,eAAe;AAC3C,SAAS,qBAAqB;AAmD9B,IAAM,sBAA0E;AAAA,EAC9E,EAAE,QAAQ,6BAA6B,SAAS,kCAAkC;AAAA,EAClF,EAAE,QAAQ,0BAA0B,SAAS,+BAA+B;AAAA,EAC5E,EAAE,QAAQ,qBAAqB,SAAS,0BAA0B;AAAA,EAClE,EAAE,QAAQ,mBAAmB,SAAS,oBAAoB;AAAA,EAC1D,EAAE,QAAQ,sBAAsB,SAAS,uBAAuB;AAAA,EAChE,EAAE,QAAQ,QAAQ,SAAS,SAAS;AAA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C,GAAG,CAAC,GAAG,OAAO,EAAE,IAAI,CAAC,CAAC,SAAS,YAAY,OAAO,EAAE,SAAS,aAAa,EAAE;AAAA,IAC5E,GAAG,CAAC,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC,KAAK,YAAY,OAAO,EAAE,SAAS,IAAI,MAAM,IAAI,EAAE,CAAC,GAAI,aAAa,EAAE;AAAA,EACnG;AACA,SAAO,EAAE,IAAI,QAAQ,WAAW,GAAG,QAAQ;AAC7C;AAGA,SAAS,gBAAgB,MAAc,QAAwB;AAC7D,QAAM,IAAI,eAAe,MAAM,EAAE,KAAK,IAAI;AAC1C,SAAO,IAAI,CAAC,KAAK,aAAa,MAAM;AACtC;AAGA,SAAS,YAAY,MAAsB;AACzC,QAAM,MAAM,SAAS,QAAQ,IAAI,GAAG,IAAI;AACxC,SAAO,OAAO,CAAC,IAAI,WAAW,IAAI,IAAI,MAAM;AAC9C;","names":[]}
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-YJYPXMDL.js";
8
8
  import {
9
9
  lightTheme
10
- } from "./chunk-TUGR3FCS.js";
10
+ } from "./chunk-F5CCOBCU.js";
11
11
  import {
12
12
  DEFAULT_INSERT_TEMPLATES,
13
13
  collectGridTargets,
@@ -1948,4 +1948,4 @@ export {
1948
1948
  Workspace,
1949
1949
  DesignCanvasEditor
1950
1950
  };
1951
- //# sourceMappingURL=chunk-YFGV5ZBY.js.map
1951
+ //# sourceMappingURL=chunk-O627ODGW.js.map
@@ -1,7 +1,7 @@
1
1
  // src/design-canvas-react/lazy.tsx
2
2
  import { lazy } from "react";
3
3
  var DesignCanvasLazy = lazy(
4
- () => import("./DesignCanvasEditor-ZQDWOGRV.js").then((m) => ({ default: m.DesignCanvasEditor }))
4
+ () => import("./DesignCanvasEditor-AG5TXCE4.js").then((m) => ({ default: m.DesignCanvasEditor }))
5
5
  );
6
6
  var DesignCanvasChromeLazy = lazy(
7
7
  () => import("./DesignCanvas-BVBMDXBZ.js").then((m) => ({ default: m.DesignCanvas }))
@@ -11,4 +11,4 @@ export {
11
11
  DesignCanvasLazy,
12
12
  DesignCanvasChromeLazy
13
13
  };
14
- //# sourceMappingURL=chunk-6JM5EWOP.js.map
14
+ //# sourceMappingURL=chunk-P3UEWQGE.js.map
@@ -6,7 +6,7 @@ import {
6
6
  buildAppToolOpenAITools,
7
7
  findCustomTool,
8
8
  isAppToolName
9
- } from "./chunk-5GYKS6WT.js";
9
+ } from "./chunk-E6SY7ILK.js";
10
10
  import {
11
11
  base64UrlDecodeText,
12
12
  base64UrlEncodeText,
@@ -15,10 +15,10 @@ import {
15
15
  } from "./chunk-S5SRJJQG.js";
16
16
  import {
17
17
  assertRenderUiSchema
18
- } from "./chunk-LFMP73W3.js";
18
+ } from "./chunk-3RJGWWVS.js";
19
19
  import {
20
20
  ToolInputError
21
- } from "./chunk-T52MKPHE.js";
21
+ } from "./chunk-IZ52E7V4.js";
22
22
 
23
23
  // src/tools/capability.ts
24
24
  async function createCapabilityToken(userId, opts) {
@@ -270,4 +270,4 @@ export {
270
270
  createAppToolRuntimeExecutor,
271
271
  handleAppToolRequest
272
272
  };
273
- //# sourceMappingURL=chunk-P2GXQRFR.js.map
273
+ //# sourceMappingURL=chunk-XQGON2X2.js.map
@@ -12,7 +12,7 @@ import {
12
12
  downloadDataUrl,
13
13
  exportDocumentJson,
14
14
  exportPageDataUrl
15
- } from "../chunk-YFGV5ZBY.js";
15
+ } from "../chunk-O627ODGW.js";
16
16
  import {
17
17
  BTN,
18
18
  BTN_ACTIVE,
@@ -42,7 +42,7 @@ import {
42
42
  formatRulerLabel,
43
43
  selectTickStep
44
44
  } from "../chunk-YJYPXMDL.js";
45
- import "../chunk-TUGR3FCS.js";
45
+ import "../chunk-F5CCOBCU.js";
46
46
  import "../chunk-ZN5J47UX.js";
47
47
  import {
48
48
  DEFAULT_INSERT_TEMPLATES,
@@ -88,7 +88,7 @@ import {
88
88
  import {
89
89
  DesignCanvasChromeLazy,
90
90
  DesignCanvasLazy
91
- } from "../chunk-6JM5EWOP.js";
91
+ } from "../chunk-P3UEWQGE.js";
92
92
  import {
93
93
  assertSceneMediaSrc,
94
94
  bleedAwareExportBounds,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DesignCanvasChromeLazy,
3
3
  DesignCanvasLazy
4
- } from "../chunk-6JM5EWOP.js";
4
+ } from "../chunk-P3UEWQGE.js";
5
5
  export {
6
6
  DesignCanvasChromeLazy,
7
7
  DesignCanvasLazy
@@ -6,8 +6,8 @@ import {
6
6
  } from "../chunk-4ZJYNI53.js";
7
7
  import {
8
8
  assertRenderUiSchema
9
- } from "../chunk-LFMP73W3.js";
10
- import "../chunk-T52MKPHE.js";
9
+ } from "../chunk-3RJGWWVS.js";
10
+ import "../chunk-IZ52E7V4.js";
11
11
 
12
12
  // src/preset-cloudflare/workflow-instance.ts
13
13
  async function ensureCloudflareWorkflowInstance(binding, input) {
@@ -103,13 +103,13 @@ import {
103
103
  } from "../chunk-4KFM7VTH.js";
104
104
  import "../chunk-MCYJON3F.js";
105
105
  import "../chunk-LWSJK546.js";
106
- import "../chunk-P2GXQRFR.js";
106
+ import "../chunk-XQGON2X2.js";
107
107
  import "../chunk-6A7MYOUI.js";
108
- import "../chunk-5GYKS6WT.js";
108
+ import "../chunk-E6SY7ILK.js";
109
109
  import "../chunk-UGWQLQDS.js";
110
110
  import "../chunk-S5SRJJQG.js";
111
- import "../chunk-LFMP73W3.js";
112
- import "../chunk-T52MKPHE.js";
111
+ import "../chunk-3RJGWWVS.js";
112
+ import "../chunk-IZ52E7V4.js";
113
113
  import "../chunk-CP36C5LZ.js";
114
114
  export {
115
115
  DEFAULT_FOREGROUND_PROVISION_CLAIM_TTL_SECONDS,
@@ -1,5 +1,5 @@
1
1
  /** GENERATED from @tangle-network/brand/styles/legacy-light.css
2
- * SHA-256: c1411109214534804065fd37bb08a206bd2bc3307afd8755765a78c2f8b82177
2
+ * SHA-256: cd9b9142839d244a7515c2d0325f5dfa990997fa2afaeef314f3dc7e83a3adb2
3
3
  * Run node src/theme/build.mjs --write; do not edit colors or ratios here. */
4
4
  export declare const brandThemes: {
5
5
  readonly light: {
@@ -3,7 +3,7 @@ import {
3
3
  lightTheme,
4
4
  themeColor,
5
5
  themeToCssVars
6
- } from "../chunk-TUGR3FCS.js";
6
+ } from "../chunk-F5CCOBCU.js";
7
7
  export {
8
8
  darkTheme,
9
9
  lightTheme,
@@ -7,7 +7,7 @@
7
7
  @layer theme, base, components, utilities;
8
8
  @layer theme{/* GENERATED by scripts/gen-compat.mjs. Do not edit.
9
9
  * Source: tokens.css + named-themes.css
10
- * SHA-256: 957b639bc2d9a12d2739d744f33d8e031d4a3eb5ff56541431825335b2b3ad5f
10
+ * SHA-256: b64dbb9e556b1004d80e40b70ac487da2695bd6f4d59a0d91c39278261570d62
11
11
  * Light-default compatibility; all explicit modes remain canonical.
12
12
  */
13
13
  :where(:root),
@@ -128,24 +128,80 @@
128
128
  --surface-success-bg: #2f5146;
129
129
  --surface-success-border: #3c7760;
130
130
  --surface-success-text: #5ed7a4;
131
- --surface-warning-bg: #6a402c;
132
- --surface-warning-border: #916436;
131
+ --surface-warning-bg: #4b4232;
132
+ --surface-warning-border: #7a6236;
133
133
  --surface-warning-text: #f4c14f;
134
- --surface-danger-bg: #733b36;
135
- --surface-danger-border: #9a5b56;
134
+ --surface-danger-bg: #5a3b40;
135
+ --surface-danger-border: #7d4d53;
136
136
  --surface-danger-text: #ffada9;
137
137
  --surface-info-bg: #2d4e67;
138
138
  --surface-info-border: #3d7292;
139
139
  --surface-info-text: #67cdff;
140
- --surface-teal-bg: #042f2e;
141
- --surface-teal-border: #134e4a;
142
- --surface-teal-text: #2dd4bf;
143
- --surface-violet-bg: #1e1b4b;
144
- --surface-violet-border: #3730a3;
145
- --surface-violet-text: #B8B2F5;
146
- --surface-orange-bg: #431407;
147
- --surface-orange-border: #7c2d12;
148
- --surface-orange-text: #fb923c;
140
+ --tone-violet-bg: #4e3a60;
141
+ --tone-violet-bg-hover: #583d71;
142
+ --tone-violet-bg-selected: #624080;
143
+ --tone-violet-border: #8457aa;
144
+ --tone-violet-border-selected: #d19dff;
145
+ --tone-violet-text: #ecd9fa;
146
+ --tone-violet-icon: #d19dff;
147
+ --tone-orange-bg: #583c2b;
148
+ --tone-orange-bg-hover: #664029;
149
+ --tone-orange-bg-selected: #724327;
150
+ --tone-orange-border: #a35829;
151
+ --tone-orange-border-selected: #ff801f;
152
+ --tone-orange-text: #ffe0c2;
153
+ --tone-orange-icon: #ff801f;
154
+ --tone-teal-bg: #2a4744;
155
+ --tone-teal-bg-hover: #28504b;
156
+ --tone-teal-bg-selected: #265751;
157
+ --tone-teal-border: #207e73;
158
+ --tone-teal-border-selected: #0eb39e;
159
+ --tone-teal-text: #adf0dd;
160
+ --tone-teal-icon: #0eb39e;
161
+ --tone-blue-bg: #25455e;
162
+ --tone-blue-bg-hover: #224c6c;
163
+ --tone-blue-bg-selected: #1f537b;
164
+ --tone-blue-border: #2870bd;
165
+ --tone-blue-border-selected: #70b8ff;
166
+ --tone-blue-text: #c2e6ff;
167
+ --tone-blue-icon: #70b8ff;
168
+ --tone-pink-bg: #5e344f;
169
+ --tone-pink-bg-hover: #6d3659;
170
+ --tone-pink-bg-selected: #7b3762;
171
+ --tone-pink-border: #a84885;
172
+ --tone-pink-border-selected: #ff8dcc;
173
+ --tone-pink-text: #fdd1ea;
174
+ --tone-pink-icon: #ff8dcc;
175
+ --tone-brown-bg: #494038;
176
+ --tone-brown-bg-hover: #54473c;
177
+ --tone-brown-bg-selected: #5c4c3e;
178
+ --tone-brown-border: #7c5f46;
179
+ --tone-brown-border-selected: #dbb594;
180
+ --tone-brown-text: #f2e1ca;
181
+ --tone-brown-icon: #dbb594;
182
+ --tone-cyan-bg: #27464d;
183
+ --tone-cyan-bg-hover: #234f59;
184
+ --tone-cyan-bg-selected: #205662;
185
+ --tone-cyan-border: #11809c;
186
+ --tone-cyan-border-selected: #23afd0;
187
+ --tone-cyan-text: #b6ecf7;
188
+ --tone-cyan-icon: #23afd0;
189
+ --tone-lime-bg: #404536;
190
+ --tone-lime-bg-hover: #444b37;
191
+ --tone-lime-bg-selected: #495239;
192
+ --tone-lime-border: #577538;
193
+ --tone-lime-border-selected: #bdee63;
194
+ --tone-lime-text: #e3f7ba;
195
+ --tone-lime-icon: #bdee63;
196
+ --surface-violet-bg: #4e3a60;
197
+ --surface-violet-border: #8457aa;
198
+ --surface-violet-text: #d19dff;
199
+ --surface-orange-bg: #583c2b;
200
+ --surface-orange-border: #a35829;
201
+ --surface-orange-text: #ffa057;
202
+ --surface-teal-bg: #2a4744;
203
+ --surface-teal-border: #207e73;
204
+ --surface-teal-text: #0bd8b6;
149
205
  --run-mix-succeeded: #76edb9;
150
206
  --run-mix-waiting: #e9b642;
151
207
  --run-mix-failed: #e1918e;
@@ -398,15 +454,71 @@
398
454
  --surface-info-bg: #f0f9ff;
399
455
  --surface-info-border: #bae6fd;
400
456
  --surface-info-text: #0369a1;
401
- --surface-teal-bg: #f0fdfa;
402
- --surface-teal-border: #99f6e4;
403
- --surface-teal-text: #0f766e;
404
- --surface-violet-bg: #F0EEFF;
405
- --surface-violet-border: #C5C0F0;
406
- --surface-violet-text: #3E349E;
407
- --surface-orange-bg: #fff7ed;
408
- --surface-orange-border: #fed7aa;
409
- --surface-orange-text: #c2410c;
457
+ --tone-violet-bg: #f7edfe;
458
+ --tone-violet-bg-hover: #f2e2fc;
459
+ --tone-violet-bg-selected: #ead5f9;
460
+ --tone-violet-border: #e0c4f4;
461
+ --tone-violet-border-selected: #8e4ec6;
462
+ --tone-violet-text: #402060;
463
+ --tone-violet-icon: #8e4ec6;
464
+ --tone-orange-bg: #ffefd6;
465
+ --tone-orange-bg-hover: #ffdfb5;
466
+ --tone-orange-bg-selected: #ffd19a;
467
+ --tone-orange-border: #ffc182;
468
+ --tone-orange-border-selected: #cc4e00;
469
+ --tone-orange-text: #582d1d;
470
+ --tone-orange-icon: #cc4e00;
471
+ --tone-teal-bg: #e0f8f3;
472
+ --tone-teal-bg-hover: #ccf3ea;
473
+ --tone-teal-bg-selected: #b8eae0;
474
+ --tone-teal-border: #a1ded2;
475
+ --tone-teal-border-selected: #008573;
476
+ --tone-teal-text: #0d3d38;
477
+ --tone-teal-icon: #008573;
478
+ --tone-blue-bg: #e6f4fe;
479
+ --tone-blue-bg-hover: #d5efff;
480
+ --tone-blue-bg-selected: #c2e5ff;
481
+ --tone-blue-border: #acd8fc;
482
+ --tone-blue-border-selected: #0d74ce;
483
+ --tone-blue-text: #113264;
484
+ --tone-blue-icon: #0d74ce;
485
+ --tone-pink-bg: #fee9f5;
486
+ --tone-pink-bg-hover: #fbdcef;
487
+ --tone-pink-bg-selected: #f6cee7;
488
+ --tone-pink-border: #efbfdd;
489
+ --tone-pink-border-selected: #cf3897;
490
+ --tone-pink-text: #651249;
491
+ --tone-pink-icon: #cf3897;
492
+ --tone-brown-bg: #f6eee7;
493
+ --tone-brown-bg-hover: #f0e4d9;
494
+ --tone-brown-bg-selected: #ebdaca;
495
+ --tone-brown-border: #e4cdb7;
496
+ --tone-brown-border-selected: #815e46;
497
+ --tone-brown-text: #3e332e;
498
+ --tone-brown-icon: #815e46;
499
+ --tone-cyan-bg: #def7f9;
500
+ --tone-cyan-bg-hover: #caf1f6;
501
+ --tone-cyan-bg-selected: #b5e9f0;
502
+ --tone-cyan-border: #9ddde7;
503
+ --tone-cyan-border-selected: #107d98;
504
+ --tone-cyan-text: #0d3c48;
505
+ --tone-cyan-icon: #107d98;
506
+ --tone-lime-bg: #eef6d6;
507
+ --tone-lime-bg-hover: #e2f0bd;
508
+ --tone-lime-bg-selected: #d3e7a6;
509
+ --tone-lime-border: #c2da91;
510
+ --tone-lime-border-selected: #5c7c2f;
511
+ --tone-lime-text: #37401c;
512
+ --tone-lime-icon: #5c7c2f;
513
+ --surface-violet-bg: #f7edfe;
514
+ --surface-violet-border: #e0c4f4;
515
+ --surface-violet-text: #8145b5;
516
+ --surface-orange-bg: #ffefd6;
517
+ --surface-orange-border: #ffc182;
518
+ --surface-orange-text: #bc4904;
519
+ --surface-teal-bg: #e0f8f3;
520
+ --surface-teal-border: #a1ded2;
521
+ --surface-teal-text: #017d6d;
410
522
  --run-mix-succeeded: #3c9b78;
411
523
  --run-mix-waiting: #c16227;
412
524
  --run-mix-failed: #cd342f;
@@ -880,7 +992,7 @@
880
992
  }
881
993
  }
882
994
  @layer theme{/* GENERATED from @tangle-network/brand/styles/legacy-light.css
883
- * SHA-256: c1411109214534804065fd37bb08a206bd2bc3307afd8755765a78c2f8b82177
995
+ * SHA-256: cd9b9142839d244a7515c2d0325f5dfa990997fa2afaeef314f3dc7e83a3adb2
884
996
  * Run node src/theme/build.mjs --write; do not edit colors or ratios here. */
885
997
  :where(:root),
886
998
  [data-sandbox-ui],
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  checkThemeContract
4
- } from "../chunk-ZVNPAJ7Z.js";
4
+ } from "../chunk-LUKLQDIK.js";
5
5
  import "../chunk-EMLGWEHV.js";
6
6
  import {
7
7
  invokedAsScript
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  checkThemeContract
3
- } from "../chunk-ZVNPAJ7Z.js";
3
+ } from "../chunk-LUKLQDIK.js";
4
4
  import "../chunk-EMLGWEHV.js";
5
5
  export {
6
6
  checkThemeContract
@@ -9,7 +9,7 @@ import {
9
9
  restrictTaxonomy,
10
10
  verifyCapabilityToken,
11
11
  verifyExpiringCapabilityToken
12
- } from "../chunk-P2GXQRFR.js";
12
+ } from "../chunk-XQGON2X2.js";
13
13
  import {
14
14
  DEFAULT_APP_TOOL_PATHS,
15
15
  DEFAULT_HEADER_NAMES,
@@ -29,13 +29,13 @@ import {
29
29
  defineAppTool,
30
30
  findCustomTool,
31
31
  isAppToolName
32
- } from "../chunk-5GYKS6WT.js";
32
+ } from "../chunk-E6SY7ILK.js";
33
33
  import "../chunk-UGWQLQDS.js";
34
34
  import "../chunk-S5SRJJQG.js";
35
- import "../chunk-LFMP73W3.js";
35
+ import "../chunk-3RJGWWVS.js";
36
36
  import {
37
37
  ToolInputError
38
- } from "../chunk-T52MKPHE.js";
38
+ } from "../chunk-IZ52E7V4.js";
39
39
  export {
40
40
  APP_TOOL_NAMES,
41
41
  DEFAULT_APP_TOOL_PATHS,
@@ -4,11 +4,11 @@ import {
4
4
  } from "../chunk-GEYACSFW.js";
5
5
  import {
6
6
  defineAppTool
7
- } from "../chunk-5GYKS6WT.js";
7
+ } from "../chunk-E6SY7ILK.js";
8
8
  import "../chunk-UGWQLQDS.js";
9
9
  import {
10
10
  ToolInputError
11
- } from "../chunk-T52MKPHE.js";
11
+ } from "../chunk-IZ52E7V4.js";
12
12
  import {
13
13
  isWorkProductStatus,
14
14
  parseAgentCheckInput,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.53.9",
3
+ "version": "0.53.11",
4
4
  "packageManager": "pnpm@11.24.0",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [
@@ -606,11 +606,11 @@
606
606
  "@tangle-network/agent-knowledge": "19.0.1",
607
607
  "@tangle-network/agent-profile-materialize": "0.20.1",
608
608
  "@tangle-network/agent-runtime": "0.293.0",
609
- "@tangle-network/brand": "1.10.1",
609
+ "@tangle-network/brand": "1.11.0",
610
610
  "@tangle-network/hub-sdk": "0.24.0",
611
611
  "@tangle-network/sandbox": "0.60.10",
612
- "@tangle-network/sandbox-ui": "0.122.0",
613
- "@tangle-network/ui": "11.16.5",
612
+ "@tangle-network/sandbox-ui": "0.124.0",
613
+ "@tangle-network/ui": "11.17.0",
614
614
  "@testing-library/dom": "^10.4.1",
615
615
  "@testing-library/react": "^16.3.3",
616
616
  "@testing-library/user-event": "^14.6.6",
@@ -681,7 +681,7 @@
681
681
  "@tangle-network/brand": ">=1.6.0",
682
682
  "@tangle-network/hub-sdk": ">=0.19.3 <0.21.0 || >=0.21.0 <0.22.0 || >=0.22.1 <0.25.0",
683
683
  "@tangle-network/sandbox": ">=0.45.0 <0.48.0 || ^0.49.0 || ^0.50.0 || ^0.51.0 || ^0.52.0 || ^0.53.0 || ^0.54.0 || ^0.55.0 || >=0.58.1 <0.60.0 || >=0.60.3 <0.61.0",
684
- "@tangle-network/sandbox-ui": ">=0.117.0 <0.118.0 || >=0.119.0 <0.123.0",
684
+ "@tangle-network/sandbox-ui": ">=0.117.0 <0.118.0 || >=0.119.0 <0.125.0",
685
685
  "@tangle-network/ui": ">=11.11.3 <12.0.0",
686
686
  "@tiptap/core": ">=3.28.0 <4.0.0",
687
687
  "@tiptap/extension-mention": ">=3.28.0 <4.0.0",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/theme-contract/index.ts"],"sourcesContent":["/**\n * Exportable theme-token contract checker — the incident guard for the\n * invisible-popover class of bugs.\n *\n * The failure mode (tax-agent's transparent model dropdown; the whole\n * `bg-surface-container-*` family): a consumer app ships a component that\n * references a theme token — either as `var(--popover)` or as a Tailwind class\n * like `bg-surface-container-high` that the agent-app preset maps to\n * `hsl(var(--popover))` — but the app's OWN build never emits that custom\n * property (it forgot `import '@tangle-network/agent-app/styles'`, or dropped a\n * token in its local tokens.css). CSS resolves the missing var to nothing, the\n * surface paints transparent, and NOTHING errors. It ships invisible.\n *\n * `tests/theme/tokens-contract.test.ts` guards agent-app's OWN components. This\n * module lifts that walking logic into a function every CONSUMER app can run\n * against ITS OWN source in CI, comparing references to the tokens.css agent-app\n * ships plus any extra CSS the app defines.\n *\n * ── What each check covers (scope is deliberately honest) ────────────────────\n *\n * 1. var(--…) check — COMPLETE. Every `var(--name)` literal in the scanned\n * source (inline styles, `bg-[var(--name)]` arbitrary Tailwind values, CSS\n * template strings) is matched and compared against the defined token set.\n * This is exact: a `var(--x)` reference is unambiguous. It is a raw-text\n * scan (no AST), so a `var(--x)` written inside a comment or string literal\n * counts too — deliberate: it keeps the single-source logic identical to the\n * agent-app self-test, and a dangling `var(--x)` in a comment is a smell\n * worth surfacing. Suppress a deliberate one with `allowlist`.\n *\n * 2. Tailwind-utility check — INTENTIONALLY PARTIAL. Bare classes like\n * `bg-card` carry no `var(--)` and so are invisible to check 1; Tailwind\n * resolves them to `hsl(var(--card))` at build via the preset. Fully\n * resolving arbitrary Tailwind config is out of scope (it would mean\n * re-implementing Tailwind). Instead we check the SPECIFIC known-dangerous\n * families that have actually shipped invisible: the MD3 surface ladder\n * (`surface-container` / `-high` / `-highest`) and the `card` / `popover`\n * elevation pairs — exactly the utilities the agent-app tailwind-preset\n * registers onto elevation tokens (see src/theme/tailwind-preset.ts, the\n * source of truth for this mapping). The canvas/sequence aliases\n * (`--bg-input`, `--text-primary`, …) are consumed as `bg-[var(--…)]`\n * arbitrary values and so are already covered fully by check 1 — they need\n * no entry here.\n *\n * Node-only (reads the filesystem) → this lives in the `./theme-contract`\n * subpath, NOT `./theme`, which must stay browser-clean (it's in the\n * browser-safe manifest test).\n */\n\nimport { existsSync, readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { dirname, relative, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { walkSources } from '../legibility/walk-sources'\n\n/** Define options for scanning source directories and CSS token files in a theme contract */\nexport interface ThemeContractOptions {\n /** Consumer source directories to scan for token references (recursively). */\n srcDirs: string[]\n /**\n * Path to the base tokens.css whose `--name:` definitions are the ground\n * truth. Defaults to the tokens.css agent-app ships (`./styles`) — the set a\n * consumer gets from `import '@tangle-network/agent-app/styles'`.\n */\n tokensCss?: string\n /**\n * Additional CSS files whose `--name:` definitions also count as defined —\n * the app's own overrides/extensions layered on top of the base tokens.\n */\n extraTokensCss?: string[]\n /**\n * Token names (e.g. `--my-app-accent`) to treat as always-defined, suppressing\n * them from the missing list. For app-specific vars defined outside any CSS\n * the checker can see (injected at runtime, from a third-party stylesheet, …).\n */\n allowlist?: string[]\n}\n\n/** Describe a missing theme contract variable and where it was referenced */\nexport interface ThemeContractMiss {\n /** The undefined custom property, e.g. `--popover`. */\n varName: string\n /**\n * Where it was referenced: `path/to/file.tsx`, or\n * `path/to/file.tsx (via bg-surface-container-high)` when the reference is a\n * Tailwind utility that resolves to the token rather than a literal var().\n */\n referencedIn: string\n}\n\n/** Describe the result of validating a theme contract including success status and missing items */\nexport interface ThemeContractResult {\n ok: boolean\n missing: ThemeContractMiss[]\n}\n\n/**\n * Known-dangerous Tailwind utility families and the elevation token each\n * resolves to, mirroring src/theme/tailwind-preset.ts. Ordered longest-suffix\n * first so `surface-container-highest` is matched before `surface-container`.\n * The negative look-around in {@link buildUtilityRe} makes ordering belt-and-\n * suspenders rather than load-bearing.\n */\nconst DANGEROUS_UTILITIES: ReadonlyArray<{ suffix: string; varName: string }> = [\n { suffix: 'surface-container-highest', varName: '--md3-surface-container-highest' },\n { suffix: 'surface-container-high', varName: '--md3-surface-container-high' },\n { suffix: 'surface-container', varName: '--md3-surface-container' },\n { suffix: 'card-foreground', varName: '--card-foreground' },\n { suffix: 'popover-foreground', varName: '--popover-foreground' },\n { suffix: 'card', varName: '--card' },\n { suffix: 'popover', varName: '--popover' },\n]\n\n/** Tailwind color-utility prefixes that can carry a background/text/border color. */\nconst UTILITY_PREFIXES = 'bg|text|border|ring|fill|stroke'\n\n/**\n * Match a whole utility class for `suffix`, tolerant of variants (`hover:`,\n * `dark:`) and opacity (`/95`) but not of longer siblings: the trailing\n * `(?![\\w-])` stops `bg-surface-container` from matching inside\n * `bg-surface-container-high`, and `bg-card` from matching inside\n * `bg-card-foreground`.\n */\nfunction buildUtilityRe(suffix: string): RegExp {\n return new RegExp(`(?<![\\\\w-])(?:${UTILITY_PREFIXES})-${suffix}(?![\\\\w-])`, 'g')\n}\n\n/**\n * Every `--name:` DEFINITION across the given CSS files. A definition is\n * `--name:` at the start of a (trimmed) line; RHS references like\n * `hsl(var(--card))` are mid-line and are never counted as definitions.\n */\nfunction definedVars(cssFiles: string[]): Set<string> {\n const defs = new Set<string>()\n const visited = new Set<string>()\n const visit = (file: string): void => {\n if (visited.has(file)) return\n visited.add(file)\n let css: string\n try {\n css = readFileSync(file, 'utf8')\n } catch {\n return\n }\n for (const m of css.matchAll(/^\\s*(--[a-z0-9-]+)\\s*:/gim)) if (m[1]) defs.add(m[1])\n // Source tokens.css imports the published Brand sheet and its checked\n // projection. The packed public sheet has already inlined both. Follow\n // local imports here so the source and installed consumer see the same\n // definitions without making Brand a runtime dependency of the package.\n for (const m of css.matchAll(/@import\\s+['\"]([^'\"]+)['\"]/g)) {\n if (!m[1]) continue\n const imported = m[1].startsWith('.')\n ? resolve(dirname(file), m[1])\n : createRequire(file).resolve(m[1])\n visit(imported)\n }\n }\n for (const file of cssFiles) visit(file)\n return defs\n}\n\n/**\n * Default tokens.css: the one agent-app ships as `./styles`. Resolved relative\n * to this module's URL, but tolerant of where the bundler lands the running\n * code — tsup code-splits shared logic into a chunk at the dist ROOT, so the\n * tokens.css sits one directory DIFFERENTLY depending on layout:\n * - source (src/theme-contract/index.ts) → ../theme/tokens.css (src/theme)\n * - split chunk (dist/contract-*.js) → ./theme/tokens.css (dist/theme)\n * - unsplit entry (dist/theme-contract/index.js) → ../theme/tokens.css\n * Probe both and return the one that exists; fall back to the first for a\n * sensible error path if neither is present.\n */\nfunction defaultTokensCss(): string {\n const candidates = ['../theme/tokens.css', './theme/tokens.css'].map((rel) =>\n fileURLToPath(new URL(rel, import.meta.url)),\n )\n return candidates.find((p) => existsSync(p)) ?? candidates[0]!\n}\n\n/**\n * Check that every theme token a consumer's source references is actually\n * defined in the CSS that consumer ships. Returns the full missing set; the\n * caller decides how to fail (the bin exits non-zero on any miss).\n */\nexport function checkThemeContract(opts: ThemeContractOptions): ThemeContractResult {\n const tokensCss = opts.tokensCss ?? defaultTokensCss()\n const defined = definedVars([tokensCss, ...(opts.extraTokensCss ?? [])])\n const allow = new Set(opts.allowlist ?? [])\n const isDefined = (name: string) => defined.has(name) || allow.has(name)\n\n const files = opts.srcDirs.flatMap((dir) => walkSources(dir, ['.d.ts']))\n const utilityMatchers = DANGEROUS_UTILITIES.map((u) => ({ ...u, re: buildUtilityRe(u.suffix) }))\n\n // Dedupe by varName (literal check) and by varName+utility (utility check),\n // keeping the FIRST referencing file — enough to locate the offender without\n // drowning the report when one token is referenced across many files.\n const seenVar = new Map<string, string>()\n const seenUtility = new Map<string, string>()\n\n for (const file of files) {\n let text: string\n try {\n text = readFileSync(file, 'utf8')\n } catch {\n continue\n }\n const where = displayPath(file)\n\n // Check 1 — literal var(--…) references.\n for (const m of text.matchAll(/var\\(\\s*(--[a-z0-9-]+)/gi)) {\n const name = m[1]\n if (!name || isDefined(name) || seenVar.has(name)) continue\n seenVar.set(name, where)\n }\n\n // Check 2 — known-dangerous Tailwind utility classes.\n for (const u of utilityMatchers) {\n if (isDefined(u.varName)) continue\n const key = `${u.varName}::${u.suffix}`\n if (seenUtility.has(key)) continue\n u.re.lastIndex = 0\n if (u.re.test(text)) seenUtility.set(key, `${where} (via ${firstUtilityHit(text, u.suffix)})`)\n }\n }\n\n const missing: ThemeContractMiss[] = [\n ...[...seenVar].map(([varName, referencedIn]) => ({ varName, referencedIn })),\n ...[...seenUtility].map(([key, referencedIn]) => ({ varName: key.split('::')[0]!, referencedIn })),\n ]\n return { ok: missing.length === 0, missing }\n}\n\n/** The literal utility class (with prefix) first seen in `text` for `suffix`, for the report. */\nfunction firstUtilityHit(text: string, suffix: string): string {\n const m = buildUtilityRe(suffix).exec(text)\n return m?.[0] ?? `<utility>-${suffix}`\n}\n\n/** Path relative to cwd when it stays inside it, else the path as given — for readable reports. */\nfunction displayPath(file: string): string {\n const rel = relative(process.cwd(), file)\n return rel && !rel.startsWith('..') ? rel : file\n}\n"],"mappings":";;;;;AAgDA,SAAS,YAAY,oBAAoB;AACzC,SAAS,qBAAqB;AAC9B,SAAS,SAAS,UAAU,eAAe;AAC3C,SAAS,qBAAqB;AAmD9B,IAAM,sBAA0E;AAAA,EAC9E,EAAE,QAAQ,6BAA6B,SAAS,kCAAkC;AAAA,EAClF,EAAE,QAAQ,0BAA0B,SAA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