@agent-native/core 0.209.0-nightly-20261014124140 → 0.209.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/production-agent.d.ts +8 -0
- package/dist/agent/production-agent.js +68 -3
- package/dist/agent/strict-tool-input.d.ts +4 -0
- package/dist/agent/strict-tool-input.js +26 -0
- package/dist/agent/types.d.ts +7 -0
- package/dist/cli/skills-content/turn-into-app-attachments.d.ts +1 -1
- package/dist/cli/skills-content/turn-into-app-attachments.js +1 -3
- package/dist/cli/skills-content/turn-into-app-skill.d.ts +2 -2
- package/dist/cli/skills-content/turn-into-app-skill.js +15 -10
- package/dist/client/chat/agentkit-protocol.js +2 -0
- package/dist/client/chat/runtime.d.ts +1 -0
- package/dist/client/chat/runtime.js +35 -3
- package/dist/collab/routes.d.ts +2 -2
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/mcp/actions/call-mcp-tool.js +1 -1
- package/dist/mcp-client/app-api.d.ts +3 -0
- package/dist/mcp-client/app-api.js +8 -1
- package/dist/mcp-client/index.d.ts +7 -2
- package/dist/mcp-client/index.js +10 -4
- package/dist/mcp-client/manager.d.ts +16 -1
- package/dist/mcp-client/manager.js +35 -7
- package/dist/mcp-client/routes.js +9 -4
- package/dist/observability/metrics.d.ts +2 -0
- package/dist/observability/metrics.js +15 -1
- package/dist/observability/traces.js +8 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +11 -11
- package/dist/provider-api/actions/provider-api.d.ts +10 -10
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/server/agent-chat/additional-actions.d.ts +45 -0
- package/dist/server/agent-chat/additional-actions.js +707 -0
- package/dist/server/agent-chat/mcp-glue.d.ts +3 -1
- package/dist/server/agent-chat/mcp-glue.js +12 -1
- package/dist/server/agent-chat/plugin-options.d.ts +27 -0
- package/dist/server/agent-chat-plugin.js +59 -14
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/agent-engine-ollama-models-route.d.ts +2 -2
- package/dist/server/better-auth-instance.js +108 -18
- package/dist/server/builder-browser.d.ts +4 -2
- package/dist/server/builder-browser.js +21 -16
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +1 -1
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/shared/data-url.d.ts +2 -0
- package/dist/shared/data-url.js +12 -0
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/attachments.md +1 -3
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/fresh-project.md +13 -8
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/source-brief.md +2 -2
- package/docs/content/agent-surfaces.mdx +61 -0
- package/docs/content/observability.mdx +2 -0
- package/package.json +5 -4
- package/src/templates/workspace-core/.agents/skills/turn-into-app/references/attachments.md +1 -3
- package/src/templates/workspace-core/.agents/skills/turn-into-app/references/fresh-project.md +13 -8
- package/src/templates/workspace-core/.agents/skills/turn-into-app/references/source-brief.md +2 -2
|
@@ -54,8 +54,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
|
|
|
54
54
|
expiresAt?: undefined;
|
|
55
55
|
ttlSeconds?: undefined;
|
|
56
56
|
} | {
|
|
57
|
-
error?: undefined;
|
|
58
57
|
token: string;
|
|
59
58
|
expiresAt: string;
|
|
60
59
|
ttlSeconds: number;
|
|
60
|
+
error?: undefined;
|
|
61
61
|
}>>;
|
|
@@ -9,3 +9,5 @@ export interface ParsedBase64DataUrl {
|
|
|
9
9
|
}
|
|
10
10
|
export declare function parseDataUrl(value: string): ParsedDataUrl | null;
|
|
11
11
|
export declare function parseBase64DataUrl(value: string): ParsedBase64DataUrl | null;
|
|
12
|
+
export declare function isBase64(data: string): boolean;
|
|
13
|
+
export declare function base64ByteLength(data: string): number;
|
package/dist/shared/data-url.js
CHANGED
|
@@ -82,3 +82,15 @@ export function parseBase64DataUrl(value) {
|
|
|
82
82
|
? { mediaType: parsed.mediaType, data: parsed.data }
|
|
83
83
|
: null;
|
|
84
84
|
}
|
|
85
|
+
export function isBase64(data) {
|
|
86
|
+
const unpadded = data.replace(/={1,2}$/, "");
|
|
87
|
+
if (!/^[A-Za-z0-9+/]*$/.test(unpadded))
|
|
88
|
+
return false;
|
|
89
|
+
return unpadded.length === data.length
|
|
90
|
+
? data.length % 4 !== 1
|
|
91
|
+
: data.length % 4 === 0;
|
|
92
|
+
}
|
|
93
|
+
export function base64ByteLength(data) {
|
|
94
|
+
const padding = data.endsWith("==") ? 2 : data.endsWith("=") ? 1 : 0;
|
|
95
|
+
return Math.floor((data.length * 3) / 4) - padding;
|
|
96
|
+
}
|
package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/attachments.md
CHANGED
|
@@ -12,7 +12,6 @@ Images and PDFs use an upload attachment with a matching base64 data URL:
|
|
|
12
12
|
contentType: "image/webp" | "image/png" | "image/jpeg" | "image/gif" | "application/pdf",
|
|
13
13
|
name: string,
|
|
14
14
|
dataUrl: "data:<contentType>;base64,<BASE64_CONTENT>",
|
|
15
|
-
size: number,
|
|
16
15
|
id: string
|
|
17
16
|
}
|
|
18
17
|
```
|
|
@@ -26,12 +25,11 @@ Text and JSON files provide decoded contents instead of a data URL:
|
|
|
26
25
|
name: string,
|
|
27
26
|
dataUrl: "",
|
|
28
27
|
text: string,
|
|
29
|
-
size: number,
|
|
30
28
|
id: string
|
|
31
29
|
}
|
|
32
30
|
```
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
Send any other text-based file (Markdown, CSV, source code, plain text) as `text/plain` with its real file name, for example `notes.md`. Use a stable or unique `id` for each attachment. A malformed attachment is rejected with `invalid_attachment` and a message naming the problem; fix that attachment and retry, because an unchanged retry fails the same way.
|
|
35
33
|
|
|
36
34
|
## Public URLs
|
|
37
35
|
|
package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/fresh-project.md
CHANGED
|
@@ -21,14 +21,19 @@ On a browser host the host is an orchestrator, not the build environment:
|
|
|
21
21
|
(archetype, direction, first viewport, sample-data plan, agent moments).
|
|
22
22
|
2. Call `start-workspace-app-creation` on the Agent-Native Dispatch MCP
|
|
23
23
|
connector (`agent-native-dispatch`). Put the brief and the design decisions
|
|
24
|
-
in `prompt`; pass an `appId`, a short `description`, the `template
|
|
25
|
-
|
|
26
|
-
([attachments.md](attachments.md))
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
in `prompt`; pass an `appId`, a short `description`, and the `template`.
|
|
25
|
+
The tool's schema describes each argument. Send the Project's own text as
|
|
26
|
+
`attachments` ([attachments.md](attachments.md)), never as a summary: the
|
|
27
|
+
Project instructions as `project-instructions.md` and every knowledge file,
|
|
28
|
+
each verbatim as `text/plain`. Never paste whole knowledge files or binary
|
|
29
|
+
data into `prompt`. Attachments are model context
|
|
30
|
+
and are not copied into the generated workspace, so tell the Builder agent in
|
|
31
|
+
`prompt` to persist what the app needs: knowledge files as app resources, the
|
|
32
|
+
instructions as the in-app agent's instructions. If a file cannot be
|
|
33
|
+
reproduced verbatim (not in context, too large), say so in the brief and the
|
|
34
|
+
report; never swap in a digest silently. A workbook cannot be attached
|
|
35
|
+
(attachments take images, PDF, text, and JSON): pass a bounded CSV rendering
|
|
36
|
+
as text, or a public URL, and say what was left out.
|
|
32
37
|
3. Report what Dispatch actually returned: the branch, the path, and the status.
|
|
33
38
|
The browser host cannot run or inspect the app, and a returned path can 404
|
|
34
39
|
until the branch merges and deploys, so the report ends at pending or
|
package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/source-brief.md
CHANGED
|
@@ -20,7 +20,7 @@ heading; write `n/a` where a heading does not apply.
|
|
|
20
20
|
Source and provenance: type (thread, skill, Project, spreadsheet, export), file names, ids, what was read and what was not
|
|
21
21
|
Project goal: the user and the repeatable job, in one sentence
|
|
22
22
|
Configuration and constraints: audience, rules, output standards, approved tools
|
|
23
|
-
Knowledge sources: reference files the app ships with, by name
|
|
23
|
+
Knowledge sources: reference files the app ships with, by name
|
|
24
24
|
Repeatable workflow: the job's trigger, steps, and outcome, in the source's own words
|
|
25
25
|
Inputs and outputs: what comes in, what the user gets back, fixed output shapes
|
|
26
26
|
Judgment and review points: 1-3 agent moments, each tied to the object it acts on; what the user confirms
|
|
@@ -38,7 +38,7 @@ App design: archetype, direction, first-viewport sketch, sample-data plan
|
|
|
38
38
|
|
|
39
39
|
- Name the latest successful, repeatable job. A walkthrough of one example is
|
|
40
40
|
evidence for the job, not the job.
|
|
41
|
-
- Keep references bounded: a file name, URL,
|
|
41
|
+
- Keep references bounded: a file name, URL, or short summary
|
|
42
42
|
instead of a pasted document. No secrets, credentials, or customer data.
|
|
43
43
|
- Corrections the user made in the source are product rules. Record each one
|
|
44
44
|
as an invariant.
|
|
@@ -202,6 +202,67 @@ framework guidance and spawned sub-agents inherit the same surface. Trusted
|
|
|
202
202
|
shell tools are automatically reduced to the request-filtered sandbox because
|
|
203
203
|
an unrestricted shell cannot enforce a hard action boundary.
|
|
204
204
|
|
|
205
|
+
### Request-scoped additional actions
|
|
206
|
+
|
|
207
|
+
Use `resolveAdditionalActions` when the actions a caller can use are only known
|
|
208
|
+
at request time, such as tools a user registers while the server runs. The
|
|
209
|
+
callback runs once per authenticated interactive chat run (production and dev),
|
|
210
|
+
before `tool-search` and `resolveActionSurface`, so both see the returned
|
|
211
|
+
entries. They join that caller's registry for that run only. A2A tasks and MCP
|
|
212
|
+
`ask_app` calls receive them only when you list those surfaces in
|
|
213
|
+
`additionalActionSurfaces`; `surface` tells the callback which one is asking.
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
createAgentChatPlugin({
|
|
217
|
+
actions,
|
|
218
|
+
additionalActionSurfaces: ["a2a"],
|
|
219
|
+
resolveAdditionalActions: async ({ surface, ownerEmail, orgId }) =>
|
|
220
|
+
loadUserTools(ownerEmail, orgId, {
|
|
221
|
+
includeEditorTools: surface === "chat",
|
|
222
|
+
}),
|
|
223
|
+
});
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Treat returned entries as untrusted input. The framework ignores an entry, and
|
|
227
|
+
logs a warning once, when its name is not 1–64 letters, digits, `_`, or `-`;
|
|
228
|
+
when the name belongs to any template, framework, dev, or MCP action, including
|
|
229
|
+
actions hidden from the agent; when it is an `mcp__` name the caller cannot
|
|
230
|
+
see; or when its tool definition is unusable. Descriptions lose hidden control
|
|
231
|
+
characters and are capped. `parameters` must be a bounded schema of plain JSON
|
|
232
|
+
data with an `object` root, using only common validation and annotation
|
|
233
|
+
keywords. Unknown keywords, `pattern`, `patternProperties`, `uniqueItems`,
|
|
234
|
+
`$async`, `$id`, anchors, and any `$ref` that is recursive or points outside
|
|
235
|
+
the schema are refused. The model sees the checked copy of the schema, and a
|
|
236
|
+
call whose arguments are too large to validate against it is refused. Flags such as
|
|
237
|
+
`readOnly` and `access` are your app's own declarations, which the framework
|
|
238
|
+
trusts as it trusts `run`: set them from what your code does, never from
|
|
239
|
+
metadata a user registered.
|
|
240
|
+
|
|
241
|
+
Each entry is bound to the caller it was resolved for. Every call, whichever
|
|
242
|
+
dispatcher makes it, refuses to run for a different user or organization,
|
|
243
|
+
enforces the entry's `access` policy, and validates the arguments against its
|
|
244
|
+
schema without type coercion.
|
|
245
|
+
|
|
246
|
+
Names are pinned only when a hosted chat turn continues as a durable background
|
|
247
|
+
run. The callback runs again, and the turn keeps its original names for these
|
|
248
|
+
entries and the caller's MCP tools alike: new entries stay out, a name that
|
|
249
|
+
disappeared returns an error when called, and a name that remains runs its
|
|
250
|
+
current definition. Every other request resolves fresh, including each
|
|
251
|
+
continuation on a local sidecar, and a dropped stream that reattaches to its run
|
|
252
|
+
resolves nothing.
|
|
253
|
+
|
|
254
|
+
Put the binding's identity in the name, such as a window id or scope
|
|
255
|
+
(`notes_window_42_insert`), so a rebind reads as one tool leaving and another
|
|
256
|
+
appearing. "Always allow" approvals follow the tool name, so they carry over
|
|
257
|
+
when the same name later means something new.
|
|
258
|
+
|
|
259
|
+
These entries are native tools for the agent loop only. Like the caller's MCP
|
|
260
|
+
tools, they aren't reachable from `run-code` or `tool-orchestration`.
|
|
261
|
+
|
|
262
|
+
`event` is set for `chat` and `a2a`; `ask_app` calls have none. The callback
|
|
263
|
+
is not called for anonymous requests, scheduled jobs, automations, or agent-team
|
|
264
|
+
sub-agents. An error the callback throws fails the request.
|
|
265
|
+
|
|
205
266
|
## Native inline UI {#native-inline-ui}
|
|
206
267
|
|
|
207
268
|
Use this when your actions return structured data — a list of records, a chart dataset, a status summary — that should render as a real UI component inside the chat thread rather than a plain text description. You define a `chatUI` renderer on the action, and Agent-Native renders it as a first-party React component: no iframes, no separate rendering path.
|
|
@@ -435,6 +435,8 @@ Core also records metrics once the host registers a meter provider with `registe
|
|
|
435
435
|
|
|
436
436
|
On metrics, `gen_ai.tool.name` is a framework action's name or `other`, and `gen_ai.request.model` is the model id only when the engine lists it as supported, otherwise `_OTHER`. App-defined tools and caller-supplied model ids therefore cannot create unbounded series; spans keep the exact values.
|
|
437
437
|
|
|
438
|
+
A failed model call's `error.type` on `gen_ai.client.operation.duration` is the provider's HTTP status when the call returned a 4xx or 5xx (`http_429`, `http_529`), otherwise `rate_limit`, `context_overflow`, `provider_error`, or `no_model_connected` when the engine's error code names one, otherwise `_OTHER`. Each retry is its own call with its own `error.type`, so a run that retries a throttled request several times records several `http_429` calls even if it finishes.
|
|
439
|
+
|
|
438
440
|
`http.route` is set on every request and comes from a closed set: a framework endpoint's route template (`/_agent-native/auth/session`, `/_agent-native/agent-chat/runs/:runId/events`), an action's declared template, the app's own Nitro file route (`/api/clips/:id`), or a bucket. The buckets are `/_agent-native/*`, `/mcp/*`, and `/.well-known/*` for an unlisted path in those namespaces, `/api/*` for any other API path, `static` for file requests, `page` for any other `GET` or `HEAD`, and `other`. A raw request path is never recorded. The `http.server` span carries the same value.
|
|
439
441
|
|
|
440
442
|
## Connecting an OpenTelemetry back end {#otel-provider}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.209.0
|
|
3
|
+
"version": "0.209.0",
|
|
4
4
|
"description": "The agentic application framework for building autonomous agents with intuitive UIs",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -660,6 +660,7 @@
|
|
|
660
660
|
"dependencies": {
|
|
661
661
|
"@anthropic-ai/sdk": "^0.90.0",
|
|
662
662
|
"@babel/parser": "8.0.7",
|
|
663
|
+
"@better-auth/core": "1.7.6",
|
|
663
664
|
"@clack/prompts": "^1.7.0",
|
|
664
665
|
"@mcp-b/webmcp-polyfill": "^5.1.0",
|
|
665
666
|
"@modelcontextprotocol/client": "2.0.0",
|
|
@@ -703,8 +704,8 @@
|
|
|
703
704
|
"yaml": "^2.9.0",
|
|
704
705
|
"yjs": "^13.6.33",
|
|
705
706
|
"zod": "^4.3.6",
|
|
706
|
-
"@agent-native/
|
|
707
|
-
"@agent-native/
|
|
707
|
+
"@agent-native/agentkit": "^0.209.0",
|
|
708
|
+
"@agent-native/recap-cli": "^0.5.72"
|
|
708
709
|
},
|
|
709
710
|
"devDependencies": {
|
|
710
711
|
"@ai-sdk/anthropic": "^3.0.71",
|
|
@@ -774,7 +775,7 @@
|
|
|
774
775
|
"xlsx": "^0.18.5"
|
|
775
776
|
},
|
|
776
777
|
"peerDependencies": {
|
|
777
|
-
"@agent-native/core-corpus": "0.
|
|
778
|
+
"@agent-native/core-corpus": ">=0.196.0",
|
|
778
779
|
"@ai-sdk/anthropic": ">=3",
|
|
779
780
|
"@ai-sdk/cohere": ">=3",
|
|
780
781
|
"@ai-sdk/google": ">=3",
|
|
@@ -12,7 +12,6 @@ Images and PDFs use an upload attachment with a matching base64 data URL:
|
|
|
12
12
|
contentType: "image/webp" | "image/png" | "image/jpeg" | "image/gif" | "application/pdf",
|
|
13
13
|
name: string,
|
|
14
14
|
dataUrl: "data:<contentType>;base64,<BASE64_CONTENT>",
|
|
15
|
-
size: number,
|
|
16
15
|
id: string
|
|
17
16
|
}
|
|
18
17
|
```
|
|
@@ -26,12 +25,11 @@ Text and JSON files provide decoded contents instead of a data URL:
|
|
|
26
25
|
name: string,
|
|
27
26
|
dataUrl: "",
|
|
28
27
|
text: string,
|
|
29
|
-
size: number,
|
|
30
28
|
id: string
|
|
31
29
|
}
|
|
32
30
|
```
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
Send any other text-based file (Markdown, CSV, source code, plain text) as `text/plain` with its real file name, for example `notes.md`. Use a stable or unique `id` for each attachment. A malformed attachment is rejected with `invalid_attachment` and a message naming the problem; fix that attachment and retry, because an unchanged retry fails the same way.
|
|
35
33
|
|
|
36
34
|
## Public URLs
|
|
37
35
|
|
package/src/templates/workspace-core/.agents/skills/turn-into-app/references/fresh-project.md
CHANGED
|
@@ -21,14 +21,19 @@ On a browser host the host is an orchestrator, not the build environment:
|
|
|
21
21
|
(archetype, direction, first viewport, sample-data plan, agent moments).
|
|
22
22
|
2. Call `start-workspace-app-creation` on the Agent-Native Dispatch MCP
|
|
23
23
|
connector (`agent-native-dispatch`). Put the brief and the design decisions
|
|
24
|
-
in `prompt`; pass an `appId`, a short `description`, the `template
|
|
25
|
-
|
|
26
|
-
([attachments.md](attachments.md))
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
in `prompt`; pass an `appId`, a short `description`, and the `template`.
|
|
25
|
+
The tool's schema describes each argument. Send the Project's own text as
|
|
26
|
+
`attachments` ([attachments.md](attachments.md)), never as a summary: the
|
|
27
|
+
Project instructions as `project-instructions.md` and every knowledge file,
|
|
28
|
+
each verbatim as `text/plain`. Never paste whole knowledge files or binary
|
|
29
|
+
data into `prompt`. Attachments are model context
|
|
30
|
+
and are not copied into the generated workspace, so tell the Builder agent in
|
|
31
|
+
`prompt` to persist what the app needs: knowledge files as app resources, the
|
|
32
|
+
instructions as the in-app agent's instructions. If a file cannot be
|
|
33
|
+
reproduced verbatim (not in context, too large), say so in the brief and the
|
|
34
|
+
report; never swap in a digest silently. A workbook cannot be attached
|
|
35
|
+
(attachments take images, PDF, text, and JSON): pass a bounded CSV rendering
|
|
36
|
+
as text, or a public URL, and say what was left out.
|
|
32
37
|
3. Report what Dispatch actually returned: the branch, the path, and the status.
|
|
33
38
|
The browser host cannot run or inspect the app, and a returned path can 404
|
|
34
39
|
until the branch merges and deploys, so the report ends at pending or
|
package/src/templates/workspace-core/.agents/skills/turn-into-app/references/source-brief.md
CHANGED
|
@@ -20,7 +20,7 @@ heading; write `n/a` where a heading does not apply.
|
|
|
20
20
|
Source and provenance: type (thread, skill, Project, spreadsheet, export), file names, ids, what was read and what was not
|
|
21
21
|
Project goal: the user and the repeatable job, in one sentence
|
|
22
22
|
Configuration and constraints: audience, rules, output standards, approved tools
|
|
23
|
-
Knowledge sources: reference files the app ships with, by name
|
|
23
|
+
Knowledge sources: reference files the app ships with, by name
|
|
24
24
|
Repeatable workflow: the job's trigger, steps, and outcome, in the source's own words
|
|
25
25
|
Inputs and outputs: what comes in, what the user gets back, fixed output shapes
|
|
26
26
|
Judgment and review points: 1-3 agent moments, each tied to the object it acts on; what the user confirms
|
|
@@ -38,7 +38,7 @@ App design: archetype, direction, first-viewport sketch, sample-data plan
|
|
|
38
38
|
|
|
39
39
|
- Name the latest successful, repeatable job. A walkthrough of one example is
|
|
40
40
|
evidence for the job, not the job.
|
|
41
|
-
- Keep references bounded: a file name, URL,
|
|
41
|
+
- Keep references bounded: a file name, URL, or short summary
|
|
42
42
|
instead of a pasted document. No secrets, credentials, or customer data.
|
|
43
43
|
- Corrections the user made in the source are product rules. Record each one
|
|
44
44
|
as an invariant.
|