@proveanything/smartlinks 2.1.39 → 2.1.41
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 +754 -754
- package/dist/README.md +573 -573
- package/dist/adminCardsView.js +55 -55
- package/dist/adminViews.d.ts +1 -1
- package/dist/adminViews.js +3 -1
- package/dist/ai-tools.d.ts +2 -1
- package/dist/ai-tools.js +3 -0
- package/dist/api/ai.d.ts +2 -21
- package/dist/api/ai.js +0 -35
- package/dist/api/collection.d.ts +8 -1
- package/dist/api/collection.js +10 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/knowledge.d.ts +64 -0
- package/dist/api/knowledge.js +97 -0
- package/dist/baseline.css +194 -194
- package/dist/docs/API_SUMMARY.md +1046 -964
- package/dist/docs/admin-cards.md +189 -189
- package/dist/docs/admin-views.md +257 -255
- package/dist/docs/agent-tools.md +156 -156
- package/dist/docs/ai-tools-and-skills.md +180 -180
- package/dist/docs/ai.md +1721 -1834
- package/dist/docs/analytics.md +39 -39
- package/dist/docs/app-data-storage.md +277 -277
- package/dist/docs/app-docs.md +73 -73
- package/dist/docs/app-manifest.md +852 -852
- package/dist/docs/app-records-pattern.md +388 -388
- package/dist/docs/appConfig.md +550 -550
- package/dist/docs/assistant-apps.md +172 -172
- package/dist/docs/assistant-context.md +119 -119
- package/dist/docs/bookings.md +442 -442
- package/dist/docs/comms.md +686 -686
- package/dist/docs/connectors.md +340 -340
- package/dist/docs/css-baseline.md +133 -133
- package/dist/docs/customer-guide.md +70 -70
- package/dist/docs/deploying-apps.md +340 -340
- package/dist/docs/entitlements.md +90 -90
- package/dist/docs/files.md +69 -69
- package/dist/docs/host-dependency-contract.md +210 -210
- package/dist/docs/integrations.md +322 -322
- package/dist/docs/interactions.md +545 -545
- package/dist/docs/item-context.md +181 -181
- package/dist/docs/knowledge.md +102 -0
- package/dist/docs/lots.md +111 -111
- package/dist/docs/loyalty.md +352 -352
- package/dist/docs/members.md +182 -182
- package/dist/docs/mobile-admin-container.md +693 -693
- package/dist/docs/operations.md +281 -281
- package/dist/docs/overview.md +482 -482
- package/dist/docs/proof-comms-triggers.md +142 -142
- package/dist/docs/proof-ownership-transfer.md +155 -155
- package/dist/docs/proof-product-data-scoping.md +462 -462
- package/dist/docs/proof-share-grants.md +305 -305
- package/dist/docs/realtime.md +138 -138
- package/dist/docs/records-admin-pattern.md +304 -304
- package/dist/docs/standard-query.md +187 -187
- package/dist/docs/tag-codes.md +97 -97
- package/dist/docs/theme-tokens.md +252 -252
- package/dist/docs/wallet-passes.md +107 -107
- package/dist/docs/websites.md +123 -123
- package/dist/openapi.yaml +320 -306
- package/dist/theme-boot.js +78 -78
- package/dist/theme.css +75 -75
- package/dist/types/ai.d.ts +9 -91
- package/dist/types/appManifest.d.ts +21 -0
- package/dist/types/collection.d.ts +26 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/knowledge.d.ts +120 -0
- package/dist/types/knowledge.js +2 -0
- package/docs/API_SUMMARY.md +1046 -964
- package/docs/admin-cards.md +189 -189
- package/docs/admin-views.md +257 -255
- package/docs/agent-tools.md +156 -156
- package/docs/ai-tools-and-skills.md +180 -180
- package/docs/ai.md +1721 -1834
- package/docs/analytics.md +39 -39
- package/docs/app-data-storage.md +277 -277
- package/docs/app-docs.md +73 -73
- package/docs/app-manifest.md +852 -852
- package/docs/app-records-pattern.md +388 -388
- package/docs/appConfig.md +550 -550
- package/docs/assistant-apps.md +172 -172
- package/docs/assistant-context.md +119 -119
- package/docs/bookings.md +442 -442
- package/docs/comms.md +686 -686
- package/docs/connectors.md +340 -340
- package/docs/css-baseline.md +133 -133
- package/docs/customer-guide.md +70 -70
- package/docs/deploying-apps.md +340 -340
- package/docs/entitlements.md +90 -90
- package/docs/files.md +69 -69
- package/docs/host-dependency-contract.md +210 -210
- package/docs/integrations.md +322 -322
- package/docs/interactions.md +545 -545
- package/docs/item-context.md +181 -181
- package/docs/knowledge.md +102 -0
- package/docs/lots.md +111 -111
- package/docs/loyalty.md +352 -352
- package/docs/members.md +182 -182
- package/docs/mobile-admin-container.md +693 -693
- package/docs/operations.md +281 -281
- package/docs/overview.md +482 -482
- package/docs/proof-comms-triggers.md +142 -142
- package/docs/proof-ownership-transfer.md +155 -155
- package/docs/proof-product-data-scoping.md +462 -462
- package/docs/proof-share-grants.md +305 -305
- package/docs/realtime.md +138 -138
- package/docs/standard-query.md +187 -187
- package/docs/tag-codes.md +97 -97
- package/docs/theme-lookbook.v1.json +120 -120
- package/docs/theme-tokens.md +252 -252
- package/docs/wallet-passes.md +107 -107
- package/docs/websites.md +123 -123
- package/openapi.yaml +320 -306
- package/package.json +87 -87
- package/scripts/headless-check.mjs +87 -87
- package/scripts/lib/bare-imports.mjs +57 -57
- package/scripts/lib/keyed-app-data.mjs +21 -21
- package/scripts/publish.mjs +272 -272
- package/scripts/register-release.mjs +91 -91
package/dist/theme-boot.js
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
/* @proveanything/smartlinks/theme-boot.js — iframe theme + viewer-prefs bootstrap (theme tokens v1)
|
|
2
|
-
*
|
|
3
|
-
* ONLY for iframe / standalone app entries (admin.html, index.html). Container & widget apps do NOT
|
|
4
|
-
* need this — they inherit the host's :root tokens through the DOM. See docs/theme-tokens.md.
|
|
5
|
-
*
|
|
6
|
-
* What it does, and nothing more:
|
|
7
|
-
* 1. BOOT (synchronous, before first paint): reads the initial theme + viewer prefs from the URL
|
|
8
|
-
* (`#slt=<base64url JSON>` plus convenience params ?theme=&contrast=&lang=&fontScale=) and applies
|
|
9
|
-
* them to :root. Put this in <head>, inline, so it runs before the app's stylesheet — no flash.
|
|
10
|
-
* 2. LIVE: applies generic root-state updates the host posts (`smartlinks:root-state`) — viewer /
|
|
11
|
-
* accessibility prefs (dark, contrast, font-scale, lang) and, if the host chooses, editor
|
|
12
|
-
* brand-preview. The app AUTHORS CSS against these root hooks; it never writes a message handler.
|
|
13
|
-
*
|
|
14
|
-
* Root hooks the app styles against:
|
|
15
|
-
* - theme: the `.dark` class (Tailwind/shadcn convention) AND `[data-theme="dark|light"]`
|
|
16
|
-
* - contrast: `[data-contrast="high"]` (also honour @media (prefers-contrast: more) natively)
|
|
17
|
-
* - font size: `--sl-font-scale` (e.g. 1.25) — scale your rem/base type off it
|
|
18
|
-
* - language: `lang` attribute (content/i18n is the app's own job; this just flags it)
|
|
19
|
-
* - brand: the --sl-* theme tokens (see theme.css)
|
|
20
|
-
*
|
|
21
|
-
* Brand THEME changes are expected via iframe reload (rare, operator-driven). Viewer / a11y prefs are
|
|
22
|
-
* applied LIVE here (a reload on an accessibility toggle is itself an accessibility failure).
|
|
23
|
-
*/
|
|
24
|
-
(function () {
|
|
25
|
-
if (typeof document === 'undefined') return;
|
|
26
|
-
var root = document.documentElement;
|
|
27
|
-
|
|
28
|
-
function setVar(k, val) {
|
|
29
|
-
root.style.setProperty(k.charAt(0) === '-' ? k : '--sl-' + k, String(val));
|
|
30
|
-
}
|
|
31
|
-
function applyTheme(mode) { // 'dark' | 'light'
|
|
32
|
-
if (!mode) return;
|
|
33
|
-
root.classList.toggle('dark', mode === 'dark');
|
|
34
|
-
root.setAttribute('data-theme', mode);
|
|
35
|
-
}
|
|
36
|
-
function applyState(s) {
|
|
37
|
-
if (!s || typeof s !== 'object') return;
|
|
38
|
-
var v = s.values || s.vars;
|
|
39
|
-
if (v) for (var k in v) if (Object.prototype.hasOwnProperty.call(v, k)) setVar(k, v[k]);
|
|
40
|
-
if (s.theme) applyTheme(s.theme);
|
|
41
|
-
if (s.contrast != null) {
|
|
42
|
-
if (s.contrast === 'normal' || s.contrast === false) root.removeAttribute('data-contrast');
|
|
43
|
-
else root.setAttribute('data-contrast', String(s.contrast));
|
|
44
|
-
}
|
|
45
|
-
if (s.fontScale != null) setVar('font-scale', s.fontScale);
|
|
46
|
-
if (s.lang) root.setAttribute('lang', String(s.lang));
|
|
47
|
-
var a = s.attrs;
|
|
48
|
-
if (a) for (var name in a) if (Object.prototype.hasOwnProperty.call(a, name)) {
|
|
49
|
-
if (a[name] == null || a[name] === false) root.removeAttribute(name);
|
|
50
|
-
else root.setAttribute(name, a[name] === true ? '' : String(a[name]));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// 1) BOOT from the URL — synchronous, before paint.
|
|
55
|
-
try {
|
|
56
|
-
var hash = location.hash || '';
|
|
57
|
-
var m = hash.match(/[#&]slt=([^&]+)/);
|
|
58
|
-
if (m) {
|
|
59
|
-
var b64 = m[1].replace(/-/g, '+').replace(/_/g, '/');
|
|
60
|
-
applyState(JSON.parse(decodeURIComponent(escape(atob(b64)))));
|
|
61
|
-
}
|
|
62
|
-
var q = new URLSearchParams(location.search);
|
|
63
|
-
var boot = {};
|
|
64
|
-
if (q.get('theme')) boot.theme = q.get('theme');
|
|
65
|
-
if (q.get('contrast')) boot.contrast = q.get('contrast');
|
|
66
|
-
if (q.get('lang')) boot.lang = q.get('lang');
|
|
67
|
-
if (q.get('fontScale')) boot.fontScale = q.get('fontScale');
|
|
68
|
-
applyState(boot);
|
|
69
|
-
} catch (e) { /* never block the app on a malformed theme payload */ }
|
|
70
|
-
|
|
71
|
-
// 2) LIVE updates — generic; the app never writes this.
|
|
72
|
-
try {
|
|
73
|
-
window.addEventListener('message', function (e) {
|
|
74
|
-
var d = e && e.data;
|
|
75
|
-
if (d && d.type === 'smartlinks:root-state') applyState(d);
|
|
76
|
-
});
|
|
77
|
-
} catch (e) {}
|
|
78
|
-
})();
|
|
1
|
+
/* @proveanything/smartlinks/theme-boot.js — iframe theme + viewer-prefs bootstrap (theme tokens v1)
|
|
2
|
+
*
|
|
3
|
+
* ONLY for iframe / standalone app entries (admin.html, index.html). Container & widget apps do NOT
|
|
4
|
+
* need this — they inherit the host's :root tokens through the DOM. See docs/theme-tokens.md.
|
|
5
|
+
*
|
|
6
|
+
* What it does, and nothing more:
|
|
7
|
+
* 1. BOOT (synchronous, before first paint): reads the initial theme + viewer prefs from the URL
|
|
8
|
+
* (`#slt=<base64url JSON>` plus convenience params ?theme=&contrast=&lang=&fontScale=) and applies
|
|
9
|
+
* them to :root. Put this in <head>, inline, so it runs before the app's stylesheet — no flash.
|
|
10
|
+
* 2. LIVE: applies generic root-state updates the host posts (`smartlinks:root-state`) — viewer /
|
|
11
|
+
* accessibility prefs (dark, contrast, font-scale, lang) and, if the host chooses, editor
|
|
12
|
+
* brand-preview. The app AUTHORS CSS against these root hooks; it never writes a message handler.
|
|
13
|
+
*
|
|
14
|
+
* Root hooks the app styles against:
|
|
15
|
+
* - theme: the `.dark` class (Tailwind/shadcn convention) AND `[data-theme="dark|light"]`
|
|
16
|
+
* - contrast: `[data-contrast="high"]` (also honour @media (prefers-contrast: more) natively)
|
|
17
|
+
* - font size: `--sl-font-scale` (e.g. 1.25) — scale your rem/base type off it
|
|
18
|
+
* - language: `lang` attribute (content/i18n is the app's own job; this just flags it)
|
|
19
|
+
* - brand: the --sl-* theme tokens (see theme.css)
|
|
20
|
+
*
|
|
21
|
+
* Brand THEME changes are expected via iframe reload (rare, operator-driven). Viewer / a11y prefs are
|
|
22
|
+
* applied LIVE here (a reload on an accessibility toggle is itself an accessibility failure).
|
|
23
|
+
*/
|
|
24
|
+
(function () {
|
|
25
|
+
if (typeof document === 'undefined') return;
|
|
26
|
+
var root = document.documentElement;
|
|
27
|
+
|
|
28
|
+
function setVar(k, val) {
|
|
29
|
+
root.style.setProperty(k.charAt(0) === '-' ? k : '--sl-' + k, String(val));
|
|
30
|
+
}
|
|
31
|
+
function applyTheme(mode) { // 'dark' | 'light'
|
|
32
|
+
if (!mode) return;
|
|
33
|
+
root.classList.toggle('dark', mode === 'dark');
|
|
34
|
+
root.setAttribute('data-theme', mode);
|
|
35
|
+
}
|
|
36
|
+
function applyState(s) {
|
|
37
|
+
if (!s || typeof s !== 'object') return;
|
|
38
|
+
var v = s.values || s.vars;
|
|
39
|
+
if (v) for (var k in v) if (Object.prototype.hasOwnProperty.call(v, k)) setVar(k, v[k]);
|
|
40
|
+
if (s.theme) applyTheme(s.theme);
|
|
41
|
+
if (s.contrast != null) {
|
|
42
|
+
if (s.contrast === 'normal' || s.contrast === false) root.removeAttribute('data-contrast');
|
|
43
|
+
else root.setAttribute('data-contrast', String(s.contrast));
|
|
44
|
+
}
|
|
45
|
+
if (s.fontScale != null) setVar('font-scale', s.fontScale);
|
|
46
|
+
if (s.lang) root.setAttribute('lang', String(s.lang));
|
|
47
|
+
var a = s.attrs;
|
|
48
|
+
if (a) for (var name in a) if (Object.prototype.hasOwnProperty.call(a, name)) {
|
|
49
|
+
if (a[name] == null || a[name] === false) root.removeAttribute(name);
|
|
50
|
+
else root.setAttribute(name, a[name] === true ? '' : String(a[name]));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// 1) BOOT from the URL — synchronous, before paint.
|
|
55
|
+
try {
|
|
56
|
+
var hash = location.hash || '';
|
|
57
|
+
var m = hash.match(/[#&]slt=([^&]+)/);
|
|
58
|
+
if (m) {
|
|
59
|
+
var b64 = m[1].replace(/-/g, '+').replace(/_/g, '/');
|
|
60
|
+
applyState(JSON.parse(decodeURIComponent(escape(atob(b64)))));
|
|
61
|
+
}
|
|
62
|
+
var q = new URLSearchParams(location.search);
|
|
63
|
+
var boot = {};
|
|
64
|
+
if (q.get('theme')) boot.theme = q.get('theme');
|
|
65
|
+
if (q.get('contrast')) boot.contrast = q.get('contrast');
|
|
66
|
+
if (q.get('lang')) boot.lang = q.get('lang');
|
|
67
|
+
if (q.get('fontScale')) boot.fontScale = q.get('fontScale');
|
|
68
|
+
applyState(boot);
|
|
69
|
+
} catch (e) { /* never block the app on a malformed theme payload */ }
|
|
70
|
+
|
|
71
|
+
// 2) LIVE updates — generic; the app never writes this.
|
|
72
|
+
try {
|
|
73
|
+
window.addEventListener('message', function (e) {
|
|
74
|
+
var d = e && e.data;
|
|
75
|
+
if (d && d.type === 'smartlinks:root-state') applyState(d);
|
|
76
|
+
});
|
|
77
|
+
} catch (e) {}
|
|
78
|
+
})();
|
package/dist/theme.css
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
/* @proveanything/smartlinks/theme.css — SmartLinks host theming preset (theme tokens v1)
|
|
2
|
-
*
|
|
3
|
-
* Maps Tailwind 4's design tokens onto the SmartLinks semantic theme tokens (--sl-color-*,
|
|
4
|
-
* --sl-radius-*, --sl-font-*) that the host sets on each app's mount root. After importing this,
|
|
5
|
-
* an app's `bg-primary` / `text-foreground` / `border-border` / `rounded-md` / `font-heading`
|
|
6
|
-
* resolve to whatever brand the host is running — no per-app mapping, no hardcoded palette.
|
|
7
|
-
*
|
|
8
|
-
* app styles.css:
|
|
9
|
-
* @import "tailwindcss";
|
|
10
|
-
* @import "@proveanything/smartlinks/theme.css";
|
|
11
|
-
*
|
|
12
|
-
* Requires Tailwind 4 (@theme). Every value has a neutral fallback, so the app renders correctly
|
|
13
|
-
* even against a host that sets none of the --sl-* tokens. See docs/theme-tokens.md.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
@theme {
|
|
17
|
-
/* ── Colour (semantic roles) ─────────────────────────────────────────── */
|
|
18
|
-
--color-background: var(--sl-color-bg, #ffffff);
|
|
19
|
-
--color-surface: var(--sl-color-surface, #f7f7f8);
|
|
20
|
-
--color-surface-raised:var(--sl-color-surface-raised, var(--sl-color-surface, #ffffff));
|
|
21
|
-
--color-foreground: var(--sl-color-fg, #18181b);
|
|
22
|
-
--color-muted: var(--sl-color-muted, #71717a);
|
|
23
|
-
--color-border: var(--sl-color-border, #e4e4e7);
|
|
24
|
-
--color-primary: var(--sl-color-accent, #4f46e5);
|
|
25
|
-
--color-on-primary: var(--sl-color-on-accent, #ffffff);
|
|
26
|
-
--color-primary-soft: var(--sl-color-accent-soft, color-mix(in oklab, var(--sl-color-accent, #4f46e5) 12%, transparent));
|
|
27
|
-
--color-success: var(--sl-color-success, #16a34a);
|
|
28
|
-
--color-danger: var(--sl-color-danger, #dc2626);
|
|
29
|
-
|
|
30
|
-
/* ── Shape ───────────────────────────────────────────────────────────── */
|
|
31
|
-
--radius-sm: var(--sl-radius-sm, 4px);
|
|
32
|
-
--radius-md: var(--sl-radius-md, 8px);
|
|
33
|
-
--radius-lg: var(--sl-radius-lg, 16px);
|
|
34
|
-
|
|
35
|
-
/* ── Type ────────────────────────────────────────────────────────────── */
|
|
36
|
-
--font-heading: var(--sl-font-heading, var(--sl-font-body, ui-sans-serif, system-ui, sans-serif));
|
|
37
|
-
--font-body: var(--sl-font-body, ui-sans-serif, system-ui, sans-serif);
|
|
38
|
-
|
|
39
|
-
/* ── Elevation (extended; no shadow unless the host sets one) ─────────── */
|
|
40
|
-
--shadow-sm: var(--sl-shadow-sm, 0 0 #0000);
|
|
41
|
-
--shadow-md: var(--sl-shadow-md, 0 0 #0000);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/* Dark mode without values. A host in dark mode should send a dark value-set (the --sl-* tokens); one
|
|
45
|
-
* that only sets the hook (.dark / data-theme="dark") left every colour on its light fallback — white
|
|
46
|
-
* cards and near-black text on a dark page. Under the hook the fallbacks are dark too; whatever the host
|
|
47
|
-
* does send still wins. (Re-declared on the hook's element, so it works wherever the host puts it.) */
|
|
48
|
-
.dark,
|
|
49
|
-
[data-theme="dark"] {
|
|
50
|
-
--color-background: var(--sl-color-bg, #09090b);
|
|
51
|
-
--color-surface: var(--sl-color-surface, #18181b);
|
|
52
|
-
--color-surface-raised:var(--sl-color-surface-raised, var(--sl-color-surface, #27272a));
|
|
53
|
-
--color-foreground: var(--sl-color-fg, #fafafa);
|
|
54
|
-
--color-muted: var(--sl-color-muted, #a1a1aa);
|
|
55
|
-
--color-border: var(--sl-color-border, #3f3f46);
|
|
56
|
-
--color-primary: var(--sl-color-accent, #6366f1);
|
|
57
|
-
--color-on-primary: var(--sl-color-on-accent, #ffffff);
|
|
58
|
-
--color-primary-soft: var(--sl-color-accent-soft, color-mix(in oklab, var(--sl-color-accent, #6366f1) 20%, transparent));
|
|
59
|
-
--color-success: var(--sl-color-success, #22c55e);
|
|
60
|
-
--color-danger: var(--sl-color-danger, #f87171);
|
|
61
|
-
color-scheme: dark;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/* shadcn bridge (optional): if the app uses shadcn's --primary/--background/etc. HSL variables,
|
|
65
|
-
* uncomment to drive them from the SmartLinks tokens too. Left commented so it never overrides an
|
|
66
|
-
* app that has deliberately customised its shadcn palette — opt in per app (see migration step 17).
|
|
67
|
-
*
|
|
68
|
-
* :where([data-sl-app]) {
|
|
69
|
-
* --primary: var(--sl-color-accent);
|
|
70
|
-
* --background: var(--sl-color-bg);
|
|
71
|
-
* --foreground: var(--sl-color-fg);
|
|
72
|
-
* --border: var(--sl-color-border);
|
|
73
|
-
* --radius: var(--sl-radius-md);
|
|
74
|
-
* }
|
|
75
|
-
*/
|
|
1
|
+
/* @proveanything/smartlinks/theme.css — SmartLinks host theming preset (theme tokens v1)
|
|
2
|
+
*
|
|
3
|
+
* Maps Tailwind 4's design tokens onto the SmartLinks semantic theme tokens (--sl-color-*,
|
|
4
|
+
* --sl-radius-*, --sl-font-*) that the host sets on each app's mount root. After importing this,
|
|
5
|
+
* an app's `bg-primary` / `text-foreground` / `border-border` / `rounded-md` / `font-heading`
|
|
6
|
+
* resolve to whatever brand the host is running — no per-app mapping, no hardcoded palette.
|
|
7
|
+
*
|
|
8
|
+
* app styles.css:
|
|
9
|
+
* @import "tailwindcss";
|
|
10
|
+
* @import "@proveanything/smartlinks/theme.css";
|
|
11
|
+
*
|
|
12
|
+
* Requires Tailwind 4 (@theme). Every value has a neutral fallback, so the app renders correctly
|
|
13
|
+
* even against a host that sets none of the --sl-* tokens. See docs/theme-tokens.md.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
@theme {
|
|
17
|
+
/* ── Colour (semantic roles) ─────────────────────────────────────────── */
|
|
18
|
+
--color-background: var(--sl-color-bg, #ffffff);
|
|
19
|
+
--color-surface: var(--sl-color-surface, #f7f7f8);
|
|
20
|
+
--color-surface-raised:var(--sl-color-surface-raised, var(--sl-color-surface, #ffffff));
|
|
21
|
+
--color-foreground: var(--sl-color-fg, #18181b);
|
|
22
|
+
--color-muted: var(--sl-color-muted, #71717a);
|
|
23
|
+
--color-border: var(--sl-color-border, #e4e4e7);
|
|
24
|
+
--color-primary: var(--sl-color-accent, #4f46e5);
|
|
25
|
+
--color-on-primary: var(--sl-color-on-accent, #ffffff);
|
|
26
|
+
--color-primary-soft: var(--sl-color-accent-soft, color-mix(in oklab, var(--sl-color-accent, #4f46e5) 12%, transparent));
|
|
27
|
+
--color-success: var(--sl-color-success, #16a34a);
|
|
28
|
+
--color-danger: var(--sl-color-danger, #dc2626);
|
|
29
|
+
|
|
30
|
+
/* ── Shape ───────────────────────────────────────────────────────────── */
|
|
31
|
+
--radius-sm: var(--sl-radius-sm, 4px);
|
|
32
|
+
--radius-md: var(--sl-radius-md, 8px);
|
|
33
|
+
--radius-lg: var(--sl-radius-lg, 16px);
|
|
34
|
+
|
|
35
|
+
/* ── Type ────────────────────────────────────────────────────────────── */
|
|
36
|
+
--font-heading: var(--sl-font-heading, var(--sl-font-body, ui-sans-serif, system-ui, sans-serif));
|
|
37
|
+
--font-body: var(--sl-font-body, ui-sans-serif, system-ui, sans-serif);
|
|
38
|
+
|
|
39
|
+
/* ── Elevation (extended; no shadow unless the host sets one) ─────────── */
|
|
40
|
+
--shadow-sm: var(--sl-shadow-sm, 0 0 #0000);
|
|
41
|
+
--shadow-md: var(--sl-shadow-md, 0 0 #0000);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Dark mode without values. A host in dark mode should send a dark value-set (the --sl-* tokens); one
|
|
45
|
+
* that only sets the hook (.dark / data-theme="dark") left every colour on its light fallback — white
|
|
46
|
+
* cards and near-black text on a dark page. Under the hook the fallbacks are dark too; whatever the host
|
|
47
|
+
* does send still wins. (Re-declared on the hook's element, so it works wherever the host puts it.) */
|
|
48
|
+
.dark,
|
|
49
|
+
[data-theme="dark"] {
|
|
50
|
+
--color-background: var(--sl-color-bg, #09090b);
|
|
51
|
+
--color-surface: var(--sl-color-surface, #18181b);
|
|
52
|
+
--color-surface-raised:var(--sl-color-surface-raised, var(--sl-color-surface, #27272a));
|
|
53
|
+
--color-foreground: var(--sl-color-fg, #fafafa);
|
|
54
|
+
--color-muted: var(--sl-color-muted, #a1a1aa);
|
|
55
|
+
--color-border: var(--sl-color-border, #3f3f46);
|
|
56
|
+
--color-primary: var(--sl-color-accent, #6366f1);
|
|
57
|
+
--color-on-primary: var(--sl-color-on-accent, #ffffff);
|
|
58
|
+
--color-primary-soft: var(--sl-color-accent-soft, color-mix(in oklab, var(--sl-color-accent, #6366f1) 20%, transparent));
|
|
59
|
+
--color-success: var(--sl-color-success, #22c55e);
|
|
60
|
+
--color-danger: var(--sl-color-danger, #f87171);
|
|
61
|
+
color-scheme: dark;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* shadcn bridge (optional): if the app uses shadcn's --primary/--background/etc. HSL variables,
|
|
65
|
+
* uncomment to drive them from the SmartLinks tokens too. Left commented so it never overrides an
|
|
66
|
+
* app that has deliberately customised its shadcn palette — opt in per app (see migration step 17).
|
|
67
|
+
*
|
|
68
|
+
* :where([data-sl-app]) {
|
|
69
|
+
* --primary: var(--sl-color-accent);
|
|
70
|
+
* --background: var(--sl-color-bg);
|
|
71
|
+
* --foreground: var(--sl-color-fg);
|
|
72
|
+
* --border: var(--sl-color-border);
|
|
73
|
+
* --radius: var(--sl-radius-md);
|
|
74
|
+
* }
|
|
75
|
+
*/
|
package/dist/types/ai.d.ts
CHANGED
|
@@ -261,95 +261,6 @@ export interface AIModelListResponse {
|
|
|
261
261
|
object: 'list';
|
|
262
262
|
data: AIModel[];
|
|
263
263
|
}
|
|
264
|
-
/** Document chunk with embedding */
|
|
265
|
-
export interface DocumentChunk {
|
|
266
|
-
text: string;
|
|
267
|
-
embedding: number[];
|
|
268
|
-
metadata: {
|
|
269
|
-
chunkIndex: number;
|
|
270
|
-
documentId: string;
|
|
271
|
-
[key: string]: any;
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
/** Index document request */
|
|
275
|
-
export interface IndexDocumentRequest {
|
|
276
|
-
productId: string;
|
|
277
|
-
text?: string;
|
|
278
|
-
documentUrl?: string;
|
|
279
|
-
metadata?: Record<string, any>;
|
|
280
|
-
chunkSize?: number;
|
|
281
|
-
overlap?: number;
|
|
282
|
-
provider?: 'openai' | 'gemini';
|
|
283
|
-
}
|
|
284
|
-
/** Index document response */
|
|
285
|
-
export interface IndexDocumentResponse {
|
|
286
|
-
success: boolean;
|
|
287
|
-
productId: string;
|
|
288
|
-
documentId: string;
|
|
289
|
-
chunks: number;
|
|
290
|
-
metadata: {
|
|
291
|
-
textLength: number;
|
|
292
|
-
chunkSize: number;
|
|
293
|
-
overlap: number;
|
|
294
|
-
embeddingDimensions: number;
|
|
295
|
-
};
|
|
296
|
-
sample?: {
|
|
297
|
-
text: string;
|
|
298
|
-
chunkIndex: number;
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
/** Configure assistant request */
|
|
302
|
-
export interface ConfigureAssistantRequest {
|
|
303
|
-
productId: string;
|
|
304
|
-
systemPrompt?: string;
|
|
305
|
-
model?: string;
|
|
306
|
-
maxTokensPerResponse?: number;
|
|
307
|
-
temperature?: number;
|
|
308
|
-
rateLimitPerUser?: number;
|
|
309
|
-
allowedTopics?: string[];
|
|
310
|
-
customInstructions?: {
|
|
311
|
-
tone?: string;
|
|
312
|
-
additionalRules?: string;
|
|
313
|
-
[key: string]: any;
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
/** Configure assistant response */
|
|
317
|
-
export interface ConfigureAssistantResponse {
|
|
318
|
-
success: boolean;
|
|
319
|
-
configuration: {
|
|
320
|
-
productId: string;
|
|
321
|
-
systemPrompt: string;
|
|
322
|
-
model: string;
|
|
323
|
-
maxTokensPerResponse: number;
|
|
324
|
-
temperature: number;
|
|
325
|
-
rateLimitPerUser: number;
|
|
326
|
-
allowedTopics: string[];
|
|
327
|
-
customInstructions?: Record<string, any>;
|
|
328
|
-
updatedAt: string;
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
/** Public chat request */
|
|
332
|
-
export interface PublicChatRequest {
|
|
333
|
-
productId: string;
|
|
334
|
-
userId: string;
|
|
335
|
-
message: string;
|
|
336
|
-
sessionId?: string;
|
|
337
|
-
stream?: boolean;
|
|
338
|
-
}
|
|
339
|
-
/** Public chat response */
|
|
340
|
-
export interface PublicChatResponse {
|
|
341
|
-
message: string;
|
|
342
|
-
sessionId: string;
|
|
343
|
-
usage: {
|
|
344
|
-
prompt_tokens: number;
|
|
345
|
-
completion_tokens: number;
|
|
346
|
-
total_tokens: number;
|
|
347
|
-
};
|
|
348
|
-
context?: {
|
|
349
|
-
chunksUsed: number;
|
|
350
|
-
topSimilarity: number;
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
264
|
/** Session information */
|
|
354
265
|
export interface Session {
|
|
355
266
|
sessionId: string;
|
|
@@ -843,9 +754,9 @@ export interface CatalogResponse {
|
|
|
843
754
|
skills: SkillDescriptor[];
|
|
844
755
|
}
|
|
845
756
|
/** Capability tags a tool requires; scope a run with `allowCapabilities`. */
|
|
846
|
-
export type AiToolCapability = 'web:read' | 'ai:vision' | 'ai:image' | 'ai:text' | 'media:image' | 'media:pdf' | 'net:http';
|
|
757
|
+
export type AiToolCapability = 'web:read' | 'ai:vision' | 'ai:image' | 'ai:text' | 'media:image' | 'media:pdf' | 'net:http' | 'knowledge:read';
|
|
847
758
|
/** The names of the built-in server-side agent tools (run via `server_tools`). */
|
|
848
|
-
export type AiToolName = 'web.fetchPage' | 'web.extractSchema' | 'web.screenshot' | 'web.search' | 'brand.assets' | 'document.read' | 'data.extract' | 'image.describe' | 'image.generate' | 'image.fromReference' | 'image.searchStock' | 'image.transform' | 'image.ocr' | 'pdf.create' | 'pdf.fill' | 'pdf.merge' | 'pdf.inspect' | 'pdf.render' | 'pdf.extract' | 'pdf.decodeBarcodes' | 'pdf.inspectGraphics' | 'pdf.edit' | 'pdf.preflight' | 'pdf.printReady' | 'http.request' | 'translate';
|
|
759
|
+
export type AiToolName = 'web.fetchPage' | 'web.extractSchema' | 'web.screenshot' | 'web.search' | 'brand.assets' | 'document.read' | 'data.extract' | 'image.describe' | 'image.generate' | 'image.fromReference' | 'image.searchStock' | 'image.transform' | 'image.ocr' | 'pdf.create' | 'pdf.fill' | 'pdf.merge' | 'pdf.inspect' | 'pdf.render' | 'pdf.extract' | 'pdf.decodeBarcodes' | 'pdf.inspectGraphics' | 'pdf.edit' | 'pdf.preflight' | 'pdf.printReady' | 'http.request' | 'translate' | 'knowledge.search';
|
|
849
760
|
export interface WebFetchPageArgs {
|
|
850
761
|
url: string;
|
|
851
762
|
type?: string;
|
|
@@ -1131,6 +1042,12 @@ export interface HttpRequestArgs {
|
|
|
1131
1042
|
headers?: Record<string, string>;
|
|
1132
1043
|
body?: any;
|
|
1133
1044
|
}
|
|
1045
|
+
export interface KnowledgeSearchArgs {
|
|
1046
|
+
query: string;
|
|
1047
|
+
sets?: string[];
|
|
1048
|
+
filters?: Record<string, any>;
|
|
1049
|
+
k?: number;
|
|
1050
|
+
}
|
|
1134
1051
|
export interface TranslateArgs {
|
|
1135
1052
|
text: string;
|
|
1136
1053
|
targetLanguages: string[];
|
|
@@ -1164,6 +1081,7 @@ export interface AiToolArgsMap {
|
|
|
1164
1081
|
'pdf.printReady': PdfPrintReadyArgs;
|
|
1165
1082
|
'http.request': HttpRequestArgs;
|
|
1166
1083
|
'translate': TranslateArgs;
|
|
1084
|
+
'knowledge.search': KnowledgeSearchArgs;
|
|
1167
1085
|
}
|
|
1168
1086
|
export interface WebSearchResultItem {
|
|
1169
1087
|
url: string | null;
|
|
@@ -1284,6 +1284,13 @@ export interface AppManifest {
|
|
|
1284
1284
|
* docs/admin-views.md
|
|
1285
1285
|
*/
|
|
1286
1286
|
adminViews?: AdminView[];
|
|
1287
|
+
/**
|
|
1288
|
+
* What the app needs before it can do its job. Installing the app turns on what can be turned on
|
|
1289
|
+
* (signIn: the standard customer sign-in; crm / products: switched back on); the rest shows in the
|
|
1290
|
+
* collection's readiness list (`collection.readiness`). @see AppRequirement
|
|
1291
|
+
* @example requires: ["signIn", { need: "crm", optional: true, why: "to keep a customer list" }]
|
|
1292
|
+
*/
|
|
1293
|
+
requires?: AppRequirement[];
|
|
1287
1294
|
/**
|
|
1288
1295
|
* Executor bundle declaration. Present when the app ships a programmatic executor
|
|
1289
1296
|
* for AI-driven configuration, server-side SEO, and LLM content generation.
|
|
@@ -1738,3 +1745,17 @@ export interface GetCollectionWidgetsOptions {
|
|
|
1738
1745
|
/** Bypass server cache and fetch fresh manifests */
|
|
1739
1746
|
force?: boolean;
|
|
1740
1747
|
}
|
|
1748
|
+
/**
|
|
1749
|
+
* Something an app needs (manifest `requires`):
|
|
1750
|
+
* - `signIn` — customers sign in (turned on automatically: the standard sign-in)
|
|
1751
|
+
* - `crm` — the customer list (switched back on if off; needs a plan with customers)
|
|
1752
|
+
* - `products` — products (switched back on if off)
|
|
1753
|
+
* - `claimableItems` — something customers can claim (claim codes, or claiming on scan; not automatic)
|
|
1754
|
+
*/
|
|
1755
|
+
export type AppNeed = 'signIn' | 'crm' | 'products' | 'claimableItems';
|
|
1756
|
+
/** A need, or a need with detail. Optional needs aren't turned on automatically and only warn when missing. */
|
|
1757
|
+
export type AppRequirement = AppNeed | {
|
|
1758
|
+
need: AppNeed;
|
|
1759
|
+
optional?: boolean;
|
|
1760
|
+
why?: string;
|
|
1761
|
+
};
|
|
@@ -192,3 +192,29 @@ export interface InviteUserInput {
|
|
|
192
192
|
/** Origin used to build the branded invite link. Defaults to `window.location.origin` in the browser. */
|
|
193
193
|
consoleOrigin?: string;
|
|
194
194
|
}
|
|
195
|
+
/** One thing the readiness list says (GET /admin/collection/:id/readiness). */
|
|
196
|
+
export interface ReadinessItem {
|
|
197
|
+
/** 'problem': something won't work; 'warning': works, probably not what's meant; 'info': worth knowing. */
|
|
198
|
+
level: 'problem' | 'warning' | 'info';
|
|
199
|
+
/** e.g. SIGN_IN_MISSING, SIGN_IN_STANDARD, CRM_NOT_IN_PLAN, CRM_OFF, PRODUCTS_OFF, NO_CLAIM_CODES */
|
|
200
|
+
code: string;
|
|
201
|
+
/** Plain words for the business. */
|
|
202
|
+
message: string;
|
|
203
|
+
/** The app that needs it (master id) and its name. */
|
|
204
|
+
app?: string;
|
|
205
|
+
appName?: string;
|
|
206
|
+
/** The screen that fixes it: `open` is the adminViews.openApp payload; studioPath a plain link. */
|
|
207
|
+
fix?: {
|
|
208
|
+
label: string;
|
|
209
|
+
open: {
|
|
210
|
+
appId: string;
|
|
211
|
+
view?: string;
|
|
212
|
+
};
|
|
213
|
+
studioPath: string;
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/** What the installed apps need and whether it's there. `ready` is false when any item is a problem. */
|
|
217
|
+
export interface CollectionReadiness {
|
|
218
|
+
ready: boolean;
|
|
219
|
+
items: ReadinessItem[];
|
|
220
|
+
}
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/** Who may search a set: anyone, signed-in people, or the business's own staff and assistants. */
|
|
2
|
+
export type KnowledgeVisibility = 'public' | 'customer' | 'staff';
|
|
3
|
+
/** Where a set's passages come from. */
|
|
4
|
+
export type KnowledgeSourceKind =
|
|
5
|
+
/** A Markdown bundle: documents separated by `---`, each with a `Source: <url>` line (the llms-full format). */
|
|
6
|
+
'markdown_feed'
|
|
7
|
+
/** One web page or document at an address. */
|
|
8
|
+
| 'url'
|
|
9
|
+
/** Documents an app pushes itself with `knowledge.upsertDocuments`. */
|
|
10
|
+
| 'documents';
|
|
11
|
+
export interface KnowledgeSet {
|
|
12
|
+
id: string;
|
|
13
|
+
/** Lower-case key, unique in the collection: "docs", "manuals". */
|
|
14
|
+
key: string;
|
|
15
|
+
name: string;
|
|
16
|
+
description: string | null;
|
|
17
|
+
visibility: KnowledgeVisibility;
|
|
18
|
+
/** The app that declared the set, if any. */
|
|
19
|
+
ownerAppId: string | null;
|
|
20
|
+
/** The embedding model its passages were embedded with (null until embedded). */
|
|
21
|
+
embedModel: string | null;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
updatedAt: string;
|
|
24
|
+
/** On list: how many sources and passages it has. */
|
|
25
|
+
sourceCount?: number;
|
|
26
|
+
passageCount?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface SaveKnowledgeSetRequest {
|
|
29
|
+
key: string;
|
|
30
|
+
name: string;
|
|
31
|
+
description?: string | null;
|
|
32
|
+
/** Default `staff`. */
|
|
33
|
+
visibility?: KnowledgeVisibility;
|
|
34
|
+
}
|
|
35
|
+
export interface UpdateKnowledgeSetRequest {
|
|
36
|
+
name?: string;
|
|
37
|
+
description?: string | null;
|
|
38
|
+
visibility?: KnowledgeVisibility;
|
|
39
|
+
}
|
|
40
|
+
export interface KnowledgeSource {
|
|
41
|
+
id: string;
|
|
42
|
+
setId: string;
|
|
43
|
+
kind: KnowledgeSourceKind;
|
|
44
|
+
name: string | null;
|
|
45
|
+
/** `markdown_feed` and `url`: `{ url }` (https). */
|
|
46
|
+
config: Record<string, any>;
|
|
47
|
+
/** Re-read every this many hours (default 24 for feeds and pages; null = only when asked). */
|
|
48
|
+
refreshHours: number | null;
|
|
49
|
+
status: 'pending' | 'indexing' | 'ready' | 'failed';
|
|
50
|
+
/** Why the last read failed (the previous passages stay searchable meanwhile). */
|
|
51
|
+
error: string | null;
|
|
52
|
+
passageCount: number;
|
|
53
|
+
lastIndexedAt: string | null;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
updatedAt: string;
|
|
56
|
+
}
|
|
57
|
+
export interface AddKnowledgeSourceRequest {
|
|
58
|
+
kind: KnowledgeSourceKind;
|
|
59
|
+
config?: {
|
|
60
|
+
url?: string;
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
};
|
|
63
|
+
name?: string;
|
|
64
|
+
refreshHours?: number | null;
|
|
65
|
+
}
|
|
66
|
+
export interface UpdateKnowledgeSourceRequest {
|
|
67
|
+
config?: {
|
|
68
|
+
url?: string;
|
|
69
|
+
[key: string]: any;
|
|
70
|
+
};
|
|
71
|
+
name?: string;
|
|
72
|
+
refreshHours?: number | null;
|
|
73
|
+
}
|
|
74
|
+
/** A document an app pushes into a `documents` source. Re-pushing the same `ref` replaces it. */
|
|
75
|
+
export interface KnowledgeDocument {
|
|
76
|
+
ref: string;
|
|
77
|
+
title: string;
|
|
78
|
+
/** Markdown. Split into passages along its headings. */
|
|
79
|
+
body: string;
|
|
80
|
+
/** The link to show with an answer. */
|
|
81
|
+
url?: string;
|
|
82
|
+
/** Details to filter searches on, e.g. `{ productId: 'p1' }`. */
|
|
83
|
+
meta?: Record<string, any>;
|
|
84
|
+
}
|
|
85
|
+
export interface KnowledgeSearchRequest {
|
|
86
|
+
query: string;
|
|
87
|
+
/** Only these sets (ids or keys). Default: every set the caller may read. */
|
|
88
|
+
sets?: string[];
|
|
89
|
+
/** Exact matches on a passage's details, e.g. `{ productId: 'p1' }`. */
|
|
90
|
+
filters?: Record<string, any>;
|
|
91
|
+
/** How many results (default 8, at most 25). */
|
|
92
|
+
k?: number;
|
|
93
|
+
}
|
|
94
|
+
export interface KnowledgeSearchResult {
|
|
95
|
+
id: string;
|
|
96
|
+
/** The document it came from. */
|
|
97
|
+
title: string;
|
|
98
|
+
/** Its section: "Settings › Email footer". */
|
|
99
|
+
heading: string | null;
|
|
100
|
+
/** A link to the section. */
|
|
101
|
+
url: string | null;
|
|
102
|
+
/** A short piece around the match, for a results list. */
|
|
103
|
+
snippet: string;
|
|
104
|
+
/** The whole passage, for an AI to read. */
|
|
105
|
+
text: string;
|
|
106
|
+
score: number;
|
|
107
|
+
set: {
|
|
108
|
+
id: string;
|
|
109
|
+
key: string;
|
|
110
|
+
name: string;
|
|
111
|
+
};
|
|
112
|
+
sourceId: string;
|
|
113
|
+
meta: Record<string, any>;
|
|
114
|
+
}
|
|
115
|
+
export interface KnowledgeSearchResponse {
|
|
116
|
+
query: string;
|
|
117
|
+
results: KnowledgeSearchResult[];
|
|
118
|
+
/** `hybrid` (meaning + keywords), `keywords` (where vectors aren't available) or `none` (no sets to search). */
|
|
119
|
+
mode: 'hybrid' | 'keywords' | 'none';
|
|
120
|
+
}
|