@agent-native/core 0.172.0 → 0.172.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-web/generator.d.ts +44 -10
- package/dist/agent-web/generator.js +38 -0
- package/dist/agent-web/index.d.ts +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/observability/routes.d.ts +3 -3
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/vite/agent-web-plugin.d.ts +4 -6
- package/dist/vite/agent-web-plugin.js +2 -0
- package/package.json +1 -1
|
@@ -7,17 +7,40 @@ export interface AgentWebPage {
|
|
|
7
7
|
markdownPath?: string;
|
|
8
8
|
lastmod?: string | Date;
|
|
9
9
|
}
|
|
10
|
+
export interface AgentWebResource {
|
|
11
|
+
title: string;
|
|
12
|
+
url: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AgentWebOrganization {
|
|
16
|
+
name: string;
|
|
17
|
+
url?: string;
|
|
18
|
+
sameAs?: string[];
|
|
19
|
+
contactPoint?: {
|
|
20
|
+
"@type": "ContactPoint";
|
|
21
|
+
contactType: string;
|
|
22
|
+
email?: string;
|
|
23
|
+
telephone?: string;
|
|
24
|
+
url?: string;
|
|
25
|
+
};
|
|
26
|
+
address?: {
|
|
27
|
+
"@type": "PostalAddress";
|
|
28
|
+
streetAddress?: string;
|
|
29
|
+
addressLocality?: string;
|
|
30
|
+
addressRegion?: string;
|
|
31
|
+
postalCode?: string;
|
|
32
|
+
addressCountry?: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
10
35
|
export interface BuildAgentWebStaticFilesOptions {
|
|
11
36
|
siteName: string;
|
|
12
37
|
siteUrl: string;
|
|
13
38
|
description?: string;
|
|
14
39
|
pages: AgentWebPage[];
|
|
15
40
|
config: AgentWebConfig;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
sameAs?: string[];
|
|
20
|
-
};
|
|
41
|
+
developerResources?: AgentWebResource[];
|
|
42
|
+
whenToUse?: string[];
|
|
43
|
+
organization?: AgentWebOrganization;
|
|
21
44
|
}
|
|
22
45
|
export interface AgentWebStaticFile {
|
|
23
46
|
path: string;
|
|
@@ -43,17 +66,28 @@ export declare function buildBaseJsonLd(options: {
|
|
|
43
66
|
siteName: string;
|
|
44
67
|
siteUrl: string;
|
|
45
68
|
description?: string;
|
|
46
|
-
organization?:
|
|
47
|
-
name: string;
|
|
48
|
-
url?: string;
|
|
49
|
-
sameAs?: string[];
|
|
50
|
-
};
|
|
69
|
+
organization?: AgentWebOrganization;
|
|
51
70
|
}): ({
|
|
52
71
|
"@context": string;
|
|
53
72
|
"@type": string;
|
|
54
73
|
name: string;
|
|
55
74
|
url: string;
|
|
56
75
|
sameAs?: string[] | undefined;
|
|
76
|
+
contactPoint?: {
|
|
77
|
+
"@type": "ContactPoint";
|
|
78
|
+
contactType: string;
|
|
79
|
+
email?: string;
|
|
80
|
+
telephone?: string;
|
|
81
|
+
url?: string;
|
|
82
|
+
} | undefined;
|
|
83
|
+
address?: {
|
|
84
|
+
"@type": "PostalAddress";
|
|
85
|
+
streetAddress?: string;
|
|
86
|
+
addressLocality?: string;
|
|
87
|
+
addressRegion?: string;
|
|
88
|
+
postalCode?: string;
|
|
89
|
+
addressCountry?: string;
|
|
90
|
+
} | undefined;
|
|
57
91
|
} | {
|
|
58
92
|
"@context": string;
|
|
59
93
|
"@type": string;
|
|
@@ -91,11 +91,24 @@ ${entries}
|
|
|
91
91
|
`;
|
|
92
92
|
}
|
|
93
93
|
export function buildLlmsTxt(options) {
|
|
94
|
+
const developerResources = options.developerResources ?? [];
|
|
95
|
+
const whenToUse = options.whenToUse ?? [];
|
|
94
96
|
const lines = [
|
|
95
97
|
`# ${options.siteName}`,
|
|
96
98
|
"",
|
|
97
99
|
options.description ? `> ${options.description}` : undefined,
|
|
98
100
|
options.description ? "" : undefined,
|
|
101
|
+
whenToUse.length ? "## When to use this" : undefined,
|
|
102
|
+
...whenToUse.map((instruction) => `- ${instruction}`),
|
|
103
|
+
whenToUse.length ? "" : undefined,
|
|
104
|
+
developerResources.length ? "## Developer resources" : undefined,
|
|
105
|
+
...developerResources.map((resource) => {
|
|
106
|
+
const description = resource.description
|
|
107
|
+
? `: ${resource.description}`
|
|
108
|
+
: "";
|
|
109
|
+
return `- [${resource.title}](${absoluteResourceUrl(options.siteUrl, resource.url)})${description}`;
|
|
110
|
+
}),
|
|
111
|
+
developerResources.length ? "" : undefined,
|
|
99
112
|
"## Pages",
|
|
100
113
|
...options.pages.map((page) => {
|
|
101
114
|
const description = page.description ? `: ${page.description}` : "";
|
|
@@ -110,11 +123,24 @@ export function buildLlmsTxt(options) {
|
|
|
110
123
|
return `${lines.join("\n")}\n`;
|
|
111
124
|
}
|
|
112
125
|
export function buildLlmsFullTxt(options) {
|
|
126
|
+
const developerResources = options.developerResources ?? [];
|
|
127
|
+
const whenToUse = options.whenToUse ?? [];
|
|
113
128
|
const lines = [
|
|
114
129
|
`# ${options.siteName}`,
|
|
115
130
|
"",
|
|
116
131
|
options.description ?? "",
|
|
117
132
|
"",
|
|
133
|
+
whenToUse.length ? "## When to use this" : undefined,
|
|
134
|
+
...whenToUse.map((instruction) => `- ${instruction}`),
|
|
135
|
+
whenToUse.length ? "" : undefined,
|
|
136
|
+
developerResources.length ? "## Developer resources" : undefined,
|
|
137
|
+
...developerResources.map((resource) => {
|
|
138
|
+
const description = resource.description
|
|
139
|
+
? `: ${resource.description}`
|
|
140
|
+
: "";
|
|
141
|
+
return `- [${resource.title}](${absoluteResourceUrl(options.siteUrl, resource.url)})${description}`;
|
|
142
|
+
}),
|
|
143
|
+
developerResources.length ? "" : undefined,
|
|
118
144
|
...options.pages.flatMap((page) => [
|
|
119
145
|
`## ${page.title}`,
|
|
120
146
|
"",
|
|
@@ -141,6 +167,12 @@ export function buildBaseJsonLd(options) {
|
|
|
141
167
|
...(options.organization?.sameAs?.length
|
|
142
168
|
? { sameAs: options.organization.sameAs }
|
|
143
169
|
: {}),
|
|
170
|
+
...(options.organization?.contactPoint
|
|
171
|
+
? { contactPoint: options.organization.contactPoint }
|
|
172
|
+
: {}),
|
|
173
|
+
...(options.organization?.address
|
|
174
|
+
? { address: options.organization.address }
|
|
175
|
+
: {}),
|
|
144
176
|
},
|
|
145
177
|
{
|
|
146
178
|
"@context": "https://schema.org",
|
|
@@ -188,6 +220,7 @@ export function buildMarkdownResponseHeaders(options) {
|
|
|
188
220
|
return {
|
|
189
221
|
"content-type": "text/markdown; charset=utf-8",
|
|
190
222
|
"x-markdown-tokens": String(estimateMarkdownTokens(options.markdown)),
|
|
223
|
+
vary: "Accept, Accept-Encoding",
|
|
191
224
|
link: `<${absoluteUrl(options.siteUrl, "/llms.txt")}>; rel="llms-txt", <${absoluteUrl(options.siteUrl, markdownUrlForPage(options.pagePath, options.markdownPath))}>; rel="alternate"; type="text/markdown"`,
|
|
192
225
|
};
|
|
193
226
|
}
|
|
@@ -213,6 +246,11 @@ export function absoluteUrl(siteUrl, pagePath) {
|
|
|
213
246
|
const path = normalizePagePath(pagePath);
|
|
214
247
|
return `${base}${path}`;
|
|
215
248
|
}
|
|
249
|
+
function absoluteResourceUrl(siteUrl, resourceUrl) {
|
|
250
|
+
return /^https?:\/\//i.test(resourceUrl)
|
|
251
|
+
? resourceUrl
|
|
252
|
+
: absoluteUrl(siteUrl, resourceUrl);
|
|
253
|
+
}
|
|
216
254
|
function normalizePagePath(pagePath) {
|
|
217
255
|
const withSlash = pagePath.startsWith("/") ? pagePath : `/${pagePath}`;
|
|
218
256
|
if (withSlash.length > 1 && withSlash.endsWith("/")) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { AGENT_WEB_CRAWLER_CATEGORIES, DEFAULT_AGENT_WEB_CRAWLER_POLICY, agentWebConfigFromPackageJson, deriveAgentWebPublicRoutes, normalizeAgentWebConfig, pathPatternMatches, resolveAgentWebCrawlerPolicy, type AgentWebConfig, type AgentWebCrawlerCategory, type AgentWebCrawlerDecision, type AgentWebCrawlerOverrides, type AgentWebCrawlerPolicy, type AgentWebInputConfig, type DeriveAgentWebPublicRoutesOptions, } from "./config.js";
|
|
2
|
-
export { AGENT_WEB_CRAWLER_USER_AGENTS, absoluteUrl, buildAgentWebStaticFiles, buildBaseJsonLd, buildLlmsFullTxt, buildLlmsTxt, buildMarkdownResponseHeaders, buildPageJsonLd, buildRobotsTxt, buildSitemapXml, estimateMarkdownTokens, markdownFilePathForPage, markdownUrlForPage, type AgentWebPage, type AgentWebStaticFile, type BuildAgentWebStaticFilesOptions, type MarkdownResponseHeadersOptions, } from "./generator.js";
|
|
2
|
+
export { AGENT_WEB_CRAWLER_USER_AGENTS, absoluteUrl, buildAgentWebStaticFiles, buildBaseJsonLd, buildLlmsFullTxt, buildLlmsTxt, buildMarkdownResponseHeaders, buildPageJsonLd, buildRobotsTxt, buildSitemapXml, estimateMarkdownTokens, markdownFilePathForPage, markdownUrlForPage, type AgentWebPage, type AgentWebOrganization, type AgentWebResource, type AgentWebStaticFile, type BuildAgentWebStaticFilesOptions, type MarkdownResponseHeadersOptions, } from "./generator.js";
|
|
@@ -62,11 +62,11 @@ export declare const postAwareness: import("h3").EventHandlerWithFetch<import("h
|
|
|
62
62
|
error: string;
|
|
63
63
|
states?: undefined;
|
|
64
64
|
} | {
|
|
65
|
-
error?: undefined;
|
|
66
65
|
states: {
|
|
67
66
|
clientId: number;
|
|
68
67
|
state: string;
|
|
69
68
|
}[];
|
|
69
|
+
error?: undefined;
|
|
70
70
|
}>>;
|
|
71
71
|
/**
|
|
72
72
|
* GET /_agent-native/collab/:docId/users
|
|
@@ -77,9 +77,9 @@ export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("
|
|
|
77
77
|
error: string;
|
|
78
78
|
users?: undefined;
|
|
79
79
|
} | {
|
|
80
|
-
error?: undefined;
|
|
81
80
|
users: {
|
|
82
81
|
clientId: number;
|
|
83
82
|
lastSeen: number;
|
|
84
83
|
}[];
|
|
84
|
+
error?: undefined;
|
|
85
85
|
}>>;
|
|
@@ -17,11 +17,11 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
17
17
|
id?: undefined;
|
|
18
18
|
provider?: undefined;
|
|
19
19
|
} | {
|
|
20
|
+
error?: undefined;
|
|
20
21
|
configured?: undefined;
|
|
21
22
|
connectPath?: undefined;
|
|
22
23
|
url: string;
|
|
23
24
|
id: string;
|
|
24
25
|
provider: string;
|
|
25
|
-
error?: undefined;
|
|
26
26
|
}>;
|
|
27
27
|
export default _default;
|
|
@@ -41,16 +41,16 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
41
41
|
thumbsUpRate: number;
|
|
42
42
|
avgEvalScore: number;
|
|
43
43
|
} | {
|
|
44
|
-
error?: undefined;
|
|
45
44
|
summary: import("./types.js").TraceSummary;
|
|
46
45
|
spans: import("./types.js").TraceSpan[];
|
|
47
46
|
id?: undefined;
|
|
47
|
+
error?: undefined;
|
|
48
48
|
ok?: undefined;
|
|
49
49
|
} | {
|
|
50
|
-
error?: undefined;
|
|
51
50
|
summary?: undefined;
|
|
52
51
|
spans?: undefined;
|
|
53
52
|
id: string;
|
|
53
|
+
error?: undefined;
|
|
54
54
|
ok?: undefined;
|
|
55
55
|
} | {
|
|
56
56
|
summary?: undefined;
|
|
@@ -59,9 +59,9 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
59
59
|
error: any;
|
|
60
60
|
ok?: undefined;
|
|
61
61
|
} | {
|
|
62
|
-
error?: undefined;
|
|
63
62
|
summary?: undefined;
|
|
64
63
|
spans?: undefined;
|
|
65
64
|
id?: undefined;
|
|
66
65
|
ok: boolean;
|
|
66
|
+
error?: undefined;
|
|
67
67
|
}>>;
|
|
@@ -48,8 +48,8 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
|
|
|
48
48
|
}>;
|
|
49
49
|
/** DELETE /_agent-native/resources/:id — delete a resource */
|
|
50
50
|
export declare function handleDeleteResource(event: any): Promise<{
|
|
51
|
-
error: string;
|
|
52
51
|
ok?: undefined;
|
|
52
|
+
error: string;
|
|
53
53
|
} | {
|
|
54
54
|
error?: undefined;
|
|
55
55
|
ok: boolean;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import type { Plugin } from "vite";
|
|
2
|
-
import { type AgentWebInputConfig, type AgentWebPage } from "../agent-web/index.js";
|
|
2
|
+
import { type AgentWebInputConfig, type AgentWebOrganization, type AgentWebPage, type AgentWebResource } from "../agent-web/index.js";
|
|
3
3
|
export interface AgentWebVitePluginOptions {
|
|
4
4
|
siteName: string;
|
|
5
5
|
siteUrl: string;
|
|
6
6
|
description?: string;
|
|
7
7
|
pages: AgentWebPage[] | (() => AgentWebPage[]);
|
|
8
|
+
developerResources?: AgentWebResource[];
|
|
9
|
+
whenToUse?: string[];
|
|
8
10
|
agentWeb?: AgentWebInputConfig | boolean;
|
|
9
11
|
outputDirs?: string[];
|
|
10
|
-
organization?:
|
|
11
|
-
name: string;
|
|
12
|
-
url?: string;
|
|
13
|
-
sameAs?: string[];
|
|
14
|
-
};
|
|
12
|
+
organization?: AgentWebOrganization;
|
|
15
13
|
}
|
|
16
14
|
export declare function createAgentWebVitePlugin(options: AgentWebVitePluginOptions): Plugin;
|
|
@@ -22,6 +22,8 @@ export function createAgentWebVitePlugin(options) {
|
|
|
22
22
|
description: options.description,
|
|
23
23
|
pages,
|
|
24
24
|
config,
|
|
25
|
+
developerResources: options.developerResources,
|
|
26
|
+
whenToUse: options.whenToUse,
|
|
25
27
|
organization: options.organization,
|
|
26
28
|
});
|
|
27
29
|
const outputDirs = options.outputDirs ?? [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.172.
|
|
3
|
+
"version": "0.172.1",
|
|
4
4
|
"description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|