@fias/arche-sdk 2.32.0 → 2.33.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/dist/index.mjs CHANGED
@@ -73,6 +73,24 @@ var LIGHT_THEME = {
73
73
  function getDefaultTheme(mode) {
74
74
  return mode === "light" ? LIGHT_THEME : DARK_THEME;
75
75
  }
76
+ var BRAND_HEX = /^#[0-9a-fA-F]{6}$/;
77
+ var BRAND_LOGO_URL_MAX = 256 * 1024;
78
+ var BRAND_NAME_MAX = 200;
79
+ function normalizeFiasBrand(input) {
80
+ if (!input || typeof input !== "object") return void 0;
81
+ const raw = input;
82
+ const color = (v) => typeof v === "string" && BRAND_HEX.test(v) ? v : null;
83
+ const name = typeof raw.displayName === "string" && raw.displayName.trim() !== "" ? raw.displayName.trim().slice(0, BRAND_NAME_MAX) : null;
84
+ const logo = typeof raw.logoUrl === "string" && raw.logoUrl.length <= BRAND_LOGO_URL_MAX && (raw.logoUrl.startsWith("data:image/") || raw.logoUrl.startsWith("https://")) ? raw.logoUrl : null;
85
+ const brand = {
86
+ displayName: name,
87
+ logoUrl: logo,
88
+ primaryColor: color(raw.primaryColor),
89
+ accentColor: color(raw.accentColor),
90
+ headerTextColor: color(raw.headerTextColor)
91
+ };
92
+ return Object.values(brand).some((v) => v !== null) ? brand : void 0;
93
+ }
76
94
 
77
95
  // src/protocol.ts
78
96
  var SDK_BRIDGE_PROTOCOL_VERSION = 1;
@@ -258,6 +276,12 @@ function mergeThemeWithDefaults(incoming) {
258
276
  components: { ...defaults.components, ...incoming.components ?? {} }
259
277
  };
260
278
  }
279
+ function themeFromHost(incoming) {
280
+ const { brand: rawBrand, ...rest } = incoming;
281
+ const theme = mergeThemeWithDefaults(rest);
282
+ const brand = normalizeFiasBrand(rawBrand);
283
+ return brand ? { ...theme, brand } : theme;
284
+ }
261
285
  var DEFAULT_TIMEOUT_MS = 3e4;
262
286
  var STREAM_IDLE_TIMEOUT_MS = 12e4;
263
287
  var STREAM_MAX_DURATION_MS = 15 * 6e4;
