@agent-native/core 0.172.0 → 0.172.2
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/corpus/templates/calendar/changelog/2026-08-24-overlapping-events-use-space-better.md +1 -0
- package/dist/agent/production-agent.js +18 -1
- 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/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/resources/handlers.d.ts +2 -2
- package/dist/secrets/routes.d.ts +6 -6
- package/dist/vite/agent-web-plugin.d.ts +4 -6
- package/dist/vite/agent-web-plugin.js +2 -0
- package/package.json +1 -1
|
@@ -4431,6 +4431,12 @@ export async function runAgentLoop(opts) {
|
|
|
4431
4431
|
completedSideEffect: false,
|
|
4432
4432
|
});
|
|
4433
4433
|
recordToolResult(result, false);
|
|
4434
|
+
// Control is genuinely handed to the user here — the result above
|
|
4435
|
+
// tells the model "the turn is paused". `requestedActionStop` alone
|
|
4436
|
+
// does not stop anything until after the tool loop drains, so
|
|
4437
|
+
// without this the *rest* of this assistant message still executes
|
|
4438
|
+
// while the human is still looking at the approval card.
|
|
4439
|
+
turnYieldedToUser = true;
|
|
4434
4440
|
requestedActionStop ??= {
|
|
4435
4441
|
message: `Waiting for your approval to run ${toolCall.name}.`,
|
|
4436
4442
|
errorCode: "needs-approval",
|
|
@@ -5029,6 +5035,16 @@ export async function runAgentLoop(opts) {
|
|
|
5029
5035
|
// call and break the model's intended sequencing.
|
|
5030
5036
|
if (!entry)
|
|
5031
5037
|
return null;
|
|
5038
|
+
// A call that can pause the turn must not share a batch. `flushParallelBatch`
|
|
5039
|
+
// dispatches through `Promise.all`, so a gated call and its siblings all
|
|
5040
|
+
// start before the gate is reached, and `turnYieldedToUser` would then be
|
|
5041
|
+
// set too late to stop a sibling that already ran. Serializing here is what
|
|
5042
|
+
// makes that flag mean anything for the calls after it. `needsApproval` may
|
|
5043
|
+
// be an async predicate, so this cannot resolve whether approval is truly
|
|
5044
|
+
// required — declaring it at all is enough to serialize.
|
|
5045
|
+
if (entry.needsApproval !== undefined || entry.endsTurn === true) {
|
|
5046
|
+
return null;
|
|
5047
|
+
}
|
|
5032
5048
|
if (entry.readOnly === true)
|
|
5033
5049
|
return "read";
|
|
5034
5050
|
if (entry.parallelSafe === true)
|
|
@@ -5056,7 +5072,8 @@ export async function runAgentLoop(opts) {
|
|
|
5056
5072
|
// as not executed rather than running them: a second `ask-question` would
|
|
5057
5073
|
// overwrite the first one's card before anyone could answer it.
|
|
5058
5074
|
const skipToolCallAfterYield = (toolCall) => {
|
|
5059
|
-
const result = `Not executed: ${toolCall.name} was called after an action that
|
|
5075
|
+
const result = `Not executed: ${toolCall.name} was called after an action that paused the turn ` +
|
|
5076
|
+
`(an action that ends the turn, or one waiting on the user's approval). ` +
|
|
5060
5077
|
`The turn is paused for the user's answer — call it again on a later turn if still needed.`;
|
|
5061
5078
|
send({
|
|
5062
5079
|
type: "tool_start",
|
|
@@ -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";
|
package/dist/collab/routes.d.ts
CHANGED
|
@@ -26,8 +26,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
|
|
|
26
26
|
* Body: { update: string (base64), requestSource?: string }
|
|
27
27
|
*/
|
|
28
28
|
export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
29
|
-
ok?: undefined;
|
|
30
29
|
error: string;
|
|
30
|
+
ok?: undefined;
|
|
31
31
|
} | {
|
|
32
32
|
error?: undefined;
|
|
33
33
|
ok: boolean;
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* Body: { json: any, fieldName?: string, type?: "map"|"array", requestSource?: string }
|
|
14
14
|
*/
|
|
15
15
|
export declare const postCollabJson: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
16
|
-
error: string;
|
|
17
16
|
ok?: undefined;
|
|
17
|
+
error: string;
|
|
18
18
|
} | {
|
|
19
19
|
error?: undefined;
|
|
20
20
|
ok: boolean;
|
|
@@ -51,8 +51,8 @@ export declare function handleDeleteResource(event: any): Promise<{
|
|
|
51
51
|
error: string;
|
|
52
52
|
ok?: undefined;
|
|
53
53
|
} | {
|
|
54
|
-
error?: undefined;
|
|
55
54
|
ok: boolean;
|
|
55
|
+
error?: undefined;
|
|
56
56
|
}>;
|
|
57
57
|
/** POST /_agent-native/resources/upload — upload a file as a resource */
|
|
58
58
|
export declare function handleUploadResource(event: any): Promise<import("./store.js").Resource | {
|
|
@@ -73,10 +73,10 @@ export declare function handleUploadResource(event: any): Promise<import("./stor
|
|
|
73
73
|
runId: string | null;
|
|
74
74
|
expiresAt: number | null;
|
|
75
75
|
metadata: string | null;
|
|
76
|
-
error?: undefined;
|
|
77
76
|
url: string;
|
|
78
77
|
provider: string;
|
|
79
78
|
storageSetupRequired?: undefined;
|
|
79
|
+
error?: undefined;
|
|
80
80
|
} | {
|
|
81
81
|
error: string;
|
|
82
82
|
storageSetupRequired: boolean;
|
package/dist/secrets/routes.d.ts
CHANGED
|
@@ -37,17 +37,17 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
|
|
|
37
37
|
ok?: undefined;
|
|
38
38
|
status?: undefined;
|
|
39
39
|
} | {
|
|
40
|
+
error?: undefined;
|
|
40
41
|
ok: boolean;
|
|
41
42
|
status: string;
|
|
42
|
-
error?: undefined;
|
|
43
43
|
} | {
|
|
44
44
|
ok?: undefined;
|
|
45
45
|
error: string;
|
|
46
46
|
removed?: undefined;
|
|
47
47
|
} | {
|
|
48
|
+
error?: undefined;
|
|
48
49
|
ok: boolean;
|
|
49
50
|
removed: boolean;
|
|
50
|
-
error?: undefined;
|
|
51
51
|
}>>;
|
|
52
52
|
/**
|
|
53
53
|
* POST /_agent-native/secrets/:key/test — validate an optional candidate value
|
|
@@ -58,13 +58,13 @@ export declare function createTestSecretHandler(): import("h3").EventHandlerWith
|
|
|
58
58
|
error: string;
|
|
59
59
|
note?: undefined;
|
|
60
60
|
} | {
|
|
61
|
+
error?: undefined;
|
|
61
62
|
ok: boolean;
|
|
62
63
|
note?: undefined;
|
|
63
|
-
error?: undefined;
|
|
64
64
|
} | {
|
|
65
|
+
error?: undefined;
|
|
65
66
|
ok: boolean;
|
|
66
67
|
note: string;
|
|
67
|
-
error?: undefined;
|
|
68
68
|
} | {
|
|
69
69
|
note?: undefined;
|
|
70
70
|
ok: boolean;
|
|
@@ -95,11 +95,11 @@ export interface AdHocSecretPayload {
|
|
|
95
95
|
export declare function createAdHocSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<AdHocSecretPayload[] | {
|
|
96
96
|
error: string;
|
|
97
97
|
} | {
|
|
98
|
+
error?: undefined;
|
|
98
99
|
ok: boolean;
|
|
99
100
|
key: string;
|
|
100
|
-
error?: undefined;
|
|
101
101
|
} | {
|
|
102
|
+
error?: undefined;
|
|
102
103
|
ok: boolean;
|
|
103
104
|
removed: boolean;
|
|
104
|
-
error?: undefined;
|
|
105
105
|
}>>;
|
|
@@ -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.2",
|
|
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": {
|