@krak-stack/registry 0.1.5 → 0.1.8
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 +24 -0
- package/dist/components/ui/data-table.js +78 -28
- package/dist/components/ui/editing-locale-switcher.js +8 -0
- package/dist/components/ui/effect-form.js +71 -21
- package/dist/components/ui/file-picker.js +8 -0
- package/dist/components/ui/form.js +71 -21
- package/dist/components/ui/google-map.js +8 -0
- package/dist/components/ui/icon-input.js +71 -21
- package/dist/components/ui/loading.js +8 -0
- package/dist/components/ui/locale-switcher.js +8 -0
- package/dist/components/ui/pagination.js +8 -0
- package/dist/components/ui/search-menu.js +8 -0
- package/dist/components/ui/theme-switcher.js +8 -0
- package/dist/components/ui/virtualized-combobox.d.ts +3 -0
- package/dist/components/ui/virtualized-combobox.js +71 -21
- package/dist/lib/docs-ai.d.ts +3 -3
- package/dist/lib/docs-ai.js +2 -1
- package/dist/lib/docs-core.d.ts +32 -27
- package/dist/lib/docs-core.js +134 -35
- package/dist/lib/seo.d.ts +88 -0
- package/dist/lib/seo.js +104 -0
- package/dist/services/agent/client/index.js +22 -15
- package/dist/services/agent/client/widget.d.ts +0 -1
- package/dist/services/agent/index.d.ts +2 -2
- package/dist/services/agent/index.js +0 -9
- package/dist/services/agent/schema.d.ts +3 -3
- package/dist/services/agent/schema.js +1 -6
- package/package.json +5 -13
- package/dist/services/embedding.d.ts +0 -2
- package/dist/services/embedding.js +0 -23
- package/dist/services/opentelemetry.d.ts +0 -8
- package/dist/services/opentelemetry.js +0 -23
package/dist/lib/docs-core.js
CHANGED
|
@@ -387,6 +387,14 @@ var routeStrategies = [
|
|
|
387
387
|
{
|
|
388
388
|
match: "/api/:path(.*)?",
|
|
389
389
|
exclude: true
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
match: "/sitemap.xml",
|
|
393
|
+
exclude: true
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
match: "/llms.txt",
|
|
397
|
+
exclude: true
|
|
390
398
|
}
|
|
391
399
|
];
|
|
392
400
|
var urlPatterns = [
|
|
@@ -1594,6 +1602,107 @@ function SidebarLayout({
|
|
|
1594
1602
|
});
|
|
1595
1603
|
}
|
|
1596
1604
|
|
|
1605
|
+
// ../../src/lib/seo.ts
|
|
1606
|
+
var localizedUrl = (origin, locale, path) => `${origin.replace(/\/$/, "")}/${locale}${path === "/" ? "/" : path}`;
|
|
1607
|
+
var seo = ({
|
|
1608
|
+
title,
|
|
1609
|
+
description,
|
|
1610
|
+
image,
|
|
1611
|
+
keywords,
|
|
1612
|
+
url,
|
|
1613
|
+
origin,
|
|
1614
|
+
path = "/",
|
|
1615
|
+
locale,
|
|
1616
|
+
locales: locales2,
|
|
1617
|
+
defaultLocale,
|
|
1618
|
+
robots = "index, follow",
|
|
1619
|
+
siteName = "KrakStack",
|
|
1620
|
+
twitterCreator = "@krak",
|
|
1621
|
+
twitterSite = "@krak",
|
|
1622
|
+
type = "website",
|
|
1623
|
+
sameAs
|
|
1624
|
+
}) => {
|
|
1625
|
+
const canonical = url ?? (origin && locale ? localizedUrl(origin, locale, path) : undefined);
|
|
1626
|
+
const tags = [
|
|
1627
|
+
{ title },
|
|
1628
|
+
{ name: "description", content: description },
|
|
1629
|
+
{ name: "keywords", content: keywords },
|
|
1630
|
+
{ name: "robots", content: robots },
|
|
1631
|
+
{ name: "twitter:title", content: title },
|
|
1632
|
+
{ name: "twitter:description", content: description },
|
|
1633
|
+
{ name: "twitter:creator", content: twitterCreator },
|
|
1634
|
+
{ name: "twitter:site", content: twitterSite },
|
|
1635
|
+
{
|
|
1636
|
+
name: "twitter:card",
|
|
1637
|
+
content: image ? "summary_large_image" : "summary"
|
|
1638
|
+
},
|
|
1639
|
+
{ property: "og:type", content: type },
|
|
1640
|
+
{ property: "og:title", content: title },
|
|
1641
|
+
{ property: "og:description", content: description },
|
|
1642
|
+
{ property: "og:site_name", content: siteName },
|
|
1643
|
+
{ property: "og:url", content: canonical },
|
|
1644
|
+
{
|
|
1645
|
+
property: "og:locale",
|
|
1646
|
+
content: locale === "fr" ? "fr_FR" : locale ? "en_US" : undefined
|
|
1647
|
+
},
|
|
1648
|
+
...image ? [
|
|
1649
|
+
{ name: "twitter:image", content: image },
|
|
1650
|
+
{ property: "og:image", content: image }
|
|
1651
|
+
] : []
|
|
1652
|
+
].filter((tag) => !Object.hasOwn(tag, "content") || tag.content);
|
|
1653
|
+
const alternateLocales = locales2 ?? [];
|
|
1654
|
+
const links = canonical ? [
|
|
1655
|
+
{ rel: "canonical", href: canonical },
|
|
1656
|
+
...origin && alternateLocales.length > 0 ? alternateLocales.map((alternateLocale) => ({
|
|
1657
|
+
rel: "alternate",
|
|
1658
|
+
hrefLang: alternateLocale,
|
|
1659
|
+
href: localizedUrl(origin, alternateLocale, path)
|
|
1660
|
+
})) : [],
|
|
1661
|
+
...origin && alternateLocales.length > 0 ? [
|
|
1662
|
+
{
|
|
1663
|
+
rel: "alternate",
|
|
1664
|
+
hrefLang: "x-default",
|
|
1665
|
+
href: localizedUrl(origin, defaultLocale ?? alternateLocales[0] ?? "en", path)
|
|
1666
|
+
}
|
|
1667
|
+
] : []
|
|
1668
|
+
] : [];
|
|
1669
|
+
const siteUrl = origin?.replace(/\/$/, "") ?? canonical;
|
|
1670
|
+
const publisher = {
|
|
1671
|
+
"@type": "Organization",
|
|
1672
|
+
name: siteName,
|
|
1673
|
+
...siteUrl ? { url: siteUrl } : {},
|
|
1674
|
+
...sameAs?.length ? { sameAs } : {}
|
|
1675
|
+
};
|
|
1676
|
+
const structuredData = type === "article" ? {
|
|
1677
|
+
"@type": "Article",
|
|
1678
|
+
headline: title,
|
|
1679
|
+
description,
|
|
1680
|
+
...canonical ? { url: canonical } : {},
|
|
1681
|
+
...locale ? { inLanguage: locale } : {},
|
|
1682
|
+
...image ? { image } : {},
|
|
1683
|
+
publisher
|
|
1684
|
+
} : {
|
|
1685
|
+
"@type": "WebSite",
|
|
1686
|
+
name: siteName,
|
|
1687
|
+
...siteUrl ? { url: siteUrl } : {},
|
|
1688
|
+
publisher
|
|
1689
|
+
};
|
|
1690
|
+
const scripts = [
|
|
1691
|
+
{
|
|
1692
|
+
type: "application/ld+json",
|
|
1693
|
+
children: JSON.stringify({
|
|
1694
|
+
"@context": "https://schema.org",
|
|
1695
|
+
...structuredData
|
|
1696
|
+
})
|
|
1697
|
+
}
|
|
1698
|
+
];
|
|
1699
|
+
return { meta: tags, links, scripts };
|
|
1700
|
+
};
|
|
1701
|
+
var createSeo = (defaults) => (options) => seo({
|
|
1702
|
+
...defaults,
|
|
1703
|
+
...options
|
|
1704
|
+
});
|
|
1705
|
+
|
|
1597
1706
|
// ../../src/lib/docs-core.tsx
|
|
1598
1707
|
import { jsx as jsx14, jsxs as jsxs9, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
1599
1708
|
addCollection(lucideIcons);
|
|
@@ -1612,7 +1721,7 @@ var DocsFrontmatter = Schema2.Struct({
|
|
|
1612
1721
|
path: Schema2.String,
|
|
1613
1722
|
title: Schema2.String,
|
|
1614
1723
|
description: Schema2.String,
|
|
1615
|
-
icon: Schema2.String,
|
|
1724
|
+
icon: Schema2.optional(Schema2.String),
|
|
1616
1725
|
order: Schema2.Number,
|
|
1617
1726
|
locale: Schema2.String,
|
|
1618
1727
|
section: DocsSection,
|
|
@@ -1701,7 +1810,7 @@ var validateDocsPages = (pages, config) => {
|
|
|
1701
1810
|
const orders = new Set;
|
|
1702
1811
|
const routeSlugs = new Set;
|
|
1703
1812
|
for (const page of localized) {
|
|
1704
|
-
if (!/^[a-z0-9-]+:[a-z0-9-]+$/.test(page.icon)) {
|
|
1813
|
+
if (page.icon && !/^[a-z0-9-]+:[a-z0-9-]+$/.test(page.icon)) {
|
|
1705
1814
|
throw new Error(`${page.sourceFile} must use an Iconify icon name`);
|
|
1706
1815
|
}
|
|
1707
1816
|
if (config.matchesLocale && !config.matchesLocale(page.sourceFile, locale)) {
|
|
@@ -1795,6 +1904,12 @@ var makeDocs = (config) => {
|
|
|
1795
1904
|
icon: "lucide:book-open",
|
|
1796
1905
|
href: "/"
|
|
1797
1906
|
};
|
|
1907
|
+
const docsSeo = createSeo({
|
|
1908
|
+
origin,
|
|
1909
|
+
locales: source.locales,
|
|
1910
|
+
...config.defaultLocale ? { defaultLocale: config.defaultLocale } : {},
|
|
1911
|
+
siteName: config.siteName
|
|
1912
|
+
});
|
|
1798
1913
|
const getMessages = (locale) => getDocsMessages(locale, config.messages?.(locale));
|
|
1799
1914
|
const normalizeSearchText = (value) => value.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
1800
1915
|
const searchIndex = source.pages.flatMap((page) => {
|
|
@@ -1879,7 +1994,7 @@ var makeDocs = (config) => {
|
|
|
1879
1994
|
}));
|
|
1880
1995
|
};
|
|
1881
1996
|
const url = (page, locale) => `${origin}/${locale}${page.path}`;
|
|
1882
|
-
const editUrl = (page) => githubUrl ? `${githubUrl}/edit/${config.github?.branch ?? "main"}/${page.sourceFile}` : undefined;
|
|
1997
|
+
const editUrl = (page) => githubUrl && (config.editable?.(page) ?? true) ? `${githubUrl}/edit/${config.github?.branch ?? "main"}/${page.sourceFile}` : undefined;
|
|
1883
1998
|
const getHead = ({
|
|
1884
1999
|
locale,
|
|
1885
2000
|
page
|
|
@@ -1888,32 +2003,13 @@ var makeDocs = (config) => {
|
|
|
1888
2003
|
const path = page?.path ?? basePath;
|
|
1889
2004
|
const title = `${page?.title ?? resolvedMessages.title} | ${config.siteName}`;
|
|
1890
2005
|
const description = page?.description ?? resolvedMessages.description;
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
{ property: "og:description", content: description },
|
|
1899
|
-
{ property: "og:type", content: "article" },
|
|
1900
|
-
{ property: "og:url", content: canonical },
|
|
1901
|
-
{ property: "og:site_name", content: config.siteName }
|
|
1902
|
-
],
|
|
1903
|
-
links: [
|
|
1904
|
-
{ rel: "canonical", href: canonical },
|
|
1905
|
-
...source.locales.map((alternateLocale) => ({
|
|
1906
|
-
rel: "alternate",
|
|
1907
|
-
hrefLang: alternateLocale,
|
|
1908
|
-
href: `${origin}/${alternateLocale}${path}`
|
|
1909
|
-
})),
|
|
1910
|
-
{
|
|
1911
|
-
rel: "alternate",
|
|
1912
|
-
hrefLang: "x-default",
|
|
1913
|
-
href: `${origin}/${defaultLocale}${path}`
|
|
1914
|
-
}
|
|
1915
|
-
]
|
|
1916
|
-
};
|
|
2006
|
+
return docsSeo({
|
|
2007
|
+
title,
|
|
2008
|
+
description,
|
|
2009
|
+
path,
|
|
2010
|
+
locale,
|
|
2011
|
+
type: "article"
|
|
2012
|
+
});
|
|
1917
2013
|
};
|
|
1918
2014
|
return {
|
|
1919
2015
|
basePath,
|
|
@@ -2031,6 +2127,7 @@ var getDocsMessages = (locale, overrides) => ({
|
|
|
2031
2127
|
...overrides
|
|
2032
2128
|
});
|
|
2033
2129
|
var iconComponents = new Map;
|
|
2130
|
+
var EmptyIcon = forwardRef(() => null);
|
|
2034
2131
|
var iconFor = (name) => {
|
|
2035
2132
|
const existing = iconComponents.get(name);
|
|
2036
2133
|
if (existing)
|
|
@@ -2255,11 +2352,13 @@ var DocsSearch = ({
|
|
|
2255
2352
|
id: page.path,
|
|
2256
2353
|
label: page.title,
|
|
2257
2354
|
description: page.description,
|
|
2258
|
-
icon
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2355
|
+
...page.icon ? {
|
|
2356
|
+
icon: /* @__PURE__ */ jsx14(Icon, {
|
|
2357
|
+
className: "size-4",
|
|
2358
|
+
icon: page.icon,
|
|
2359
|
+
ssr: true
|
|
2360
|
+
})
|
|
2361
|
+
} : {},
|
|
2263
2362
|
onSelect: () => navigate({ to: page.path })
|
|
2264
2363
|
})
|
|
2265
2364
|
};
|
|
@@ -2291,7 +2390,7 @@ var DocsLayout = ({
|
|
|
2291
2390
|
items: section.pages.map((item) => ({
|
|
2292
2391
|
label: () => item.title,
|
|
2293
2392
|
href: item.path,
|
|
2294
|
-
icon: iconFor(item.icon)
|
|
2393
|
+
icon: item.icon ? iconFor(item.icon) : EmptyIcon
|
|
2295
2394
|
}))
|
|
2296
2395
|
}));
|
|
2297
2396
|
if (resources) {
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export type SeoOptions = {
|
|
2
|
+
title: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
image?: string;
|
|
5
|
+
keywords?: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
origin?: string;
|
|
8
|
+
path?: string;
|
|
9
|
+
locale?: string;
|
|
10
|
+
locales?: readonly string[];
|
|
11
|
+
defaultLocale?: string;
|
|
12
|
+
robots?: string;
|
|
13
|
+
siteName?: string;
|
|
14
|
+
twitterCreator?: string;
|
|
15
|
+
twitterSite?: string;
|
|
16
|
+
type?: "website" | "article";
|
|
17
|
+
sameAs?: readonly string[];
|
|
18
|
+
};
|
|
19
|
+
export type SeoDefaults = {
|
|
20
|
+
origin: string;
|
|
21
|
+
locales?: readonly string[];
|
|
22
|
+
defaultLocale?: string;
|
|
23
|
+
siteName?: string;
|
|
24
|
+
twitterCreator?: string;
|
|
25
|
+
twitterSite?: string;
|
|
26
|
+
sameAs?: readonly string[];
|
|
27
|
+
};
|
|
28
|
+
export type SeoPageOptions = Omit<SeoOptions, keyof SeoDefaults>;
|
|
29
|
+
export declare const seo: ({ title, description, image, keywords, url, origin, path, locale, locales, defaultLocale, robots, siteName, twitterCreator, twitterSite, type, sameAs, }: SeoOptions) => {
|
|
30
|
+
meta: ({
|
|
31
|
+
title: string;
|
|
32
|
+
name?: undefined;
|
|
33
|
+
property?: undefined;
|
|
34
|
+
content?: undefined;
|
|
35
|
+
} | {
|
|
36
|
+
title?: undefined;
|
|
37
|
+
name: string;
|
|
38
|
+
content: string | undefined;
|
|
39
|
+
property?: undefined;
|
|
40
|
+
} | {
|
|
41
|
+
title?: undefined;
|
|
42
|
+
name?: undefined;
|
|
43
|
+
property: string;
|
|
44
|
+
content: string | undefined;
|
|
45
|
+
})[];
|
|
46
|
+
links: ({
|
|
47
|
+
rel: string;
|
|
48
|
+
href: string;
|
|
49
|
+
} | {
|
|
50
|
+
rel: string;
|
|
51
|
+
hrefLang: string;
|
|
52
|
+
href: string;
|
|
53
|
+
})[];
|
|
54
|
+
scripts: {
|
|
55
|
+
type: string;
|
|
56
|
+
children: string;
|
|
57
|
+
}[];
|
|
58
|
+
};
|
|
59
|
+
export declare const createSeo: (defaults: SeoDefaults) => (options: SeoPageOptions) => {
|
|
60
|
+
meta: ({
|
|
61
|
+
title: string;
|
|
62
|
+
name?: undefined;
|
|
63
|
+
property?: undefined;
|
|
64
|
+
content?: undefined;
|
|
65
|
+
} | {
|
|
66
|
+
title?: undefined;
|
|
67
|
+
name: string;
|
|
68
|
+
content: string | undefined;
|
|
69
|
+
property?: undefined;
|
|
70
|
+
} | {
|
|
71
|
+
title?: undefined;
|
|
72
|
+
name?: undefined;
|
|
73
|
+
property: string;
|
|
74
|
+
content: string | undefined;
|
|
75
|
+
})[];
|
|
76
|
+
links: ({
|
|
77
|
+
rel: string;
|
|
78
|
+
href: string;
|
|
79
|
+
} | {
|
|
80
|
+
rel: string;
|
|
81
|
+
hrefLang: string;
|
|
82
|
+
href: string;
|
|
83
|
+
})[];
|
|
84
|
+
scripts: {
|
|
85
|
+
type: string;
|
|
86
|
+
children: string;
|
|
87
|
+
}[];
|
|
88
|
+
};
|
package/dist/lib/seo.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// ../../src/lib/seo.ts
|
|
2
|
+
var localizedUrl = (origin, locale, path) => `${origin.replace(/\/$/, "")}/${locale}${path === "/" ? "/" : path}`;
|
|
3
|
+
var seo = ({
|
|
4
|
+
title,
|
|
5
|
+
description,
|
|
6
|
+
image,
|
|
7
|
+
keywords,
|
|
8
|
+
url,
|
|
9
|
+
origin,
|
|
10
|
+
path = "/",
|
|
11
|
+
locale,
|
|
12
|
+
locales,
|
|
13
|
+
defaultLocale,
|
|
14
|
+
robots = "index, follow",
|
|
15
|
+
siteName = "KrakStack",
|
|
16
|
+
twitterCreator = "@krak",
|
|
17
|
+
twitterSite = "@krak",
|
|
18
|
+
type = "website",
|
|
19
|
+
sameAs
|
|
20
|
+
}) => {
|
|
21
|
+
const canonical = url ?? (origin && locale ? localizedUrl(origin, locale, path) : undefined);
|
|
22
|
+
const tags = [
|
|
23
|
+
{ title },
|
|
24
|
+
{ name: "description", content: description },
|
|
25
|
+
{ name: "keywords", content: keywords },
|
|
26
|
+
{ name: "robots", content: robots },
|
|
27
|
+
{ name: "twitter:title", content: title },
|
|
28
|
+
{ name: "twitter:description", content: description },
|
|
29
|
+
{ name: "twitter:creator", content: twitterCreator },
|
|
30
|
+
{ name: "twitter:site", content: twitterSite },
|
|
31
|
+
{
|
|
32
|
+
name: "twitter:card",
|
|
33
|
+
content: image ? "summary_large_image" : "summary"
|
|
34
|
+
},
|
|
35
|
+
{ property: "og:type", content: type },
|
|
36
|
+
{ property: "og:title", content: title },
|
|
37
|
+
{ property: "og:description", content: description },
|
|
38
|
+
{ property: "og:site_name", content: siteName },
|
|
39
|
+
{ property: "og:url", content: canonical },
|
|
40
|
+
{
|
|
41
|
+
property: "og:locale",
|
|
42
|
+
content: locale === "fr" ? "fr_FR" : locale ? "en_US" : undefined
|
|
43
|
+
},
|
|
44
|
+
...image ? [
|
|
45
|
+
{ name: "twitter:image", content: image },
|
|
46
|
+
{ property: "og:image", content: image }
|
|
47
|
+
] : []
|
|
48
|
+
].filter((tag) => !Object.hasOwn(tag, "content") || tag.content);
|
|
49
|
+
const alternateLocales = locales ?? [];
|
|
50
|
+
const links = canonical ? [
|
|
51
|
+
{ rel: "canonical", href: canonical },
|
|
52
|
+
...origin && alternateLocales.length > 0 ? alternateLocales.map((alternateLocale) => ({
|
|
53
|
+
rel: "alternate",
|
|
54
|
+
hrefLang: alternateLocale,
|
|
55
|
+
href: localizedUrl(origin, alternateLocale, path)
|
|
56
|
+
})) : [],
|
|
57
|
+
...origin && alternateLocales.length > 0 ? [
|
|
58
|
+
{
|
|
59
|
+
rel: "alternate",
|
|
60
|
+
hrefLang: "x-default",
|
|
61
|
+
href: localizedUrl(origin, defaultLocale ?? alternateLocales[0] ?? "en", path)
|
|
62
|
+
}
|
|
63
|
+
] : []
|
|
64
|
+
] : [];
|
|
65
|
+
const siteUrl = origin?.replace(/\/$/, "") ?? canonical;
|
|
66
|
+
const publisher = {
|
|
67
|
+
"@type": "Organization",
|
|
68
|
+
name: siteName,
|
|
69
|
+
...siteUrl ? { url: siteUrl } : {},
|
|
70
|
+
...sameAs?.length ? { sameAs } : {}
|
|
71
|
+
};
|
|
72
|
+
const structuredData = type === "article" ? {
|
|
73
|
+
"@type": "Article",
|
|
74
|
+
headline: title,
|
|
75
|
+
description,
|
|
76
|
+
...canonical ? { url: canonical } : {},
|
|
77
|
+
...locale ? { inLanguage: locale } : {},
|
|
78
|
+
...image ? { image } : {},
|
|
79
|
+
publisher
|
|
80
|
+
} : {
|
|
81
|
+
"@type": "WebSite",
|
|
82
|
+
name: siteName,
|
|
83
|
+
...siteUrl ? { url: siteUrl } : {},
|
|
84
|
+
publisher
|
|
85
|
+
};
|
|
86
|
+
const scripts = [
|
|
87
|
+
{
|
|
88
|
+
type: "application/ld+json",
|
|
89
|
+
children: JSON.stringify({
|
|
90
|
+
"@context": "https://schema.org",
|
|
91
|
+
...structuredData
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
return { meta: tags, links, scripts };
|
|
96
|
+
};
|
|
97
|
+
var createSeo = (defaults) => (options) => seo({
|
|
98
|
+
...defaults,
|
|
99
|
+
...options
|
|
100
|
+
});
|
|
101
|
+
export {
|
|
102
|
+
seo,
|
|
103
|
+
createSeo
|
|
104
|
+
};
|
|
@@ -927,6 +927,14 @@ var routeStrategies = [
|
|
|
927
927
|
{
|
|
928
928
|
match: "/api/:path(.*)?",
|
|
929
929
|
exclude: true
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
match: "/sitemap.xml",
|
|
933
|
+
exclude: true
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
match: "/llms.txt",
|
|
937
|
+
exclude: true
|
|
930
938
|
}
|
|
931
939
|
];
|
|
932
940
|
var urlPatterns = [
|
|
@@ -1394,12 +1402,7 @@ var AgentEvent = Schema.Union([
|
|
|
1394
1402
|
Schema.Struct({ type: Schema.Literal("finish") }),
|
|
1395
1403
|
Schema.Struct({
|
|
1396
1404
|
type: Schema.Literal("error"),
|
|
1397
|
-
code: Schema.Literals([
|
|
1398
|
-
"unavailable",
|
|
1399
|
-
"invalid-request",
|
|
1400
|
-
"round-limit",
|
|
1401
|
-
"stream-failed"
|
|
1402
|
-
])
|
|
1405
|
+
code: Schema.Literals(["unavailable", "invalid-request", "stream-failed"])
|
|
1403
1406
|
})
|
|
1404
1407
|
]).annotate({
|
|
1405
1408
|
identifier: "AgentEvent",
|
|
@@ -1428,7 +1431,6 @@ var messages = {
|
|
|
1428
1431
|
copy: "Copy",
|
|
1429
1432
|
description: "Ask questions and use available tools to get things done.",
|
|
1430
1433
|
errorInvalidRequest: "The request could not be processed. Start a new conversation and try again.",
|
|
1431
|
-
errorRoundLimit: "The assistant stopped after too many API steps. Try a more specific request.",
|
|
1432
1434
|
errorStreamFailed: "The response was interrupted. Please try again.",
|
|
1433
1435
|
errorUnavailable: "The assistant is currently unavailable.",
|
|
1434
1436
|
maximize: "Maximize assistant",
|
|
@@ -1462,7 +1464,6 @@ var messages = {
|
|
|
1462
1464
|
copy: "Copier",
|
|
1463
1465
|
description: "Posez des questions et utilisez les outils disponibles pour accomplir vos tâches.",
|
|
1464
1466
|
errorInvalidRequest: "La demande n'a pas pu être traitée. Commencez une nouvelle conversation et réessayez.",
|
|
1465
|
-
errorRoundLimit: "L'assistant s'est arrêté après trop d'étapes d'API. Essayez une demande plus précise.",
|
|
1466
1467
|
errorStreamFailed: "La réponse a été interrompue. Veuillez réessayer.",
|
|
1467
1468
|
errorUnavailable: "L'assistant est actuellement indisponible.",
|
|
1468
1469
|
maximize: "Agrandir l'assistant",
|
|
@@ -1494,8 +1495,6 @@ var errorMessage = (code2, labels) => {
|
|
|
1494
1495
|
switch (code2) {
|
|
1495
1496
|
case "invalid-request":
|
|
1496
1497
|
return labels.errorInvalidRequest;
|
|
1497
|
-
case "round-limit":
|
|
1498
|
-
return labels.errorRoundLimit;
|
|
1499
1498
|
case "stream-failed":
|
|
1500
1499
|
return labels.errorStreamFailed;
|
|
1501
1500
|
case "unavailable":
|
|
@@ -1520,7 +1519,7 @@ var highlightedInput = (input, references) => {
|
|
|
1520
1519
|
const mentionPattern = new RegExp(`(${mentions.map(escapeRegExp).join("|")})(?![\\p{L}\\p{N}_-])`, "gu");
|
|
1521
1520
|
const mentionSet = new Set(mentions);
|
|
1522
1521
|
return input.split(mentionPattern).map((part, index) => mentionSet.has(part) ? /* @__PURE__ */ jsx17("span", {
|
|
1523
|
-
className: "text-primary",
|
|
1522
|
+
className: "bg-primary text-primary-foreground rounded-sm [box-shadow:2px_0_0_var(--primary),-2px_0_0_var(--primary)]",
|
|
1524
1523
|
children: part
|
|
1525
1524
|
}, `${part}:${index}`) : part);
|
|
1526
1525
|
};
|
|
@@ -1871,6 +1870,7 @@ function AgentWidget({
|
|
|
1871
1870
|
const [referencePickerOpen, setReferencePickerOpen] = useState(false);
|
|
1872
1871
|
const [activeReferenceKey, setActiveReferenceKey] = useState("");
|
|
1873
1872
|
const [input, setInput] = useState("");
|
|
1873
|
+
const inputOverlayRef = useRef(null);
|
|
1874
1874
|
const [references, setReferences] = useState([]);
|
|
1875
1875
|
const activeContext = state.contextLocked ? state.context ? {
|
|
1876
1876
|
...state.context,
|
|
@@ -1961,7 +1961,7 @@ function AgentWidget({
|
|
|
1961
1961
|
className: "flex items-center gap-1",
|
|
1962
1962
|
children: [
|
|
1963
1963
|
/* @__PURE__ */ jsx17(DialogTitle, {
|
|
1964
|
-
className: "min-w-0 flex-1 truncate",
|
|
1964
|
+
className: "min-w-0 flex-1 truncate text-sm leading-none font-medium",
|
|
1965
1965
|
children: labels.title
|
|
1966
1966
|
}),
|
|
1967
1967
|
/* @__PURE__ */ jsxs5(Button, {
|
|
@@ -2005,7 +2005,7 @@ function AgentWidget({
|
|
|
2005
2005
|
})
|
|
2006
2006
|
}),
|
|
2007
2007
|
/* @__PURE__ */ jsx17("div", {
|
|
2008
|
-
className: "min-h-0 flex-1",
|
|
2008
|
+
className: "min-h-0 flex-1 overflow-hidden",
|
|
2009
2009
|
children: state.messages.length === 0 && !state.error ? /* @__PURE__ */ jsx17(Empty, {
|
|
2010
2010
|
className: "h-full",
|
|
2011
2011
|
children: /* @__PURE__ */ jsxs5(EmptyHeader, {
|
|
@@ -2028,6 +2028,7 @@ function AgentWidget({
|
|
|
2028
2028
|
children: [
|
|
2029
2029
|
/* @__PURE__ */ jsx17(MessageScrollerViewport, {
|
|
2030
2030
|
"aria-label": labels.title,
|
|
2031
|
+
className: "[scrollbar-width:thin] [scrollbar-color:var(--border)_transparent]",
|
|
2031
2032
|
children: /* @__PURE__ */ jsxs5(MessageScrollerContent, {
|
|
2032
2033
|
"aria-busy": state.pending,
|
|
2033
2034
|
className: "p-4",
|
|
@@ -2102,8 +2103,9 @@ function AgentWidget({
|
|
|
2102
2103
|
className: "relative w-full min-w-0 self-stretch text-left",
|
|
2103
2104
|
children: [
|
|
2104
2105
|
/* @__PURE__ */ jsx17("div", {
|
|
2106
|
+
ref: inputOverlayRef,
|
|
2105
2107
|
"aria-hidden": "true",
|
|
2106
|
-
className: "text-foreground pointer-events-none absolute inset-0 overflow-hidden px-2.5 py-2 text-left font-[inherit] text-base break-words whitespace-pre-wrap md:text-sm",
|
|
2108
|
+
className: "text-foreground pointer-events-none absolute inset-0 [scrollbar-width:thin] [scrollbar-gutter:stable] overflow-hidden px-2.5 py-2 text-left font-[inherit] text-base break-words whitespace-pre-wrap md:text-sm",
|
|
2107
2109
|
children: highlightedInput(input, references)
|
|
2108
2110
|
}),
|
|
2109
2111
|
/* @__PURE__ */ jsxs5(Popover, {
|
|
@@ -2113,7 +2115,7 @@ function AgentWidget({
|
|
|
2113
2115
|
/* @__PURE__ */ jsx17(PopoverTrigger, {
|
|
2114
2116
|
id: referenceInputId,
|
|
2115
2117
|
render: /* @__PURE__ */ jsx17(InputGroupTextarea, {
|
|
2116
|
-
className: "caret-foreground selection:bg-primary selection:text-primary-foreground relative w-full text-left text-transparent",
|
|
2118
|
+
className: "caret-foreground selection:bg-primary selection:text-primary-foreground relative max-h-32 w-full [scrollbar-width:thin] [scrollbar-color:var(--border)_transparent] [scrollbar-gutter:stable] overflow-y-auto overscroll-contain text-left text-transparent",
|
|
2117
2119
|
value: input,
|
|
2118
2120
|
placeholder: labels.placeholder,
|
|
2119
2121
|
"aria-label": labels.placeholder,
|
|
@@ -2124,6 +2126,11 @@ function AgentWidget({
|
|
|
2124
2126
|
disabled: state.pending || hasPendingApproval,
|
|
2125
2127
|
role: "combobox",
|
|
2126
2128
|
rows: 2,
|
|
2129
|
+
onScroll: (event) => {
|
|
2130
|
+
if (inputOverlayRef.current) {
|
|
2131
|
+
inputOverlayRef.current.scrollTop = event.currentTarget.scrollTop;
|
|
2132
|
+
}
|
|
2133
|
+
},
|
|
2127
2134
|
onChange: (event) => {
|
|
2128
2135
|
const value = event.target.value;
|
|
2129
2136
|
setInput(value);
|
|
@@ -47,7 +47,7 @@ declare const AgentService_base: Context.ServiceClass<AgentService, "AgentServic
|
|
|
47
47
|
readonly type: import("effect/Schema").Literal<"finish">;
|
|
48
48
|
}, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
|
|
49
49
|
readonly type: import("effect/Schema").Literal<"error">;
|
|
50
|
-
readonly code: import("effect/Schema").Literals<readonly ["unavailable", "invalid-request", "
|
|
50
|
+
readonly code: import("effect/Schema").Literals<readonly ["unavailable", "invalid-request", "stream-failed"]>;
|
|
51
51
|
}, "Type"> | {
|
|
52
52
|
type: "history";
|
|
53
53
|
value: string;
|
|
@@ -93,7 +93,7 @@ declare const AgentService_base: Context.ServiceClass<AgentService, "AgentServic
|
|
|
93
93
|
readonly type: import("effect/Schema").Literal<"finish">;
|
|
94
94
|
}, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
|
|
95
95
|
readonly type: import("effect/Schema").Literal<"error">;
|
|
96
|
-
readonly code: import("effect/Schema").Literals<readonly ["unavailable", "invalid-request", "
|
|
96
|
+
readonly code: import("effect/Schema").Literals<readonly ["unavailable", "invalid-request", "stream-failed"]>;
|
|
97
97
|
}, "Type"> | {
|
|
98
98
|
type: "history";
|
|
99
99
|
value: string;
|
|
@@ -80,7 +80,6 @@ class AgentService extends Context.Service()("AgentService", {
|
|
|
80
80
|
conversation,
|
|
81
81
|
messageId,
|
|
82
82
|
prompt,
|
|
83
|
-
round,
|
|
84
83
|
toolkit
|
|
85
84
|
}) => Stream.suspend(() => {
|
|
86
85
|
let hasApproval = false;
|
|
@@ -105,17 +104,10 @@ class AgentService extends Context.Service()("AgentService", {
|
|
|
105
104
|
code: "stream-failed"
|
|
106
105
|
});
|
|
107
106
|
}
|
|
108
|
-
if (round >= 5) {
|
|
109
|
-
return Stream.succeed({
|
|
110
|
-
type: "error",
|
|
111
|
-
code: "round-limit"
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
107
|
return agentRounds({
|
|
115
108
|
conversation,
|
|
116
109
|
messageId,
|
|
117
110
|
prompt: [],
|
|
118
|
-
round: round + 1,
|
|
119
111
|
toolkit
|
|
120
112
|
});
|
|
121
113
|
});
|
|
@@ -167,7 +159,6 @@ class AgentService extends Context.Service()("AgentService", {
|
|
|
167
159
|
conversation,
|
|
168
160
|
messageId,
|
|
169
161
|
prompt: action.type === "message" ? action.text : [],
|
|
170
|
-
round: 1,
|
|
171
162
|
toolkit
|
|
172
163
|
});
|
|
173
164
|
const complete = Stream.fromEffect(Effect.gen(function* () {
|
|
@@ -57,7 +57,7 @@ export declare const AgentEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
57
57
|
readonly type: Schema.Literal<"finish">;
|
|
58
58
|
}>, Schema.Struct<{
|
|
59
59
|
readonly type: Schema.Literal<"error">;
|
|
60
|
-
readonly code: Schema.Literals<readonly ["unavailable", "invalid-request", "
|
|
60
|
+
readonly code: Schema.Literals<readonly ["unavailable", "invalid-request", "stream-failed"]>;
|
|
61
61
|
}>]>;
|
|
62
62
|
export type AgentEvent = typeof AgentEvent.Type;
|
|
63
63
|
export type AgentErrorCode = Extract<AgentEvent, {
|
|
@@ -120,7 +120,7 @@ export declare const makeAgentApiGroup: <const Resource extends Schema.Top>(reso
|
|
|
120
120
|
readonly type: Schema.Literal<"finish">;
|
|
121
121
|
}>, Schema.Struct<{
|
|
122
122
|
readonly type: Schema.Literal<"error">;
|
|
123
|
-
readonly code: Schema.Literals<readonly ["unavailable", "invalid-request", "
|
|
123
|
+
readonly code: Schema.Literals<readonly ["unavailable", "invalid-request", "stream-failed"]>;
|
|
124
124
|
}>]>>, Schema.Struct<{
|
|
125
125
|
readonly code: Schema.Literals<readonly ["unavailable", "stream-failed"]>;
|
|
126
126
|
}>, Schema.Struct.ReadonlySide<{
|
|
@@ -157,5 +157,5 @@ export declare const makeAgentApiGroup: <const Resource extends Schema.Top>(reso
|
|
|
157
157
|
readonly type: Schema.Literal<"finish">;
|
|
158
158
|
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
159
159
|
readonly type: Schema.Literal<"error">;
|
|
160
|
-
readonly code: Schema.Literals<readonly ["unavailable", "invalid-request", "
|
|
160
|
+
readonly code: Schema.Literals<readonly ["unavailable", "invalid-request", "stream-failed"]>;
|
|
161
161
|
}, "Type">>, Schema.toCodecJson<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never>, false>;
|
|
@@ -79,12 +79,7 @@ var AgentEvent = Schema.Union([
|
|
|
79
79
|
Schema.Struct({ type: Schema.Literal("finish") }),
|
|
80
80
|
Schema.Struct({
|
|
81
81
|
type: Schema.Literal("error"),
|
|
82
|
-
code: Schema.Literals([
|
|
83
|
-
"unavailable",
|
|
84
|
-
"invalid-request",
|
|
85
|
-
"round-limit",
|
|
86
|
-
"stream-failed"
|
|
87
|
-
])
|
|
82
|
+
code: Schema.Literals(["unavailable", "invalid-request", "stream-failed"])
|
|
88
83
|
})
|
|
89
84
|
]).annotate({
|
|
90
85
|
identifier: "AgentEvent",
|