@@ -332,7 +356,7 @@ var FiasBridge = class {
332
356
  this.hostOrigin = event.origin;
333
357
  this.archId = initMsg.payload.archId;
334
358
  this.permissions = initMsg.payload.permissions;
335
- this.theme = mergeThemeWithDefaults(initMsg.payload.theme);
359
+ this.theme = themeFromHost(initMsg.payload.theme);
336
360
  this.vendoredAssets = initMsg.payload.vendoredAssets ?? null;
337
361
  this.textModels = initMsg.payload.textModels ?? null;
338
362
  this.holder = initMsg.payload.holder ?? null;
@@ -354,7 +378,7 @@ var FiasBridge = class {
354
378
  }
355
379
  if (this.hostOrigin && event.origin !== this.hostOrigin) return;
356
380
  if (data.type === "theme_update") {
357
- this.theme = mergeThemeWithDefaults(data.payload);
381
+ this.theme = themeFromHost(data.payload);
358
382
  for (const listener of this.themeListeners) {
359
383
  listener(this.theme);
360
384
  }
@@ -1867,23 +1891,19 @@ function useFiasDataStore() {
1867
1891
  );
1868
1892
  const put = useCallback(
1869
1893
  async (collection, key, data, options) => {
1870
- const res = await invokeEntityOp(
1871
- bridge,
1872
- PLUGIN_DATASTORE_ENTITY_ID,
1873
- "put",
1874
- {
1875
- collection,
1876
- // No key: the server makes one (collections with audiences, ADR-034).
1877
- ...key !== null ? { key } : {},
1878
- data,
1879
- workspaceId: options?.workspaceId,
1880
- ...options?.audience !== void 0 ? { audience: options.audience } : {}
1881
- }
1882
- );
1894
+ const res = await invokeEntityOp(bridge, PLUGIN_DATASTORE_ENTITY_ID, "put", {
1895
+ collection,
1896
+ // No key: the server makes one (collections with audiences, ADR-034).
1897
+ ...key !== null ? { key } : {},
1898
+ data,
1899
+ workspaceId: options?.workspaceId,
1900
+ ...options?.audience !== void 0 ? { audience: options.audience } : {}
1901
+ });
1883
1902
  return {
1884
1903
  version: res?.version,
1885
1904
  ...res?.key !== void 0 ? { key: res.key } : {},
1886
- ...res?.audience !== void 0 ? { audience: res.audience } : {}
1905
+ ...res?.audience !== void 0 ? { audience: res.audience } : {},
1906
+ ...res?.attestation !== void 0 ? { attestation: res.attestation } : {}
1887
1907
  };
1888
1908
  },
1889
1909
  [bridge]
@@ -1933,7 +1953,8 @@ function useFiasDataStore() {
1933
1953
  updatedAt: res.updatedAt ?? "",
1934
1954
  ...res.version !== void 0 ? { version: res.version } : {},
1935
1955
  ...res.authoredByCollaborator !== void 0 ? { authoredByCollaborator: res.authoredByCollaborator } : {},
1936
- ...res.audience !== void 0 ? { audience: res.audience } : {}
1956
+ ...res.audience !== void 0 ? { audience: res.audience } : {},
1957
+ ...res.attestation !== void 0 ? { attestation: res.attestation } : {}
1937
1958
  };
1938
1959
  },
1939
1960
  [bridge]
@@ -3698,7 +3719,8 @@ function useFiasWebSources() {
3698
3719
  async (request) => invokeEntityOp(bridge, WEB_SOURCES_ENTITY_ID, "extract", {
3699
3720
  url: request.url,
3700
3721
  form: request.form,
3701
- ...request.maxAgeSeconds !== void 0 ? { maxAgeSeconds: request.maxAgeSeconds } : {}
3722
+ ...request.maxAgeSeconds !== void 0 ? { maxAgeSeconds: request.maxAgeSeconds } : {},
3723
+ ...request.reads !== void 0 ? { reads: request.reads } : {}
3702
3724
  }),
3703
3725
  [bridge]
3704
3726
  );
@@ -4072,6 +4094,7 @@ var VALID_PLUGIN_PERMISSIONS = [
4072
4094
  "assets:read",
4073
4095
  "connections:use",
4074
4096
  "data:agents",
4097
+ "data:attested",
4075
4098
  "data:search",
4076
4099
  "data:store",
4077
4100
  "data:workspace",
@@ -4115,6 +4138,7 @@ var PLUGIN_PERMISSION_DESCRIPTIONS = {
4115
4138
  "assets:read": "Show images and play sounds from this arche's published asset library.",
4116
4139
  "connections:use": "Use outside accounts (like X or LinkedIn) that you connect and let it use \u2014 you choose each account and each workspace, approve what it posts, and can take access away any time in Workspace Controls.",
4117
4140
  "data:agents": "Let Fias AI, and assistants you connect with an API key and allow here, read this arche's data \u2014 and change it where it says so \u2014 even while it is closed.",
4141
+ "data:attested": "Keep a record of which members did what in this app, written by Fias so the app can't change who did it.",
4118
4142
  "data:search": "Search this arche's own data semantically \u2014 costs credits per search.",
4119
4143
  "data:store": "Save structured data in this arche's own private database.",
4120
4144
  "data:workspace": "Create team workspaces and manage their members.",
@@ -4211,7 +4235,10 @@ var fias = {
4211
4235
  "put",
4212
4236
  { collection, key, data }
4213
4237
  );
4214
- return { version: res?.version };
4238
+ return {
4239
+ version: res?.version,
4240
+ ...res?.attestation !== void 0 ? { attestation: res.attestation } : {}
4241
+ };
4215
4242
  },
4216
4243
  async get(collection, key) {
4217
4244
  const res = await invokeEntityOp(
@@ -4232,7 +4259,8 @@ var fias = {
4232
4259
  data: res.data,
4233
4260
  updatedAt: res.updatedAt ?? "",
4234
4261
  ...res.version !== void 0 ? { version: res.version } : {},
4235
- ...res.authoredByCollaborator !== void 0 ? { authoredByCollaborator: res.authoredByCollaborator } : {}
4262
+ ...res.authoredByCollaborator !== void 0 ? { authoredByCollaborator: res.authoredByCollaborator } : {},
4263
+ ...res.attestation !== void 0 ? { attestation: res.attestation } : {}
4236
4264
  };
4237
4265
  },
4238
4266
  async query(collection, options) {
@@ -6766,6 +6794,7 @@ export {
6766
6794
  getThemeById,
6767
6795
  invocationPayloadByteLimit,
6768
6796
  isValidPluginPermission,
6797
+ normalizeFiasBrand,
6769
6798
  resetBridge,
6770
6799
  useArcheAssetBytes,
6771
6800
  useArcheAssets,
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=theme-brand.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-brand.test.d.ts","sourceRoot":"","sources":["../src/theme-brand.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const theme_1 = require("./theme");
4
+ describe('normalizeFiasBrand', () => {
5
+ const full = {
6
+ displayName: 'Service Ventures',
7
+ logoUrl: 'data:image/png;base64,AAAA',
8
+ primaryColor: '#080B35',
9
+ accentColor: '#77A7F7',
10
+ headerTextColor: '#FFFFFF',
11
+ };
12
+ it('keeps a well-formed brand as it is', () => {
13
+ expect((0, theme_1.normalizeFiasBrand)(full)).toEqual(full);
14
+ });
15
+ it('accepts an https logo and nulls anything else', () => {
16
+ expect((0, theme_1.normalizeFiasBrand)({ ...full, logoUrl: 'https://cdn.example/logo.png' })?.logoUrl).toBe('https://cdn.example/logo.png');
17
+ for (const logoUrl of ['http://x/logo.png', 'javascript:alert(1)', 'data:text/html,<b>', 42]) {
18
+ expect((0, theme_1.normalizeFiasBrand)({ ...full, logoUrl })?.logoUrl).toBeNull();
19
+ }
20
+ expect((0, theme_1.normalizeFiasBrand)({ ...full, logoUrl: `data:image/png;base64,${'A'.repeat(300000)}` })
21
+ ?.logoUrl).toBeNull();
22
+ });
23
+ it('only passes #RRGGBB colours', () => {
24
+ const brand = (0, theme_1.normalizeFiasBrand)({
25
+ ...full,
26
+ primaryColor: '#fff',
27
+ accentColor: 'blue',
28
+ headerTextColor: '#00ff00',
29
+ });
30
+ expect(brand).toMatchObject({
31
+ primaryColor: null,
32
+ accentColor: null,
33
+ headerTextColor: '#00ff00',
34
+ });
35
+ });
36
+ it('trims and bounds the name, and treats a blank one as unset', () => {
37
+ expect((0, theme_1.normalizeFiasBrand)({ ...full, displayName: ' ' })?.displayName).toBeNull();
38
+ expect((0, theme_1.normalizeFiasBrand)({ ...full, displayName: 'x'.repeat(500) })?.displayName).toHaveLength(200);
39
+ });
40
+ it('returns undefined when nothing is left to show', () => {
41
+ expect((0, theme_1.normalizeFiasBrand)(null)).toBeUndefined();
42
+ expect((0, theme_1.normalizeFiasBrand)('brand')).toBeUndefined();
43
+ expect((0, theme_1.normalizeFiasBrand)({})).toBeUndefined();
44
+ expect((0, theme_1.normalizeFiasBrand)({ primaryColor: 'navy', displayName: '' })).toBeUndefined();
45
+ });
46
+ });
47
+ //# sourceMappingURL=theme-brand.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-brand.test.js","sourceRoot":"","sources":["../src/theme-brand.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;SAC3B,CAAC,CAAC;QACH,MAAM,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC;YAC1B,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,IAAI;YACjB,eAAe,EAAE,SAAS;SAC3B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,CAAC,IAAA,0BAAkB,EAAC,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC;QACpF,MAAM,CAAC,IAAA,0BAAkB,EAAC,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC,YAAY,CAC7F,GAAG,CACJ,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,CAAC,IAAA,0BAAkB,EAAC,IAAI,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QACjD,MAAM,CAAC,IAAA,0BAAkB,EAAC,OAAO,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QACpD,MAAM,CAAC,IAAA,0BAAkB,EAAC,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QAC/C,MAAM,CAAC,IAAA,0BAAkB,EAAC,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IACxF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/dist/theme.d.ts CHANGED
@@ -11,8 +11,16 @@
11
11
  * - bridge routes (server-side fallback)
12
12
  * - arche-sdk tests
13
13
  */
14
- import type { FiasTheme } from './types';
14
+ import type { FiasBrand, FiasTheme } from './types';
15
15
  export declare const DARK_THEME: FiasTheme;
16
16
  export declare const LIGHT_THEME: FiasTheme;
17
17
  export declare function getDefaultTheme(mode: 'light' | 'dark'): FiasTheme;
18
+ /**
19
+ * A Company brand in the shape apps receive it (`FiasTheme.brand`), or
20
+ * `undefined` when there is nothing to show. Used by every host — the
21
+ * platform, the builder preview and the dev harness — and again by the SDK on
22
+ * what arrives, so an app can rely on the shape whoever sent it: colours are
23
+ * `#RRGGBB` or null, the logo is a `data:image/` or `https:` URL or null.
24
+ */
25
+ export declare function normalizeFiasBrand(input: unknown): FiasBrand | undefined;
18
26
  //# sourceMappingURL=theme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAkBzC,eAAO,MAAM,UAAU,EAAE,SAwBxB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,SAwBzB,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEjE"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAkBpD,eAAO,MAAM,UAAU,EAAE,SAwBxB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,SAwBzB,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEjE;AAOD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAsBxE"}
package/dist/theme.js CHANGED
@@ -15,6 +15,7 @@
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.LIGHT_THEME = exports.DARK_THEME = void 0;
17
17
  exports.getDefaultTheme = getDefaultTheme;
18
+ exports.normalizeFiasBrand = normalizeFiasBrand;
18
19
  const SYSTEM_FONTS = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
19
20
  const MONO_FONTS = '"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace';
20
21
  const SHARED_SPACING = { xs: '4px', sm: '8px', md: '16px', lg: '24px', xl: '32px' };
@@ -82,4 +83,37 @@ exports.LIGHT_THEME = {
82
83
  function getDefaultTheme(mode) {
83
84
  return mode === 'light' ? exports.LIGHT_THEME : exports.DARK_THEME;
84
85
  }
86
+ const BRAND_HEX = /^#[0-9a-fA-F]{6}$/;
87
+ /** Well above the platform's stored-logo cap (64 KB data URL); refuses a value nobody should draw. */
88
+ const BRAND_LOGO_URL_MAX = 256 * 1024;
89
+ const BRAND_NAME_MAX = 200;
90
+ /**
91
+ * A Company brand in the shape apps receive it (`FiasTheme.brand`), or
92
+ * `undefined` when there is nothing to show. Used by every host — the
93
+ * platform, the builder preview and the dev harness — and again by the SDK on
94
+ * what arrives, so an app can rely on the shape whoever sent it: colours are
95
+ * `#RRGGBB` or null, the logo is a `data:image/` or `https:` URL or null.
96
+ */
97
+ function normalizeFiasBrand(input) {
98
+ if (!input || typeof input !== 'object')
99
+ return undefined;
100
+ const raw = input;
101
+ const color = (v) => (typeof v === 'string' && BRAND_HEX.test(v) ? v : null);
102
+ const name = typeof raw.displayName === 'string' && raw.displayName.trim() !== ''
103
+ ? raw.displayName.trim().slice(0, BRAND_NAME_MAX)
104
+ : null;
105
+ const logo = typeof raw.logoUrl === 'string' &&
106
+ raw.logoUrl.length <= BRAND_LOGO_URL_MAX &&
107
+ (raw.logoUrl.startsWith('data:image/') || raw.logoUrl.startsWith('https://'))
108
+ ? raw.logoUrl
109
+ : null;
110
+ const brand = {
111
+ displayName: name,
112
+ logoUrl: logo,
113
+ primaryColor: color(raw.primaryColor),
114
+ accentColor: color(raw.accentColor),
115
+ headerTextColor: color(raw.headerTextColor),
116
+ };
117
+ return Object.values(brand).some((v) => v !== null) ? brand : undefined;
118
+ }
85
119
  //# sourceMappingURL=theme.js.map
package/dist/theme.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAwEH,0CAEC;AAtED,MAAM,YAAY,GAAG,mEAAmE,CAAC;AACzF,MAAM,UAAU,GAAG,iEAAiE,CAAC;AAErF,MAAM,cAAc,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;AACpF,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AACrF,MAAM,iBAAiB,GAA4B;IACjD,YAAY,EAAE,QAAQ;IACtB,YAAY,EAAE,UAAU;IACxB,UAAU,EAAE,QAAQ;IACpB,WAAW,EAAE,UAAU;IACvB,QAAQ,EAAE,iCAAiC;IAC3C,QAAQ,EAAE,sEAAsE;IAChF,QAAQ,EAAE,wEAAwE;IAClF,WAAW,EAAE,KAAK;CACnB,CAAC;AAEW,QAAA,UAAU,GAAc;IACnC,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE;QACN,OAAO,EAAE,SAAS;QAClB,WAAW,EAAE,SAAS;QACtB,SAAS,EAAE,SAAS;QACpB,MAAM,EAAE,SAAS;QACjB,UAAU,EAAE,SAAS;QACrB,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,SAAS;QACf,aAAa,EAAE,SAAS;QACxB,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,SAAS;QACpB,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,SAAS;QAClB,OAAO,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AAa,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAC3E,CAAC,CAAC,GAAG,CAAC,OAAO;QACb,CAAC,CAAC,IAAI,CAAC;IACX,MAAM,KAAK,GAAc;QACvB,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC;QACrC,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC;QACnC,eAAe,EAAE,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC;KAC5C,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1E,CAAC"}
package/dist/types.d.ts CHANGED
@@ -74,6 +74,30 @@ export interface FiasTheme {
74
74
  shadowLg: string;
75
75
  borderWidth: string;
76
76
  };
77
+ /**
78
+ * The Company's brand (ADR-023), present only while the app runs on that
79
+ * Company's portal (ADR-024) and the Company has set one. Absent on fias.io
80
+ * and on a portal without a brand — keep your own palette then. Each field
81
+ * is null when the Company left it unset.
82
+ */
83
+ brand?: FiasBrand;
84
+ }
85
+ /**
86
+ * A Company's brand as an app receives it in {@link FiasTheme.brand}. The same
87
+ * tokens the portal's own shell is drawn with, and already public on the
88
+ * portal: nothing here is about the person using the app.
89
+ */
90
+ export interface FiasBrand {
91
+ /** The name the Company shows people, e.g. on its sign-in page. */
92
+ displayName: string | null;
93
+ /** The Company's logo, as an image URL (today a `data:` URL) for an `<img src>`. */
94
+ logoUrl: string | null;
95
+ /** `#RRGGBB`. The Company's main colour — headers, primary buttons. */
96
+ primaryColor: string | null;
97
+ /** `#RRGGBB`. A second colour for highlights and links. */
98
+ accentColor: string | null;
99
+ /** `#RRGGBB`. Text drawn on `primaryColor`. */
100
+ headerTextColor: string | null;
77
101
  }
78
102
  /**
79
103
  * Storage API available via useFiasStorage() hook.
@@ -2200,6 +2224,17 @@ export interface FiasWebSourceExtractRequest {
2200
2224
  * whole platform, so anything under 3600 is treated as 3600.
2201
2225
  */
2202
2226
  maxAgeSeconds?: number;
2227
+ /**
2228
+ * How many independent readings the page gets (default 1). With `2`, the
2229
+ * page is read twice and only a value both readings agree on is returned;
2230
+ * a field they disagree on comes back `null` and is named in `disagreed`,
2231
+ * so you can put it in front of a person instead of publishing one
2232
+ * reading's guess. Agreement says a value was stable across two readings,
2233
+ * not that it is right. Two readings are two reader charges. Use it
2234
+ * wherever a wrong number matters, such as money. The platform may raise
2235
+ * the floor for every app.
2236
+ */
2237
+ reads?: 1 | 2;
2203
2238
  }
2204
2239
  export interface FiasWebSourceExtraction<T extends FiasWebSourceData = FiasWebSourceData> {
2205
2240
  url: string;
@@ -2218,8 +2253,24 @@ export interface FiasWebSourceExtraction<T extends FiasWebSourceData = FiasWebSo
2218
2253
  fromCache: boolean;
2219
2254
  /** The page's values, in the form's shape. */
2220
2255
  data: T;
2221
- /** Fields (and list rows) whose values broke the form's rules and became null or were dropped. */
2256
+ /**
2257
+ * Fields (and list rows) whose values broke the form's rules and became
2258
+ * null or were dropped: `rates[3].apy`, `rates[50..]`. With two readings a
2259
+ * list is named whole (`rates`): a row index belongs to one reading's rows,
2260
+ * and the agreed list no longer has them in that order.
2261
+ */
2222
2262
  discarded: string[];
2263
+ /**
2264
+ * Fields the two readings disagreed on: `null` instead of one reading's
2265
+ * value, or for a list only the rows both readings produced. Check it
2266
+ * whatever you asked for: the platform may require two readings of every
2267
+ * app, and a one-reading call is answered from a two-reading result when
2268
+ * one is already stored for the page and form. A list named here may be missing rows the page
2269
+ * prints: never conclude "absent on the page" (not offered, no such term)
2270
+ * from a field in `disagreed`; treat it as unknown and confirm with a
2271
+ * person.
2272
+ */
2273
+ disagreed: string[];
2223
2274
  /** The page was longer than the reader reads; values past the cut are missing. */
2224
2275
  pageTruncated: boolean;
2225
2276
  /**
@@ -2233,8 +2284,11 @@ export interface FiasWebSourcesApi {
2233
2284
  listSites: (options?: FiasWebSourceListOptions) => Promise<FiasWebSourceSiteList>;
2234
2285
  /**
2235
2286
  * A page on an approved site, read into `form`. A fresh fetch (about a
2236
- * tenth of a cent) and the reading (a fast model's tokens) are charged to
2237
- * the user; a cached result is free. Never returns the page's text.
2287
+ * tenth of a cent) and each reading (the reader model's tokens; two with
2288
+ * `reads: 2`) are charged to the user; a cached result is free. The reader's
2289
+ * model, and so a reading's price, is chosen by the platform (a fast model
2290
+ * today, well under a cent for a typical page). Never returns the page's
2291
+ * text.
2238
2292
  */
2239
2293
  extract: <T extends FiasWebSourceData = FiasWebSourceData>(request: FiasWebSourceExtractRequest) => Promise<FiasWebSourceExtraction<T>>;
2240
2294
  }
@@ -2939,6 +2993,44 @@ export interface DataStoreCollectionConstraints {
2939
2993
  * relate your records to people and carry refs safely between apps.
2940
2994
  */
2941
2995
  personFields?: string[];
2996
+ /**
2997
+ * An attested log (ADR-042): Fias stamps every row with who wrote it — see
2998
+ * {@link DataStoreAttestation} — and no app code, user, agent or
2999
+ * contributor can change a row or delete one on its own. The log ends with
3000
+ * your app: no workspace holding one can be archived (`WORKSPACE_ATTESTED`).
3001
+ * Requires `appendOnly: true` and
3002
+ * the `data:attested` permission; declared only in `fias-plugin.json`, and
3003
+ * only on a NEW collection (never added to one that exists). Not allowed on
3004
+ * `shared` scope.
3005
+ */
3006
+ attested?: true;
3007
+ }
3008
+ /**
3009
+ * What Fias records beside a row of an attested collection (ADR-042). Never
3010
+ * part of `data`, never writable by your code.
3011
+ *
3012
+ * It proves which person (or agent key acting for them, or Fias AI) wrote the
3013
+ * row, through which channel, when, and under which release of your app. It
3014
+ * does not prove intent or that `data` is true: your code wrote `data`.
3015
+ * Describe it as "platform-attested", never "tamper-evident".
3016
+ */
3017
+ export interface DataStoreAttestation {
3018
+ /** The app user ref of the person accountable for the write. Name it with `resolvePeople`. */
3019
+ personRef: string;
3020
+ /** The agent key that wrote it, for `channel: 'agent'` only. Never resolves to a name. */
3021
+ agentRef?: string;
3022
+ /**
3023
+ * How the write arrived: a fias.io session, a Company portal session, Fias
3024
+ * AI, an external agent key, or a dev / test / preview sandbox
3025
+ * (`non_production` — never present such a row as real).
3026
+ */
3027
+ channel: 'session' | 'portal' | 'assistant' | 'agent' | 'non_production';
3028
+ /** When Fias stored the row: the database clock at the insert (ISO 8601). */
3029
+ recordedAt: string;
3030
+ /** Your app's manifest version live when the write was accepted. On every production row; never on a test row. */
3031
+ appVersion?: string;
3032
+ /** The hash of that release's bundle. On every production row; never on a test row. */
3033
+ buildHash?: string;
2942
3034
  }
2943
3035
  /**
2944
3036
  * Counter-follows-ledger: `field` on this collection's documents may only
@@ -3041,6 +3133,8 @@ export interface DataStoreBatchResult {
3041
3133
  key: string;
3042
3134
  version?: number;
3043
3135
  audience?: string;
3136
+ /** The row's attestation, for a row of an attested collection (ADR-042). */
3137
+ attestation?: DataStoreAttestation;
3044
3138
  }[];
3045
3139
  }
3046
3140
  /**
@@ -3059,6 +3153,8 @@ export interface DataStorePutResult {
3059
3153
  key?: string;
3060
3154
  /** The audience the document sits in, in a collection with audiences. */
3061
3155
  audience?: string;
3156
+ /** What Fias recorded about the write, for a row of an attested collection (ADR-042). */
3157
+ attestation?: DataStoreAttestation;
3062
3158
  }
3063
3159
  /**
3064
3160
  * A document returned from the data store.
@@ -3090,6 +3186,8 @@ export interface DataStoreDocument<T = Record<string, unknown>> {
3090
3186
  * audience's readers, never by your code. Absent elsewhere.
3091
3187
  */
3092
3188
  audience?: string;
3189
+ /** Present on rows of an attested collection (ADR-042): see {@link DataStoreAttestation}. */
3190
+ attestation?: DataStoreAttestation;
3093
3191
  }
3094
3192
  /**
3095
3193
  * Filter condition for querying documents.
@@ -3180,6 +3278,8 @@ export interface DataStoreSearchMatch<T = Record<string, unknown>> {
3180
3278
  authoredByCollaborator?: boolean;
3181
3279
  /** The match's audience, in a collection with audiences — see {@link DataStoreDocument.audience}. */
3182
3280
  audience?: string;
3281
+ /** Present on rows of an attested collection — see {@link DataStoreDocument.attestation}. */
3282
+ attestation?: DataStoreAttestation;
3183
3283
  }
3184
3284
  /**
3185
3285
  * Data Store API available via useFiasDataStore() hook.