@agent-native/core 0.52.0 → 0.54.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/README.md +41 -95
- package/blueprints/action/crud.md +98 -0
- package/blueprints/channel/discord.md +74 -0
- package/blueprints/provider/stripe.md +87 -0
- package/blueprints/sandbox/docker.md +78 -0
- package/dist/action.d.ts +64 -1
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +73 -2
- package/dist/action.js.map +1 -1
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +1 -0
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/observational-memory/compactor.d.ts +43 -0
- package/dist/agent/observational-memory/compactor.d.ts.map +1 -0
- package/dist/agent/observational-memory/compactor.js +50 -0
- package/dist/agent/observational-memory/compactor.js.map +1 -0
- package/dist/agent/observational-memory/config.d.ts +37 -0
- package/dist/agent/observational-memory/config.d.ts.map +1 -0
- package/dist/agent/observational-memory/config.js +48 -0
- package/dist/agent/observational-memory/config.js.map +1 -0
- package/dist/agent/observational-memory/index.d.ts +26 -0
- package/dist/agent/observational-memory/index.d.ts.map +1 -0
- package/dist/agent/observational-memory/index.js +25 -0
- package/dist/agent/observational-memory/index.js.map +1 -0
- package/dist/agent/observational-memory/internal-run.d.ts +37 -0
- package/dist/agent/observational-memory/internal-run.d.ts.map +1 -0
- package/dist/agent/observational-memory/internal-run.js +59 -0
- package/dist/agent/observational-memory/internal-run.js.map +1 -0
- package/dist/agent/observational-memory/message-text.d.ts +13 -0
- package/dist/agent/observational-memory/message-text.d.ts.map +1 -0
- package/dist/agent/observational-memory/message-text.js +46 -0
- package/dist/agent/observational-memory/message-text.js.map +1 -0
- package/dist/agent/observational-memory/migrations.d.ts +13 -0
- package/dist/agent/observational-memory/migrations.d.ts.map +1 -0
- package/dist/agent/observational-memory/migrations.js +43 -0
- package/dist/agent/observational-memory/migrations.js.map +1 -0
- package/dist/agent/observational-memory/observer.d.ts +37 -0
- package/dist/agent/observational-memory/observer.d.ts.map +1 -0
- package/dist/agent/observational-memory/observer.js +82 -0
- package/dist/agent/observational-memory/observer.js.map +1 -0
- package/dist/agent/observational-memory/plugin.d.ts +16 -0
- package/dist/agent/observational-memory/plugin.d.ts.map +1 -0
- package/dist/agent/observational-memory/plugin.js +26 -0
- package/dist/agent/observational-memory/plugin.js.map +1 -0
- package/dist/agent/observational-memory/prompts.d.ts +27 -0
- package/dist/agent/observational-memory/prompts.d.ts.map +1 -0
- package/dist/agent/observational-memory/prompts.js +42 -0
- package/dist/agent/observational-memory/prompts.js.map +1 -0
- package/dist/agent/observational-memory/read.d.ts +45 -0
- package/dist/agent/observational-memory/read.d.ts.map +1 -0
- package/dist/agent/observational-memory/read.js +97 -0
- package/dist/agent/observational-memory/read.js.map +1 -0
- package/dist/agent/observational-memory/reflector.d.ts +31 -0
- package/dist/agent/observational-memory/reflector.d.ts.map +1 -0
- package/dist/agent/observational-memory/reflector.js +76 -0
- package/dist/agent/observational-memory/reflector.js.map +1 -0
- package/dist/agent/observational-memory/schema.d.ts +267 -0
- package/dist/agent/observational-memory/schema.d.ts.map +1 -0
- package/dist/agent/observational-memory/schema.js +48 -0
- package/dist/agent/observational-memory/schema.js.map +1 -0
- package/dist/agent/observational-memory/store.d.ts +52 -0
- package/dist/agent/observational-memory/store.d.ts.map +1 -0
- package/dist/agent/observational-memory/store.js +197 -0
- package/dist/agent/observational-memory/store.js.map +1 -0
- package/dist/agent/observational-memory/types.d.ts +61 -0
- package/dist/agent/observational-memory/types.d.ts.map +1 -0
- package/dist/agent/observational-memory/types.js +9 -0
- package/dist/agent/observational-memory/types.js.map +1 -0
- package/dist/agent/processors.d.ts +146 -0
- package/dist/agent/processors.d.ts.map +1 -0
- package/dist/agent/processors.js +122 -0
- package/dist/agent/processors.js.map +1 -0
- package/dist/agent/production-agent.d.ts +25 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +341 -1
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-loop-with-resume.d.ts.map +1 -1
- package/dist/agent/run-loop-with-resume.js +48 -0
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/agent/run-store.d.ts +17 -0
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +55 -0
- package/dist/agent/run-store.js.map +1 -1
- package/dist/agent/runtime-context.d.ts +30 -0
- package/dist/agent/runtime-context.d.ts.map +1 -1
- package/dist/agent/runtime-context.js +54 -1
- package/dist/agent/runtime-context.js.map +1 -1
- package/dist/agent/tool-call-journal.d.ts +99 -0
- package/dist/agent/tool-call-journal.d.ts.map +1 -0
- package/dist/agent/tool-call-journal.js +212 -0
- package/dist/agent/tool-call-journal.js.map +1 -0
- package/dist/agent/types.d.ts +35 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/cli/add.d.ts +109 -0
- package/dist/cli/add.d.ts.map +1 -0
- package/dist/cli/add.js +352 -0
- package/dist/cli/add.js.map +1 -0
- package/dist/cli/connect.d.ts +2 -2
- package/dist/cli/connect.d.ts.map +1 -1
- package/dist/cli/connect.js +92 -24
- package/dist/cli/connect.js.map +1 -1
- package/dist/cli/eval.d.ts +17 -0
- package/dist/cli/eval.d.ts.map +1 -0
- package/dist/cli/eval.js +121 -0
- package/dist/cli/eval.js.map +1 -0
- package/dist/cli/index.js +44 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mcp.d.ts.map +1 -1
- package/dist/cli/mcp.js +11 -5
- package/dist/cli/mcp.js.map +1 -1
- package/dist/cli/plan-local.d.ts +66 -5
- package/dist/cli/plan-local.d.ts.map +1 -1
- package/dist/cli/plan-local.js +622 -21
- package/dist/cli/plan-local.js.map +1 -1
- package/dist/cli/skills.d.ts +2 -2
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +108 -62
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +118 -92
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +16 -0
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts +20 -1
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +32 -7
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/client/sse-event-processor.d.ts +13 -0
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +21 -0
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/coding-tools/run-code.d.ts.map +1 -1
- package/dist/coding-tools/run-code.js +18 -2
- package/dist/coding-tools/run-code.js.map +1 -1
- package/dist/db/client.d.ts +4 -2
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +6 -4
- package/dist/db/client.js.map +1 -1
- package/dist/deploy/route-discovery.d.ts.map +1 -1
- package/dist/deploy/route-discovery.js +1 -0
- package/dist/deploy/route-discovery.js.map +1 -1
- package/dist/eval/agent-runner.d.ts +63 -0
- package/dist/eval/agent-runner.d.ts.map +1 -0
- package/dist/eval/agent-runner.js +142 -0
- package/dist/eval/agent-runner.js.map +1 -0
- package/dist/eval/define-eval.d.ts +29 -0
- package/dist/eval/define-eval.d.ts.map +1 -0
- package/dist/eval/define-eval.js +43 -0
- package/dist/eval/define-eval.js.map +1 -0
- package/dist/eval/index.d.ts +18 -0
- package/dist/eval/index.d.ts.map +1 -0
- package/dist/eval/index.js +17 -0
- package/dist/eval/index.js.map +1 -0
- package/dist/eval/report.d.ts +8 -0
- package/dist/eval/report.d.ts.map +1 -0
- package/dist/eval/report.js +44 -0
- package/dist/eval/report.js.map +1 -0
- package/dist/eval/runner.d.ts +67 -0
- package/dist/eval/runner.d.ts.map +1 -0
- package/dist/eval/runner.js +256 -0
- package/dist/eval/runner.js.map +1 -0
- package/dist/eval/scorer.d.ts +83 -0
- package/dist/eval/scorer.d.ts.map +1 -0
- package/dist/eval/scorer.js +195 -0
- package/dist/eval/scorer.js.map +1 -0
- package/dist/eval/types.d.ts +162 -0
- package/dist/eval/types.d.ts.map +1 -0
- package/dist/eval/types.js +20 -0
- package/dist/eval/types.js.map +1 -0
- package/dist/extensions/fetch-tool.d.ts.map +1 -1
- package/dist/extensions/fetch-tool.js +80 -15
- package/dist/extensions/fetch-tool.js.map +1 -1
- package/dist/extensions/web-content.d.ts +61 -0
- package/dist/extensions/web-content.d.ts.map +1 -0
- package/dist/extensions/web-content.js +468 -0
- package/dist/extensions/web-content.js.map +1 -0
- package/dist/extensions/web-search-tool.js +3 -3
- package/dist/extensions/web-search-tool.js.map +1 -1
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +4 -1
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/observability/traces.d.ts.map +1 -1
- package/dist/observability/traces.js +100 -1
- package/dist/observability/traces.js.map +1 -1
- package/dist/observability/tracing.d.ts +73 -0
- package/dist/observability/tracing.d.ts.map +1 -0
- package/dist/observability/tracing.js +126 -0
- package/dist/observability/tracing.js.map +1 -0
- package/dist/onboarding/default-steps.d.ts.map +1 -1
- package/dist/onboarding/default-steps.js +4 -1
- package/dist/onboarding/default-steps.js.map +1 -1
- package/dist/provider-api/actions/query-staged-dataset.d.ts +1 -1
- package/dist/provider-api/corpus-jobs.d.ts +80 -0
- package/dist/provider-api/corpus-jobs.d.ts.map +1 -1
- package/dist/provider-api/corpus-jobs.js +219 -22
- package/dist/provider-api/corpus-jobs.js.map +1 -1
- package/dist/provider-api/index.d.ts +24 -32
- package/dist/provider-api/index.d.ts.map +1 -1
- package/dist/provider-api/index.js +28 -1
- package/dist/provider-api/index.js.map +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.d.ts.map +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.js +10 -3
- package/dist/scripts/agent-engines/list-agent-engines.js.map +1 -1
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +4 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +9 -0
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +119 -111
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-teams.d.ts +62 -0
- package/dist/server/agent-teams.d.ts.map +1 -1
- package/dist/server/agent-teams.js +99 -2
- package/dist/server/agent-teams.js.map +1 -1
- package/dist/server/better-auth-instance.d.ts +7 -0
- package/dist/server/better-auth-instance.d.ts.map +1 -1
- package/dist/server/better-auth-instance.js +90 -0
- package/dist/server/better-auth-instance.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +7 -4
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +2 -0
- package/dist/server/credential-provider.js.map +1 -1
- package/dist/server/deep-link.d.ts +7 -0
- package/dist/server/deep-link.d.ts.map +1 -1
- package/dist/server/deep-link.js +13 -2
- package/dist/server/deep-link.js.map +1 -1
- package/dist/server/framework-request-handler.d.ts.map +1 -1
- package/dist/server/framework-request-handler.js +33 -1
- package/dist/server/framework-request-handler.js.map +1 -1
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -1
- package/dist/server/index.js.map +1 -1
- package/dist/templates/default/.agents/skills/actions/SKILL.md +52 -1
- package/dist/templates/default/.agents/skills/security/SKILL.md +22 -0
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +52 -1
- package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +16 -4
- package/dist/templates/workspace-core/.agents/skills/harness-agents/SKILL.md +20 -0
- package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +31 -0
- package/dist/templates/workspace-core/.agents/skills/security/SKILL.md +22 -0
- package/docs/content/actions.md +50 -0
- package/docs/content/agent-teams.md +32 -0
- package/docs/content/blueprint-installer.md +73 -0
- package/docs/content/durable-resume.md +49 -0
- package/docs/content/evals.md +141 -0
- package/docs/content/external-agents.md +2 -2
- package/docs/content/human-approval.md +101 -0
- package/docs/content/observability.md +21 -0
- package/docs/content/observational-memory.md +63 -0
- package/docs/content/plan-plugin.md +5 -0
- package/docs/content/pr-visual-recap.md +9 -5
- package/docs/content/processors.md +99 -0
- package/docs/content/sandbox-adapters.md +134 -0
- package/docs/content/template-plan.md +97 -21
- package/package.json +10 -1
- package/src/templates/default/.agents/skills/actions/SKILL.md +52 -1
- package/src/templates/default/.agents/skills/security/SKILL.md +22 -0
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +52 -1
- package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +16 -4
- package/src/templates/workspace-core/.agents/skills/harness-agents/SKILL.md +20 -0
- package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +31 -0
- package/src/templates/workspace-core/.agents/skills/security/SKILL.md +22 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Agent-Native
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
### Open-source framework for agentic applications you own.
|
|
4
4
|
|
|
5
5
|
Don't choose between rich user interfaces and autonomous agents. Every Agent-Native app is both.
|
|
6
6
|
|
|
@@ -20,15 +20,40 @@ The agent and the UI are equal citizens of the same system. Every action works b
|
|
|
20
20
|
- **Any database, any host** — Any SQL database Drizzle supports. Any hosting target Nitro supports. No lock-in.
|
|
21
21
|
- **Any AI agent** — Claude Code, Codex, Cursor, Pi, OpenCode, GitHub Copilot / VS Code, or Builder.io. Use whichever agent you prefer.
|
|
22
22
|
|
|
23
|
+
## The framework for agent-native apps
|
|
24
|
+
|
|
25
|
+
Agent-Native is an open-source framework for building robust agents that can act inside real apps, not just chat next to them.
|
|
26
|
+
|
|
27
|
+
It gives you primitives for product-grade agentic software: shared actions, SQL-backed state, identity, tools, skills, jobs, observability, and UI surfaces that all work together.
|
|
28
|
+
|
|
29
|
+
Backend agnostic: bring your own database, hosting provider, model stack, and app code.
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
// One action powers UI, agent, HTTP, MCP, A2A, and CLI.
|
|
33
|
+
export default defineAction({
|
|
34
|
+
schema: z.object({
|
|
35
|
+
emailId: z.string(),
|
|
36
|
+
body: z.string(),
|
|
37
|
+
}),
|
|
38
|
+
run: async ({ emailId, body }) => {
|
|
39
|
+
await db.insert(replies).values({ emailId, body });
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- **Actions** — Define work once. Use it from UI, agent, API, MCP, A2A, and CLI.
|
|
45
|
+
- **Agent runtime** — Chat, tools, skills, memory, jobs, observability, and handoffs ship together.
|
|
46
|
+
- **Backend agnostic** — Plug in any Drizzle-supported SQL database and Nitro-compatible host.
|
|
47
|
+
|
|
23
48
|
## Try it with a skill
|
|
24
49
|
|
|
25
|
-
Don't want to scaffold a whole app yet? Add
|
|
50
|
+
Don't want to scaffold a whole app yet? Add visual planning and PR recaps to Claude Code, Codex, Cursor, Pi, OpenCode, GitHub Copilot / VS Code, and similar agents with one command:
|
|
26
51
|
|
|
27
52
|
```bash
|
|
28
53
|
npx @agent-native/core@latest skills add visual-plan
|
|
29
54
|
```
|
|
30
55
|
|
|
31
|
-
|
|
56
|
+
You get two slash commands that upgrade how your agent plans and reports its work:
|
|
32
57
|
|
|
33
58
|
- **`/visual-plan`** — before the agent writes code, it opens a structured, reviewable plan document instead of a wall of text: inline diagrams, UI wireframes and prototypes, file-by-file implementation maps, and annotations you can comment on and approve.
|
|
34
59
|
- **`/visual-recap`** — after changes land, it turns a PR or git diff into a high-altitude visual recap: schema, API, and file changes rendered as grounded before/after blocks with a shareable review link, instead of scrolling a raw diff.
|
|
@@ -37,30 +62,30 @@ See the **[Skills Guide](https://agent-native.com/docs/skills-guide#app-backed-s
|
|
|
37
62
|
|
|
38
63
|
## Templates
|
|
39
64
|
|
|
40
|
-
Start
|
|
65
|
+
Start with a full featured template. Each one is a complete, 100% free and open-source SaaS app — cloneable, not scaffolded — except you own the code and can customize everything.
|
|
41
66
|
|
|
42
67
|
<table>
|
|
43
68
|
<tr>
|
|
44
69
|
<td width="33%" align="center" valign="top">
|
|
45
70
|
|
|
46
|
-
**
|
|
71
|
+
**Calendar**
|
|
47
72
|
|
|
48
|
-
<a href="https://agent-native.com/templates/
|
|
73
|
+
<a href="https://agent-native.com/templates/calendar"><img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffb6c3b483ca24ab3b6c3a758aeceef4c?format=webp&width=800" alt="Calendar template" width="100%" /></a>
|
|
49
74
|
|
|
50
|
-
**Agent-Native
|
|
75
|
+
**Agent-Native Google Calendar, Calendly**
|
|
51
76
|
|
|
52
|
-
|
|
77
|
+
Manage events, sync with Google Calendar, and share a public booking page with AI scheduling.
|
|
53
78
|
|
|
54
79
|
</td>
|
|
55
80
|
<td width="33%" align="center" valign="top">
|
|
56
81
|
|
|
57
|
-
**
|
|
82
|
+
**Content**
|
|
58
83
|
|
|
59
|
-
<a href="https://agent-native.com/templates/
|
|
84
|
+
<a href="https://agent-native.com/templates/content"><img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F89bcfc6106304bfbaf8ec8a7ccd721eb?format=webp&width=800" alt="Content template" width="100%" /></a>
|
|
60
85
|
|
|
61
|
-
**
|
|
86
|
+
**Open-source Obsidian for MDX**
|
|
62
87
|
|
|
63
|
-
|
|
88
|
+
Edit local Markdown/MDX files, generate rich interactive custom blocks, and draft, rewrite, or publish with an agent.
|
|
64
89
|
|
|
65
90
|
</td>
|
|
66
91
|
<td width="33%" align="center" valign="top">
|
|
@@ -78,17 +103,6 @@ Install `/visual-plan` and `/visual-recap` so your coding agent can plan before
|
|
|
78
103
|
<tr>
|
|
79
104
|
<td width="33%" align="center" valign="top">
|
|
80
105
|
|
|
81
|
-
**Content**
|
|
82
|
-
|
|
83
|
-
<a href="https://agent-native.com/templates/content"><img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F89bcfc6106304bfbaf8ec8a7ccd721eb?format=webp&width=800" alt="Content template" width="100%" /></a>
|
|
84
|
-
|
|
85
|
-
**Agent-Native Notion, Google Docs**
|
|
86
|
-
|
|
87
|
-
Write and organize content with an agent that knows your brand and publishing workflow.
|
|
88
|
-
|
|
89
|
-
</td>
|
|
90
|
-
<td width="33%" align="center" valign="top">
|
|
91
|
-
|
|
92
106
|
**Slides**
|
|
93
107
|
|
|
94
108
|
<a href="https://agent-native.com/templates/slides"><img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F2c09b451d40c4a74a89a38d69170c2d8?format=webp&width=800" alt="Slides template" width="100%" /></a>
|
|
@@ -100,19 +114,6 @@ Generate and edit React-based presentations via prompt or point-and-click.
|
|
|
100
114
|
</td>
|
|
101
115
|
<td width="33%" align="center" valign="top">
|
|
102
116
|
|
|
103
|
-
**Video**
|
|
104
|
-
|
|
105
|
-
<a href="https://agent-native.com/templates/video"><img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F6b8bfcc18a1d4c47a491da3b2d4148a4?format=webp&width=800" alt="Video template" width="100%" /></a>
|
|
106
|
-
|
|
107
|
-
**Agent-Native video editing**
|
|
108
|
-
|
|
109
|
-
Create and edit Remotion video compositions with agent assistance.
|
|
110
|
-
|
|
111
|
-
</td>
|
|
112
|
-
</tr>
|
|
113
|
-
<tr>
|
|
114
|
-
<td width="33%" align="center" valign="top">
|
|
115
|
-
|
|
116
117
|
**Analytics**
|
|
117
118
|
|
|
118
119
|
<a href="https://agent-native.com/templates/analytics"><img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F4933a80cc3134d7e874631f688be828a?format=webp&width=800" alt="Analytics template" width="100%" /></a>
|
|
@@ -132,73 +133,18 @@ Connect analytics data sources, prompt for real charts, and build reusable dashb
|
|
|
132
133
|
|
|
133
134
|
Record your screen with auto-transcripts, shareable links, and an agent that summarizes, captions, and edits clips on demand.
|
|
134
135
|
|
|
135
|
-
</td>
|
|
136
|
-
<td width="33%" align="center" valign="top">
|
|
137
|
-
|
|
138
|
-
**Design**
|
|
139
|
-
|
|
140
|
-
<a href="https://agent-native.com/templates/design"><img src="https://cdn.builder.io/api/v1/image/assets%2F348da13fcd8b414c87de9066196f7266%2F961bedb713a94463b834c1f2f4643bcf?format=webp&width=800" alt="Design template" width="100%" /></a>
|
|
141
|
-
|
|
142
|
-
**Agent-Native Figma, Canva**
|
|
143
|
-
|
|
144
|
-
Create and edit visual designs by prompt or by hand, with the agent as your co-designer.
|
|
145
|
-
|
|
146
|
-
</td>
|
|
147
|
-
</tr>
|
|
148
|
-
<tr>
|
|
149
|
-
<td width="33%" align="center" valign="top">
|
|
150
|
-
|
|
151
|
-
**Dispatch**
|
|
152
|
-
|
|
153
|
-
<a href="https://agent-native.com/templates/dispatch"><img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F104b3ad8d1dc461aa33ab9bff37a4482?format=webp&width=800" alt="Dispatch template" width="100%" /></a>
|
|
154
|
-
|
|
155
|
-
**Mission control for agent-native apps**
|
|
156
|
-
|
|
157
|
-
Message, manage, and delegate to agents from Slack, Telegram, or the web. Dispatch is also the control plane for vault secrets, reusable provider connections, app grants, routing, memory, and approvals.
|
|
158
|
-
|
|
159
|
-
</td>
|
|
160
|
-
<td width="33%" align="center" valign="top">
|
|
161
|
-
|
|
162
|
-
**Forms**
|
|
163
|
-
|
|
164
|
-
<a href="https://agent-native.com/templates/forms"><img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F190c3fabd51f4c1bba5aa4e091ad4e9b?format=webp&width=800" alt="Forms template" width="100%" /></a>
|
|
165
|
-
|
|
166
|
-
**Agent-Native Typeform**
|
|
167
|
-
|
|
168
|
-
Generate forms from a prompt, branch logic with the agent, and own every response in your own database.
|
|
169
|
-
|
|
170
|
-
</td>
|
|
171
|
-
<td width="33%" align="center" valign="top">
|
|
172
|
-
|
|
173
|
-
**Brain**
|
|
174
|
-
|
|
175
|
-
<a href="https://agent-native.com/templates/brain"><img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F9c9fe3b5b9494e33803cd3f494cba356?format=webp&width=800" alt="Brain template" width="100%" /></a>
|
|
176
|
-
|
|
177
|
-
**Agent-Native company memory**
|
|
178
|
-
|
|
179
|
-
Ask questions over cited company knowledge from approved Slack, meetings, transcripts, GitHub, and decisions.
|
|
180
|
-
|
|
181
|
-
</td>
|
|
182
|
-
</tr>
|
|
183
|
-
<tr>
|
|
184
|
-
<td width="33%" align="center" valign="top">
|
|
185
|
-
|
|
186
|
-
**Assets**
|
|
187
|
-
|
|
188
|
-
<a href="https://agent-native.com/templates/assets"><img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F769092170a14474f998cbca47384f891?format=webp&width=800" alt="Assets template" width="100%" /></a>
|
|
189
|
-
|
|
190
|
-
**Agent-Native asset library**
|
|
191
|
-
|
|
192
|
-
Upload, organize, search, and generate on-brand image and video assets that other apps can reuse.
|
|
193
|
-
|
|
194
136
|
</td>
|
|
195
137
|
</tr>
|
|
196
138
|
</table>
|
|
197
139
|
|
|
198
140
|
Every template is a complete cloneable SaaS — fork it, customize it with the agent, own it. Try them with example data before connecting your own sources.
|
|
199
141
|
|
|
142
|
+
View the full template gallery at **[agent-native.com/templates](https://agent-native.com/templates)**.
|
|
143
|
+
|
|
200
144
|
## Quick Start
|
|
201
145
|
|
|
146
|
+
One command to fork a template and start building locally.
|
|
147
|
+
|
|
202
148
|
```bash
|
|
203
149
|
npx @agent-native/core@latest create my-platform
|
|
204
150
|
cd my-platform
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Blueprint: add a new multi-surface action
|
|
2
|
+
|
|
3
|
+
You are a coding agent working inside an **agent-native** app (a repo built on
|
|
4
|
+
`@agent-native/core`). Apply this blueprint as real source changes on the
|
|
5
|
+
current branch. Do not just describe the work — do it, then verify.
|
|
6
|
+
|
|
7
|
+
## Goal
|
|
8
|
+
|
|
9
|
+
Add a new app operation as a single `defineAction` so it is callable from **all
|
|
10
|
+
surfaces at once**: the agent uses it as a tool, the frontend calls it through
|
|
11
|
+
`useActionQuery` / `useActionMutation`, and HTTP/MCP/A2A get it for free. One
|
|
12
|
+
implementation, every consumer — no duplicate `/api/*` route.
|
|
13
|
+
|
|
14
|
+
Use this for a real capability your app is missing (e.g. `create-note`,
|
|
15
|
+
`update-task`, `list-orders`). Replace `<thing>` below with the actual resource.
|
|
16
|
+
|
|
17
|
+
## Read first
|
|
18
|
+
|
|
19
|
+
Read the `actions` skill. The rules that matter most here:
|
|
20
|
+
|
|
21
|
+
- Actions in `actions/` are the **single source of truth**. Before adding one,
|
|
22
|
+
grep `actions/` and `AGENTS.md` — extend an existing action if it already
|
|
23
|
+
covers the operation.
|
|
24
|
+
- **Keep the surface small and orthogonal.** Prefer one CRUD-style
|
|
25
|
+
`update-<thing>` taking a patch of optional fields over N per-field actions.
|
|
26
|
+
One `create` / one `update` / one `delete` per resource.
|
|
27
|
+
- Reach for a generic query / the provider-api trio before minting another read
|
|
28
|
+
action.
|
|
29
|
+
|
|
30
|
+
## Files to touch
|
|
31
|
+
|
|
32
|
+
1. **`actions/<verb>-<thing>.ts`** — one file, default-exporting a
|
|
33
|
+
`defineAction` with a **Zod** schema:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { z } from "zod";
|
|
37
|
+
import { defineAction } from "@agent-native/core";
|
|
38
|
+
import { getDb } from "../server/db/index.js";
|
|
39
|
+
import { things } from "../server/db/schema.js";
|
|
40
|
+
|
|
41
|
+
export default defineAction({
|
|
42
|
+
description: "Create a <thing>",
|
|
43
|
+
schema: z.object({
|
|
44
|
+
title: z.string().describe("Human-readable title"),
|
|
45
|
+
notes: z.string().optional(),
|
|
46
|
+
}),
|
|
47
|
+
// Omit `http` for the default POST; use { method: "GET" } for reads.
|
|
48
|
+
run: async (args, ctx) => {
|
|
49
|
+
const db = getDb();
|
|
50
|
+
// Return plain objects/arrays — never JSON.stringify().
|
|
51
|
+
return await db
|
|
52
|
+
.insert(things)
|
|
53
|
+
.values({ ...args })
|
|
54
|
+
.returning();
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- Use Drizzle's query builder and portable `drizzle-orm` operators — no raw
|
|
60
|
+
SQL, no dialect-specific imports, no `getDbExec()` for normal actions.
|
|
61
|
+
- Use `z.coerce.number()` for numeric HTTP params; for booleans use an
|
|
62
|
+
explicit string parser (not `z.coerce.boolean()`).
|
|
63
|
+
- If only the UI/HTTP needs it (not the model), set `agentTool: false` to
|
|
64
|
+
keep the model's tool list lean — it stays callable from the UI and HTTP.
|
|
65
|
+
|
|
66
|
+
2. **If the resource is user-authored and shareable**, make its table ownable
|
|
67
|
+
and scope reads/writes. Read the `sharing` and `security` skills: tables with
|
|
68
|
+
`ownableColumns()` require `accessFilter` / `resolveAccess` / `assertAccess`
|
|
69
|
+
in the action, never an unscoped `select`/`update`.
|
|
70
|
+
|
|
71
|
+
3. **Wire the UI** to the shared action surface with `useActionQuery`
|
|
72
|
+
(reads) / `useActionMutation` (writes). Do **not** hand-write `fetch` to a
|
|
73
|
+
framework or `/api/*` route — import the client hooks. Keep the UI optimistic:
|
|
74
|
+
update cache / navigate immediately and roll back on error.
|
|
75
|
+
|
|
76
|
+
4. **Register the action** in whatever index the app uses (`actions/index.ts`
|
|
77
|
+
or the auto-discovery glob) and add it to the `AGENTS.md` action table if the
|
|
78
|
+
app maintains one.
|
|
79
|
+
|
|
80
|
+
## Framework rules to honor
|
|
81
|
+
|
|
82
|
+
- No `/api/*` or Nitro pass-through route whose job is to call/repackage this
|
|
83
|
+
action — that violates the Architecture Contract.
|
|
84
|
+
- Never hardcode secrets/credentials; read them from the secret store at call
|
|
85
|
+
time. Use placeholders in any example.
|
|
86
|
+
- Validate and scope all input; ownable tables fail closed without access
|
|
87
|
+
checks.
|
|
88
|
+
- If this edits a publishable package's source, add a `.changeset/*.md`.
|
|
89
|
+
|
|
90
|
+
## Verify
|
|
91
|
+
|
|
92
|
+
1. `agent-native typecheck` (or `tsc --noEmit`) passes.
|
|
93
|
+
2. From the agent chat, invoke the new action and confirm structured
|
|
94
|
+
input/output.
|
|
95
|
+
3. From the UI, confirm the `useActionQuery` / `useActionMutation` path works and
|
|
96
|
+
stays optimistic.
|
|
97
|
+
4. For ownable resources, confirm a non-owner cannot read or mutate another
|
|
98
|
+
user's row (access check fails closed).
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Blueprint: add a Discord inbound channel adapter
|
|
2
|
+
|
|
3
|
+
You are a coding agent working inside an **agent-native** app (a repo built on
|
|
4
|
+
`@agent-native/core`). Apply this blueprint as real source changes on the
|
|
5
|
+
current branch. Do not just describe the work — do it, then verify.
|
|
6
|
+
|
|
7
|
+
## Goal
|
|
8
|
+
|
|
9
|
+
Let users talk to the agent from Discord: a Discord message hits a webhook, the
|
|
10
|
+
framework enqueues the work, returns `200` fast, and a fresh function execution
|
|
11
|
+
runs the full agent loop and posts the reply back. You implement a
|
|
12
|
+
`PlatformAdapter` for Discord that slots into the existing integration-webhooks
|
|
13
|
+
pipeline — you do **not** invent a new transport.
|
|
14
|
+
|
|
15
|
+
## Read first
|
|
16
|
+
|
|
17
|
+
Read the `integration-webhooks` skill end to end. The non-negotiable shape: the
|
|
18
|
+
webhook handler **enqueues to SQL and returns 200 immediately**, then a
|
|
19
|
+
self-fired POST runs the agent loop in a separate execution. Never run the agent
|
|
20
|
+
loop inside the webhook handler; never rely on fire-and-forget `Promise`s after
|
|
21
|
+
returning (serverless freezes the context).
|
|
22
|
+
|
|
23
|
+
Study the existing adapters as the pattern to copy:
|
|
24
|
+
|
|
25
|
+
- `packages/core/src/integrations/types.ts` — the `PlatformAdapter`,
|
|
26
|
+
`IncomingMessage`, `OutgoingMessage` contracts.
|
|
27
|
+
- `packages/core/src/integrations/adapters/slack.ts` — the closest analog
|
|
28
|
+
(signature verification, parsing, response delivery).
|
|
29
|
+
- `packages/core/src/integrations/adapters/telegram.ts` — a simpler reference.
|
|
30
|
+
- `packages/core/src/integrations/plugin.ts` → `getDefaultAdapters()` — where
|
|
31
|
+
built-in adapters are registered into the route pipeline.
|
|
32
|
+
|
|
33
|
+
## Files to touch
|
|
34
|
+
|
|
35
|
+
1. **`packages/core/src/integrations/adapters/discord.ts`** — implement
|
|
36
|
+
`discordAdapter(): PlatformAdapter`:
|
|
37
|
+
- `platform = "discord"`, `label = "Discord"`.
|
|
38
|
+
- `getRequiredEnvKeys()` — declare `DISCORD_PUBLIC_KEY` (signature
|
|
39
|
+
verification) and `DISCORD_BOT_TOKEN` (sending), with UI hints so the
|
|
40
|
+
settings form renders them. Use obviously-fake placeholders in any docs.
|
|
41
|
+
- `handleVerification(event)` — answer Discord's `PING` interaction
|
|
42
|
+
(`type: 1`) with a `PONG` (`type: 1`).
|
|
43
|
+
- `verifyWebhook(event)` — verify the Ed25519 `X-Signature-Ed25519` /
|
|
44
|
+
`X-Signature-Timestamp` headers against `DISCORD_PUBLIC_KEY`. Fail closed.
|
|
45
|
+
- `parseMessage(event)` — map the interaction/message payload into a
|
|
46
|
+
normalized `IncomingMessage` (set `externalThreadId` to the channel/thread
|
|
47
|
+
id, `text`, `senderName`, `platformContext` with what you need to reply).
|
|
48
|
+
Return `null` to ignore bot messages and non-message events.
|
|
49
|
+
- `sendResponse(...)` — POST the agent reply back via the Discord API using
|
|
50
|
+
`DISCORD_BOT_TOKEN`, read at send time from the secret store.
|
|
51
|
+
2. **Register it** in `getDefaultAdapters()` in
|
|
52
|
+
`packages/core/src/integrations/plugin.ts` alongside `slackAdapter()` etc.
|
|
53
|
+
3. **Add `discord.spec.ts`** next to the adapter mirroring `slack.spec.ts`:
|
|
54
|
+
cover signature verification (valid + tampered), the PING/PONG verification
|
|
55
|
+
path, message parsing, and bot-message filtering.
|
|
56
|
+
|
|
57
|
+
## Framework rules to honor
|
|
58
|
+
|
|
59
|
+
- Do the minimum in the webhook handler; the agent loop runs in the
|
|
60
|
+
`_process-task` execution with its own timeout budget. Don't change that flow.
|
|
61
|
+
- `senderVerified` must reflect real cryptographic sender authentication. Never
|
|
62
|
+
derive a privileged acting identity from an unverified sender — fail closed.
|
|
63
|
+
- Never hardcode the bot token, public key, or signing secret in source, tests,
|
|
64
|
+
or fixtures. Use placeholders and read real values from the secret store.
|
|
65
|
+
- This is a publishable `packages/core` source change → add a `.changeset/*.md`.
|
|
66
|
+
|
|
67
|
+
## Verify
|
|
68
|
+
|
|
69
|
+
1. `tsc --noEmit` for `@agent-native/core` passes.
|
|
70
|
+
2. `discord.spec.ts` passes (`vitest --run src/integrations/adapters/discord`).
|
|
71
|
+
3. End-to-end smoke: send a signed test interaction to
|
|
72
|
+
`/_agent-native/integrations/discord/webhook`; confirm a `200` returns
|
|
73
|
+
immediately, a task is enqueued, the processor runs the agent loop, and a
|
|
74
|
+
reply is delivered. A tampered signature must be rejected.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Blueprint: integrate the Stripe API
|
|
2
|
+
|
|
3
|
+
You are a coding agent working inside an **agent-native** app (a repo built on
|
|
4
|
+
`@agent-native/core`). Apply this blueprint as real source changes on the
|
|
5
|
+
current branch. Do not just describe the work — do it, then verify.
|
|
6
|
+
|
|
7
|
+
## Goal
|
|
8
|
+
|
|
9
|
+
Let the agent (and the UI) talk to the Stripe API for ad-hoc reads — list
|
|
10
|
+
charges, look up a customer, summarize subscriptions — **without minting one
|
|
11
|
+
rigid action per endpoint**. Wire Stripe into the shared **provider-api
|
|
12
|
+
substrate** so any endpoint/filter is reachable through a single, safe surface.
|
|
13
|
+
|
|
14
|
+
## Why the provider-api substrate (read this first)
|
|
15
|
+
|
|
16
|
+
The framework tenet (see `CLAUDE.md` → Architecture Contract and the `actions`
|
|
17
|
+
skill): first-class actions are ergonomic shortcuts, **not** capability limits.
|
|
18
|
+
Do not hardcode `list-stripe-charges`, `get-stripe-customer`,
|
|
19
|
+
`list-stripe-subscriptions`, … Instead expose the provider-api trio so the agent
|
|
20
|
+
can hit any Stripe endpoint with the user's configured credentials, behind host
|
|
21
|
+
allow-listing, credential injection, private-network blocking, and secret
|
|
22
|
+
redaction.
|
|
23
|
+
|
|
24
|
+
The substrate lives in `@agent-native/core/provider-api`:
|
|
25
|
+
|
|
26
|
+
- `provider-api-catalog` — lists provider base URLs, auth style, credential
|
|
27
|
+
keys, docs/spec URLs, placeholders, and examples (never secrets).
|
|
28
|
+
- `provider-api-docs` — fetches the registered public docs/spec URLs when the
|
|
29
|
+
exact endpoint, filter, or payload is uncertain.
|
|
30
|
+
- `provider-api-request` — makes one constrained authenticated request to the
|
|
31
|
+
provider host, injects the configured credential, blocks internal URLs, and
|
|
32
|
+
redacts secrets.
|
|
33
|
+
|
|
34
|
+
## Files to touch
|
|
35
|
+
|
|
36
|
+
1. **Register the Stripe provider config** wherever this app assembles its
|
|
37
|
+
provider catalog (grep for `providerApi`, `provider-api`, or `defineProvider`
|
|
38
|
+
under `actions/`, `server/`, or look at `templates/dispatch/actions/` for the
|
|
39
|
+
canonical wiring). Add an entry like:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
{
|
|
43
|
+
id: "stripe",
|
|
44
|
+
label: "Stripe",
|
|
45
|
+
baseUrl: "https://api.stripe.com",
|
|
46
|
+
auth: { type: "bearer", credentialKey: "STRIPE_SECRET_KEY" },
|
|
47
|
+
docsUrls: ["https://docs.stripe.com/api"],
|
|
48
|
+
// Obviously-fake placeholder only — never a real key.
|
|
49
|
+
placeholders: { STRIPE_SECRET_KEY: "sk_test_PLACEHOLDER_xxx" },
|
|
50
|
+
examples: [
|
|
51
|
+
"GET /v1/charges?limit=10",
|
|
52
|
+
"GET /v1/customers/{id}",
|
|
53
|
+
"GET /v1/subscriptions?status=active",
|
|
54
|
+
],
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
2. **Expose the three provider-api actions** if the app does not already export
|
|
59
|
+
them. Re-use `@agent-native/core/provider-api`; do **not** re-implement the
|
|
60
|
+
request/redaction logic. Keep `provider-api-request` `http: false` unless this
|
|
61
|
+
app has a separate UI permission model for arbitrary provider writes.
|
|
62
|
+
|
|
63
|
+
3. **Register the credential** so it shows in the agent settings/onboarding UI.
|
|
64
|
+
Read the `secrets` and `onboarding` skills. The Stripe secret key is read at
|
|
65
|
+
request time via `readAppSecret` / the provider credential adapter — never
|
|
66
|
+
`process.env` for per-user/org secrets, never a literal in source.
|
|
67
|
+
|
|
68
|
+
## Framework rules to honor
|
|
69
|
+
|
|
70
|
+
- No `/api/*` or Nitro pass-through routes that just call Stripe — that violates
|
|
71
|
+
the Architecture Contract. The provider-api actions are already callable from
|
|
72
|
+
the agent, the UI (`useActionMutation`), HTTP, and MCP.
|
|
73
|
+
- Never hardcode the Stripe key, a webhook signing secret, or any
|
|
74
|
+
credential-looking literal in source, tests, fixtures, or docs. Use
|
|
75
|
+
`sk_test_PLACEHOLDER_xxx`-style fakes.
|
|
76
|
+
- If you add a publishable-package source change, add a `.changeset/*.md`.
|
|
77
|
+
- Keep the action surface small and orthogonal — the trio replaces a dozen
|
|
78
|
+
per-endpoint actions.
|
|
79
|
+
|
|
80
|
+
## Verify
|
|
81
|
+
|
|
82
|
+
1. `agent-native typecheck` (or `tsc --noEmit`) passes.
|
|
83
|
+
2. With a placeholder `STRIPE_SECRET_KEY` set, ask the agent: "list my 5 most
|
|
84
|
+
recent Stripe charges." Confirm it calls `provider-api-catalog` →
|
|
85
|
+
(optionally) `provider-api-docs` → `provider-api-request` against
|
|
86
|
+
`api.stripe.com`, and that the response redacts secrets.
|
|
87
|
+
3. Confirm the Stripe credential appears in the settings/onboarding checklist.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Blueprint: implement a Docker sandbox adapter
|
|
2
|
+
|
|
3
|
+
You are a coding agent working inside an **agent-native** app (a repo built on
|
|
4
|
+
`@agent-native/core`). Apply this blueprint as real source changes on the
|
|
5
|
+
current branch. Do not just describe the work — do it, then verify.
|
|
6
|
+
|
|
7
|
+
## Goal
|
|
8
|
+
|
|
9
|
+
Run the `run-code` tool's agent-supplied JavaScript inside a **Docker
|
|
10
|
+
container** instead of a local child process, without touching the agent loop,
|
|
11
|
+
`run-code.ts`, the localhost bridge, the env scrub, or the output formatting.
|
|
12
|
+
You implement the `SandboxAdapter` seam and select it via
|
|
13
|
+
`AGENT_NATIVE_SANDBOX` / `registerSandboxAdapter()`.
|
|
14
|
+
|
|
15
|
+
## Read first
|
|
16
|
+
|
|
17
|
+
Read these three files — they ARE the contract:
|
|
18
|
+
|
|
19
|
+
- `packages/core/src/coding-tools/sandbox/adapter.ts` — the `SandboxAdapter`
|
|
20
|
+
interface plus `SandboxRunRequest` / `SandboxRunResult` / `SandboxEnv`.
|
|
21
|
+
- `packages/core/src/coding-tools/sandbox/index.ts` — `getSandboxAdapter()`
|
|
22
|
+
resolution order (registered → `AGENT_NATIVE_SANDBOX` built-in → local
|
|
23
|
+
default) and `registerSandboxAdapter()`. Note the `// TODO: remote/durable
|
|
24
|
+
adapter` block — that is exactly this work.
|
|
25
|
+
- `packages/core/src/coding-tools/sandbox/local-child-process-adapter.ts` — the
|
|
26
|
+
reference implementation to mirror for timeout enforcement and stdout/stderr
|
|
27
|
+
capture.
|
|
28
|
+
|
|
29
|
+
Key invariant: the adapter receives an **already-prepared, non-secret**
|
|
30
|
+
`moduleSource` (it already embeds the loopback bridge URL/token and wraps the
|
|
31
|
+
user's code) plus a scrubbed `env`. The adapter only **runs** it. It must never
|
|
32
|
+
augment `env` with the parent's environment and never see app secrets.
|
|
33
|
+
|
|
34
|
+
## Files to touch
|
|
35
|
+
|
|
36
|
+
1. **`packages/core/src/coding-tools/sandbox/docker-adapter.ts`** — implement
|
|
37
|
+
`class DockerSandboxAdapter implements SandboxAdapter`:
|
|
38
|
+
- `readonly id = "docker"`.
|
|
39
|
+
- `run(request)`:
|
|
40
|
+
- Write `request.moduleSource` to a temp ESM file (or pass via stdin).
|
|
41
|
+
- Spawn `docker run --rm` with a minimal Node image, the file mounted
|
|
42
|
+
read-only, `--network` configured so the sandbox can still reach the
|
|
43
|
+
parent's loopback bridge on `request.bridgePort` (use
|
|
44
|
+
`--add-host=host.docker.internal:host-gateway` and rewrite/allow the
|
|
45
|
+
bridge host, or `--network=host` where acceptable — document the
|
|
46
|
+
trade-off in a comment). Pass `request.env` explicitly; do NOT inherit
|
|
47
|
+
the host env. Apply CPU/memory limits.
|
|
48
|
+
- Enforce `request.timeoutMs` as a hard wall-clock kill (`docker kill`),
|
|
49
|
+
and set `timedOut: true` when you kill for timeout.
|
|
50
|
+
- Capture stdout/stderr and the container exit code into
|
|
51
|
+
`SandboxRunResult` (`exitCode: null` when terminated by signal).
|
|
52
|
+
2. **Wire selection** in
|
|
53
|
+
`packages/core/src/coding-tools/sandbox/index.ts` by adding `docker` to the
|
|
54
|
+
`BUILT_IN_ADAPTERS` map (`docker: () => new DockerSandboxAdapter()`), so
|
|
55
|
+
`AGENT_NATIVE_SANDBOX=docker` selects it. A host process can also call
|
|
56
|
+
`registerSandboxAdapter(new DockerSandboxAdapter())` to force it everywhere.
|
|
57
|
+
3. **Add `docker-adapter.spec.ts`** mirroring the existing sandbox
|
|
58
|
+
`index.spec.ts`: assert `getSandboxAdapter()` returns the Docker adapter when
|
|
59
|
+
`AGENT_NATIVE_SANDBOX=docker`, that a registered adapter wins over the env
|
|
60
|
+
var, and that timeout produces `timedOut: true`. Skip the real-`docker`
|
|
61
|
+
integration path when the Docker daemon is unavailable (guard on a probe).
|
|
62
|
+
|
|
63
|
+
## Framework rules to honor
|
|
64
|
+
|
|
65
|
+
- Do not change `run-code.ts`, the agent loop, the bridge, the env scrub, or the
|
|
66
|
+
output formatting — the whole point of the seam is that they stay untouched.
|
|
67
|
+
- Preserve the security posture: the adapter sees only scrubbed env + prepared
|
|
68
|
+
module source. Never re-inject the parent env or app secrets.
|
|
69
|
+
- This is a publishable `packages/core` source change → add a `.changeset/*.md`.
|
|
70
|
+
|
|
71
|
+
## Verify
|
|
72
|
+
|
|
73
|
+
1. `tsc --noEmit` for `@agent-native/core` passes.
|
|
74
|
+
2. `docker-adapter.spec.ts` passes.
|
|
75
|
+
3. With Docker available, set `AGENT_NATIVE_SANDBOX=docker` and run a `run-code`
|
|
76
|
+
task that uses `appAction`/`providerFetch` through the loopback bridge;
|
|
77
|
+
confirm it executes in a container and the bridge round-trips. Confirm a
|
|
78
|
+
long-running task is killed at `timeoutMs` with `timedOut: true`.
|
package/dist/action.d.ts
CHANGED
|
@@ -213,7 +213,19 @@ export interface ParameterSchema {
|
|
|
213
213
|
type InferParams<T extends Record<string, ParameterSchema> | undefined> = T extends Record<string, ParameterSchema> ? {
|
|
214
214
|
[K in keyof T]?: string;
|
|
215
215
|
} : Record<string, string>;
|
|
216
|
-
|
|
216
|
+
/**
|
|
217
|
+
* What to do when an action's RETURN value fails `outputSchema` validation.
|
|
218
|
+
*
|
|
219
|
+
* - `"strict"` — throw a clear error so a buggy action surfaces loudly.
|
|
220
|
+
* - `"warn"` (default) — `console.warn` the issues and return the ORIGINAL
|
|
221
|
+
* result unchanged. Non-breaking: behavior never changes unless the dev
|
|
222
|
+
* opts into `"strict"` or `"fallback"`.
|
|
223
|
+
* - `"fallback"` — return `outputFallback` in place of the invalid result.
|
|
224
|
+
*
|
|
225
|
+
* Mirrors Mastra/Flue structured-output handling, kept on the action layer.
|
|
226
|
+
*/
|
|
227
|
+
export type ActionOutputErrorStrategy = "strict" | "warn" | "fallback";
|
|
228
|
+
interface DefineActionWithSchema<TSchema extends StandardSchemaV1, TReturn = any, TOutputSchema extends StandardSchemaV1 | undefined = undefined> {
|
|
217
229
|
description: string;
|
|
218
230
|
/** Standard Schema-compatible schema (Zod, Valibot, ArkType). Provides runtime
|
|
219
231
|
* validation and full TypeScript type inference for `run()` args. The schema is
|
|
@@ -221,6 +233,16 @@ interface DefineActionWithSchema<TSchema extends StandardSchemaV1, TReturn = any
|
|
|
221
233
|
schema: TSchema;
|
|
222
234
|
/** Legacy parameters — ignored when `schema` is provided. */
|
|
223
235
|
parameters?: never;
|
|
236
|
+
/** Optional Standard Schema-compatible schema (Zod, Valibot, ArkType) the
|
|
237
|
+
* action's RETURN value is validated against AFTER `run()` resolves. Borrowed
|
|
238
|
+
* from Mastra/Flue structured-output. When omitted, behavior is byte-for-byte
|
|
239
|
+
* unchanged. The mismatch handling is governed by `outputErrorStrategy`. */
|
|
240
|
+
outputSchema?: TOutputSchema;
|
|
241
|
+
/** What to do when the result fails `outputSchema`. Default: `"warn"`. */
|
|
242
|
+
outputErrorStrategy?: ActionOutputErrorStrategy;
|
|
243
|
+
/** Value returned in place of an invalid result when `outputErrorStrategy` is
|
|
244
|
+
* `"fallback"`. Ignored for the other strategies. */
|
|
245
|
+
outputFallback?: TReturn;
|
|
224
246
|
run: (args: StandardSchemaV1.InferOutput<TSchema>, ctx?: ActionRunContext) => Promise<TReturn> | TReturn;
|
|
225
247
|
http?: ActionHttpConfig | false;
|
|
226
248
|
/** Whether the HTTP/frontend action route must have an authenticated owner.
|
|
@@ -272,6 +294,23 @@ interface DefineActionWithSchema<TSchema extends StandardSchemaV1, TReturn = any
|
|
|
272
294
|
* interactive app iframes. Text/deep-link tool results remain the fallback
|
|
273
295
|
* for CLI and non-UI hosts. */
|
|
274
296
|
mcpApp?: ActionMcpAppConfig;
|
|
297
|
+
/**
|
|
298
|
+
* Opt-in human-in-the-loop approval gate. **Default off** — the framework
|
|
299
|
+
* intentionally keeps HITL approvals rare; almost every action should run
|
|
300
|
+
* without one. Set this only for high-consequence, outward-facing,
|
|
301
|
+
* hard-to-undo operations (the canonical example is actually sending an
|
|
302
|
+
* email). When `needsApproval` resolves truthy and the agent calls this
|
|
303
|
+
* action, the loop does NOT execute `run()`: it emits an `approval_required`
|
|
304
|
+
* event and stops the turn, waiting for a human to approve. The action runs
|
|
305
|
+
* only once the human re-issues the turn approving this specific call.
|
|
306
|
+
*
|
|
307
|
+
* - `true` — always require approval.
|
|
308
|
+
* - `(args, ctx) => boolean | Promise<boolean>` — require approval only when
|
|
309
|
+
* the predicate returns true (e.g. only for external recipients, only
|
|
310
|
+
* above a dollar threshold). Keep it pure + fast; thrown errors are treated
|
|
311
|
+
* as "approval required" (fail closed).
|
|
312
|
+
*/
|
|
313
|
+
needsApproval?: boolean | ((args: StandardSchemaV1.InferOutput<TSchema>, ctx?: ActionRunContext) => boolean | Promise<boolean>);
|
|
275
314
|
}
|
|
276
315
|
interface DefineActionWithParams<TParams extends Record<string, ParameterSchema> | undefined = Record<string, ParameterSchema> | undefined, TReturn = any> {
|
|
277
316
|
description: string;
|
|
@@ -280,6 +319,15 @@ interface DefineActionWithParams<TParams extends Record<string, ParameterSchema>
|
|
|
280
319
|
parameters?: TParams;
|
|
281
320
|
/** Standard Schema — not used in this overload. */
|
|
282
321
|
schema?: never;
|
|
322
|
+
/** Optional Standard Schema-compatible schema the action's RETURN value is
|
|
323
|
+
* validated against AFTER `run()` resolves. See the schema overload above.
|
|
324
|
+
* When omitted, behavior is byte-for-byte unchanged. */
|
|
325
|
+
outputSchema?: StandardSchemaV1;
|
|
326
|
+
/** What to do when the result fails `outputSchema`. Default: `"warn"`. */
|
|
327
|
+
outputErrorStrategy?: ActionOutputErrorStrategy;
|
|
328
|
+
/** Value returned in place of an invalid result when `outputErrorStrategy` is
|
|
329
|
+
* `"fallback"`. Ignored for the other strategies. */
|
|
330
|
+
outputFallback?: TReturn;
|
|
283
331
|
run: (args: InferParams<TParams>, ctx?: ActionRunContext) => Promise<TReturn> | TReturn;
|
|
284
332
|
http?: ActionHttpConfig | false;
|
|
285
333
|
/** Whether the HTTP/frontend action route must have an authenticated owner.
|
|
@@ -305,6 +353,9 @@ interface DefineActionWithParams<TParams extends Record<string, ParameterSchema>
|
|
|
305
353
|
link?: ActionLinkBuilder;
|
|
306
354
|
/** Optional MCP Apps UI resource. See schema overload above. */
|
|
307
355
|
mcpApp?: ActionMcpAppConfig;
|
|
356
|
+
/** Opt-in human-in-the-loop approval gate (default off). See the schema
|
|
357
|
+
* overload above for full semantics. */
|
|
358
|
+
needsApproval?: boolean | ((args: InferParams<TParams>, ctx?: ActionRunContext) => boolean | Promise<boolean>);
|
|
308
359
|
}
|
|
309
360
|
/**
|
|
310
361
|
* Opaque typed wrapper returned by `defineAction`. The type parameters carry
|
|
@@ -336,6 +387,18 @@ export interface ActionDefinition<TInput, TReturn> {
|
|
|
336
387
|
readonly publicAgent?: PublicAgentActionConfig;
|
|
337
388
|
readonly link?: ActionLinkBuilder;
|
|
338
389
|
readonly mcpApp?: ActionMcpAppConfig;
|
|
390
|
+
/** Standard Schema the action's RETURN value is validated against after
|
|
391
|
+
* `run()` resolves. Present only when the caller passed `outputSchema`. */
|
|
392
|
+
readonly outputSchema?: StandardSchemaV1;
|
|
393
|
+
/** Resolved output-mismatch strategy. Present only when `outputSchema` is
|
|
394
|
+
* set; defaults to `"warn"`. */
|
|
395
|
+
readonly outputErrorStrategy?: ActionOutputErrorStrategy;
|
|
396
|
+
/** Value substituted for an invalid result under the `"fallback"` strategy. */
|
|
397
|
+
readonly outputFallback?: TReturn;
|
|
398
|
+
/** Opt-in human-in-the-loop approval gate (default off). When truthy, the
|
|
399
|
+
* agent loop emits `approval_required` and pauses instead of executing this
|
|
400
|
+
* action until a human approves the specific call. */
|
|
401
|
+
readonly needsApproval?: boolean | ((args: TInput, ctx?: ActionRunContext) => boolean | Promise<boolean>);
|
|
339
402
|
}
|
|
340
403
|
/**
|
|
341
404
|
* Define an agent action. Place in `actions/` directory — auto-discovered by the framework.
|