@agent-native/core 0.52.0 → 0.53.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.
Files changed (212) hide show
  1. package/README.md +41 -95
  2. package/blueprints/action/crud.md +98 -0
  3. package/blueprints/channel/discord.md +74 -0
  4. package/blueprints/provider/stripe.md +87 -0
  5. package/blueprints/sandbox/docker.md +78 -0
  6. package/dist/action.d.ts +24 -0
  7. package/dist/action.d.ts.map +1 -1
  8. package/dist/action.js +4 -0
  9. package/dist/action.js.map +1 -1
  10. package/dist/agent/observational-memory/compactor.d.ts +43 -0
  11. package/dist/agent/observational-memory/compactor.d.ts.map +1 -0
  12. package/dist/agent/observational-memory/compactor.js +50 -0
  13. package/dist/agent/observational-memory/compactor.js.map +1 -0
  14. package/dist/agent/observational-memory/config.d.ts +37 -0
  15. package/dist/agent/observational-memory/config.d.ts.map +1 -0
  16. package/dist/agent/observational-memory/config.js +48 -0
  17. package/dist/agent/observational-memory/config.js.map +1 -0
  18. package/dist/agent/observational-memory/index.d.ts +26 -0
  19. package/dist/agent/observational-memory/index.d.ts.map +1 -0
  20. package/dist/agent/observational-memory/index.js +25 -0
  21. package/dist/agent/observational-memory/index.js.map +1 -0
  22. package/dist/agent/observational-memory/internal-run.d.ts +37 -0
  23. package/dist/agent/observational-memory/internal-run.d.ts.map +1 -0
  24. package/dist/agent/observational-memory/internal-run.js +59 -0
  25. package/dist/agent/observational-memory/internal-run.js.map +1 -0
  26. package/dist/agent/observational-memory/message-text.d.ts +13 -0
  27. package/dist/agent/observational-memory/message-text.d.ts.map +1 -0
  28. package/dist/agent/observational-memory/message-text.js +46 -0
  29. package/dist/agent/observational-memory/message-text.js.map +1 -0
  30. package/dist/agent/observational-memory/migrations.d.ts +13 -0
  31. package/dist/agent/observational-memory/migrations.d.ts.map +1 -0
  32. package/dist/agent/observational-memory/migrations.js +43 -0
  33. package/dist/agent/observational-memory/migrations.js.map +1 -0
  34. package/dist/agent/observational-memory/observer.d.ts +37 -0
  35. package/dist/agent/observational-memory/observer.d.ts.map +1 -0
  36. package/dist/agent/observational-memory/observer.js +82 -0
  37. package/dist/agent/observational-memory/observer.js.map +1 -0
  38. package/dist/agent/observational-memory/plugin.d.ts +16 -0
  39. package/dist/agent/observational-memory/plugin.d.ts.map +1 -0
  40. package/dist/agent/observational-memory/plugin.js +26 -0
  41. package/dist/agent/observational-memory/plugin.js.map +1 -0
  42. package/dist/agent/observational-memory/prompts.d.ts +27 -0
  43. package/dist/agent/observational-memory/prompts.d.ts.map +1 -0
  44. package/dist/agent/observational-memory/prompts.js +42 -0
  45. package/dist/agent/observational-memory/prompts.js.map +1 -0
  46. package/dist/agent/observational-memory/read.d.ts +47 -0
  47. package/dist/agent/observational-memory/read.d.ts.map +1 -0
  48. package/dist/agent/observational-memory/read.js +99 -0
  49. package/dist/agent/observational-memory/read.js.map +1 -0
  50. package/dist/agent/observational-memory/reflector.d.ts +31 -0
  51. package/dist/agent/observational-memory/reflector.d.ts.map +1 -0
  52. package/dist/agent/observational-memory/reflector.js +76 -0
  53. package/dist/agent/observational-memory/reflector.js.map +1 -0
  54. package/dist/agent/observational-memory/schema.d.ts +267 -0
  55. package/dist/agent/observational-memory/schema.d.ts.map +1 -0
  56. package/dist/agent/observational-memory/schema.js +48 -0
  57. package/dist/agent/observational-memory/schema.js.map +1 -0
  58. package/dist/agent/observational-memory/store.d.ts +52 -0
  59. package/dist/agent/observational-memory/store.d.ts.map +1 -0
  60. package/dist/agent/observational-memory/store.js +197 -0
  61. package/dist/agent/observational-memory/store.js.map +1 -0
  62. package/dist/agent/observational-memory/types.d.ts +61 -0
  63. package/dist/agent/observational-memory/types.d.ts.map +1 -0
  64. package/dist/agent/observational-memory/types.js +9 -0
  65. package/dist/agent/observational-memory/types.js.map +1 -0
  66. package/dist/agent/production-agent.d.ts +15 -0
  67. package/dist/agent/production-agent.d.ts.map +1 -1
  68. package/dist/agent/production-agent.js +240 -1
  69. package/dist/agent/production-agent.js.map +1 -1
  70. package/dist/agent/run-loop-with-resume.d.ts.map +1 -1
  71. package/dist/agent/run-loop-with-resume.js +49 -0
  72. package/dist/agent/run-loop-with-resume.js.map +1 -1
  73. package/dist/agent/run-store.d.ts +17 -0
  74. package/dist/agent/run-store.d.ts.map +1 -1
  75. package/dist/agent/run-store.js +55 -0
  76. package/dist/agent/run-store.js.map +1 -1
  77. package/dist/agent/runtime-context.d.ts +30 -0
  78. package/dist/agent/runtime-context.d.ts.map +1 -1
  79. package/dist/agent/runtime-context.js +54 -1
  80. package/dist/agent/runtime-context.js.map +1 -1
  81. package/dist/agent/tool-call-journal.d.ts +101 -0
  82. package/dist/agent/tool-call-journal.d.ts.map +1 -0
  83. package/dist/agent/tool-call-journal.js +214 -0
  84. package/dist/agent/tool-call-journal.js.map +1 -0
  85. package/dist/agent/types.d.ts +24 -0
  86. package/dist/agent/types.d.ts.map +1 -1
  87. package/dist/agent/types.js.map +1 -1
  88. package/dist/cli/add.d.ts +109 -0
  89. package/dist/cli/add.d.ts.map +1 -0
  90. package/dist/cli/add.js +352 -0
  91. package/dist/cli/add.js.map +1 -0
  92. package/dist/cli/connect.d.ts +2 -2
  93. package/dist/cli/connect.d.ts.map +1 -1
  94. package/dist/cli/connect.js +92 -24
  95. package/dist/cli/connect.js.map +1 -1
  96. package/dist/cli/eval.d.ts +17 -0
  97. package/dist/cli/eval.d.ts.map +1 -0
  98. package/dist/cli/eval.js +121 -0
  99. package/dist/cli/eval.js.map +1 -0
  100. package/dist/cli/index.js +44 -3
  101. package/dist/cli/index.js.map +1 -1
  102. package/dist/cli/mcp.d.ts.map +1 -1
  103. package/dist/cli/mcp.js +11 -5
  104. package/dist/cli/mcp.js.map +1 -1
  105. package/dist/cli/plan-local.d.ts +66 -5
  106. package/dist/cli/plan-local.d.ts.map +1 -1
  107. package/dist/cli/plan-local.js +495 -19
  108. package/dist/cli/plan-local.js.map +1 -1
  109. package/dist/cli/skills.d.ts +2 -2
  110. package/dist/cli/skills.d.ts.map +1 -1
  111. package/dist/cli/skills.js +70 -59
  112. package/dist/cli/skills.js.map +1 -1
  113. package/dist/client/AssistantChat.d.ts.map +1 -1
  114. package/dist/client/AssistantChat.js +118 -92
  115. package/dist/client/AssistantChat.js.map +1 -1
  116. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  117. package/dist/client/agent-chat-adapter.js +16 -0
  118. package/dist/client/agent-chat-adapter.js.map +1 -1
  119. package/dist/client/chat/tool-call-display.d.ts +20 -1
  120. package/dist/client/chat/tool-call-display.d.ts.map +1 -1
  121. package/dist/client/chat/tool-call-display.js +32 -7
  122. package/dist/client/chat/tool-call-display.js.map +1 -1
  123. package/dist/client/sse-event-processor.d.ts +13 -0
  124. package/dist/client/sse-event-processor.d.ts.map +1 -1
  125. package/dist/client/sse-event-processor.js +21 -0
  126. package/dist/client/sse-event-processor.js.map +1 -1
  127. package/dist/db/client.d.ts +4 -2
  128. package/dist/db/client.d.ts.map +1 -1
  129. package/dist/db/client.js +6 -4
  130. package/dist/db/client.js.map +1 -1
  131. package/dist/deploy/route-discovery.d.ts.map +1 -1
  132. package/dist/deploy/route-discovery.js +1 -0
  133. package/dist/deploy/route-discovery.js.map +1 -1
  134. package/dist/eval/agent-runner.d.ts +63 -0
  135. package/dist/eval/agent-runner.d.ts.map +1 -0
  136. package/dist/eval/agent-runner.js +142 -0
  137. package/dist/eval/agent-runner.js.map +1 -0
  138. package/dist/eval/define-eval.d.ts +29 -0
  139. package/dist/eval/define-eval.d.ts.map +1 -0
  140. package/dist/eval/define-eval.js +43 -0
  141. package/dist/eval/define-eval.js.map +1 -0
  142. package/dist/eval/index.d.ts +18 -0
  143. package/dist/eval/index.d.ts.map +1 -0
  144. package/dist/eval/index.js +17 -0
  145. package/dist/eval/index.js.map +1 -0
  146. package/dist/eval/report.d.ts +8 -0
  147. package/dist/eval/report.d.ts.map +1 -0
  148. package/dist/eval/report.js +44 -0
  149. package/dist/eval/report.js.map +1 -0
  150. package/dist/eval/runner.d.ts +67 -0
  151. package/dist/eval/runner.d.ts.map +1 -0
  152. package/dist/eval/runner.js +256 -0
  153. package/dist/eval/runner.js.map +1 -0
  154. package/dist/eval/scorer.d.ts +83 -0
  155. package/dist/eval/scorer.d.ts.map +1 -0
  156. package/dist/eval/scorer.js +195 -0
  157. package/dist/eval/scorer.js.map +1 -0
  158. package/dist/eval/types.d.ts +162 -0
  159. package/dist/eval/types.d.ts.map +1 -0
  160. package/dist/eval/types.js +20 -0
  161. package/dist/eval/types.js.map +1 -0
  162. package/dist/observability/traces.d.ts.map +1 -1
  163. package/dist/observability/traces.js +100 -1
  164. package/dist/observability/traces.js.map +1 -1
  165. package/dist/observability/tracing.d.ts +73 -0
  166. package/dist/observability/tracing.d.ts.map +1 -0
  167. package/dist/observability/tracing.js +126 -0
  168. package/dist/observability/tracing.js.map +1 -0
  169. package/dist/onboarding/default-steps.d.ts.map +1 -1
  170. package/dist/onboarding/default-steps.js +4 -1
  171. package/dist/onboarding/default-steps.js.map +1 -1
  172. package/dist/provider-api/actions/query-staged-dataset.d.ts +1 -1
  173. package/dist/scripts/agent-engines/list-agent-engines.d.ts.map +1 -1
  174. package/dist/scripts/agent-engines/list-agent-engines.js +10 -3
  175. package/dist/scripts/agent-engines/list-agent-engines.js.map +1 -1
  176. package/dist/server/action-discovery.d.ts.map +1 -1
  177. package/dist/server/action-discovery.js +4 -0
  178. package/dist/server/action-discovery.js.map +1 -1
  179. package/dist/server/agent-chat-plugin.d.ts +9 -0
  180. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  181. package/dist/server/agent-chat-plugin.js +118 -110
  182. package/dist/server/agent-chat-plugin.js.map +1 -1
  183. package/dist/server/agent-teams.d.ts +62 -0
  184. package/dist/server/agent-teams.d.ts.map +1 -1
  185. package/dist/server/agent-teams.js +99 -2
  186. package/dist/server/agent-teams.js.map +1 -1
  187. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  188. package/dist/server/core-routes-plugin.js +7 -4
  189. package/dist/server/core-routes-plugin.js.map +1 -1
  190. package/dist/server/credential-provider.d.ts.map +1 -1
  191. package/dist/server/credential-provider.js +2 -0
  192. package/dist/server/credential-provider.js.map +1 -1
  193. package/dist/server/framework-request-handler.d.ts.map +1 -1
  194. package/dist/server/framework-request-handler.js +33 -1
  195. package/dist/server/framework-request-handler.js.map +1 -1
  196. package/dist/server/index.d.ts +1 -0
  197. package/dist/server/index.d.ts.map +1 -1
  198. package/dist/server/index.js +1 -0
  199. package/dist/server/index.js.map +1 -1
  200. package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +10 -0
  201. package/dist/templates/workspace-core/.agents/skills/harness-agents/SKILL.md +20 -0
  202. package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +20 -0
  203. package/docs/content/agent-teams.md +32 -0
  204. package/docs/content/blueprint-installer.md +73 -0
  205. package/docs/content/evals.md +141 -0
  206. package/docs/content/pr-visual-recap.md +7 -4
  207. package/docs/content/sandbox-adapters.md +134 -0
  208. package/docs/content/template-plan.md +20 -8
  209. package/package.json +5 -1
  210. package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +10 -0
  211. package/src/templates/workspace-core/.agents/skills/harness-agents/SKILL.md +20 -0
  212. package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +20 -0
@@ -180,22 +180,34 @@ or set the convention for your agent environment:
180
180
  export AGENT_NATIVE_PLANS_MODE=local-files
181
181
  ```
182
182
 
183
- In this mode the agent writes a local MDX folder under `plans/<slug>/` and must
184
- not call the hosted Plan MCP tools. The durable files are:
183
+ In this mode the agent writes a local MDX folder and must not call the hosted
184
+ Plan MCP tools. Use a repo folder such as `plans/<slug>/` when you want the plan
185
+ checked in with the code. Use a temp or ignored folder, such as
186
+ `/tmp/agent-native-plans/<slug>/` or `.agent-native/plans/<slug>/`, when the
187
+ plan should stay out of git. The folder contains:
185
188
 
186
189
  - `plan.mdx`
187
190
  - optional `canvas.mdx`
188
191
  - optional `prototype.mdx`
189
192
  - optional `.plan-state.json`
190
193
 
191
- After writing the folder, the agent validates and previews it locally:
194
+ After writing the folder, the agent starts a tiny localhost bridge and opens the
195
+ hosted Plan UI against that local-only source:
192
196
 
193
197
  ```bash
194
- npx @agent-native/core@latest plan local preview --dir plans/<slug> --kind plan --open
198
+ npx @agent-native/core@latest plan local serve --dir plans/<slug> --kind plan --open
195
199
  ```
196
200
 
197
- If you run the Plan app locally with the same `PLAN_LOCAL_DIR`, you can open the
198
- read-only app route:
201
+ The bridge URL looks like
202
+ `https://plan.agent-native.com/local-plans/<slug>?bridge=http://127.0.0.1:...`.
203
+ The page is the normal Plan viewer, but the browser fetches `plan.mdx`,
204
+ `canvas.mdx`, `prototype.mdx`, `.plan-state.json`, and local image assets from
205
+ the localhost bridge. Plan content is not written to the hosted database and is
206
+ not sent through hosted Plan actions. Keep the bridge process running while you
207
+ review; the URL is local to your machine and is not a shareable team link.
208
+
209
+ If you run the Plan app locally with the same `PLAN_LOCAL_DIR`, you can also
210
+ open the read-only app route:
199
211
 
200
212
  ```text
201
213
  http://localhost:<port>/local-plans/<slug>
@@ -206,8 +218,8 @@ Plan database. It also disables hosted sharing, browser comments, plan history,
206
218
  and publish/export receipts until you explicitly opt into publishing. To move a
207
219
  local plan into the hosted database, call `publish-visual-plan` with the local
208
220
  MDX folder path; this uploads the plan, assigns it a hosted ID, enables sharing
209
- and commenting, and returns the hosted URL. It does
210
- not automatically make your coding agent's LLM local; choose a local or approved
221
+ and commenting, and returns the hosted URL. Local-files mode does not
222
+ automatically make your coding agent's LLM local; choose a local or approved
211
223
  model if that privacy boundary matters too.
212
224
 
213
225
  ## Desktop local file sync {#desktop-local-sync}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.52.0",
3
+ "version": "0.53.0",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -74,6 +74,7 @@
74
74
  "./agent/context-xray/actions/context-evict": "./dist/agent/context-xray/actions/context-evict.js",
75
75
  "./agent/context-xray/actions/context-restore": "./dist/agent/context-xray/actions/context-restore.js",
76
76
  "./agent/context-xray/actions/context-report": "./dist/agent/context-xray/actions/context-report.js",
77
+ "./agent/observational-memory": "./dist/agent/observational-memory/index.js",
77
78
  "./resources": "./dist/resources/index.js",
78
79
  "./resources/store": "./dist/resources/store.js",
79
80
  "./resources/metadata": "./dist/resources/metadata.js",
@@ -135,6 +136,7 @@
135
136
  "./styles/agent-native.css": "./dist/styles/agent-native.css",
136
137
  "./agent/engine": "./dist/agent/engine/index.js",
137
138
  "./agent/harness": "./dist/agent/harness/index.js",
139
+ "./eval": "./dist/eval/index.js",
138
140
  "./tsconfig.base.json": "./tsconfig.base.json"
139
141
  },
140
142
  "sideEffects": [
@@ -142,6 +144,7 @@
142
144
  ],
143
145
  "files": [
144
146
  "bin",
147
+ "blueprints",
145
148
  "dist",
146
149
  "docs",
147
150
  "tsconfig.base.json",
@@ -264,6 +267,7 @@
264
267
  "ws": ">=8"
265
268
  },
266
269
  "optionalDependencies": {
270
+ "@opentelemetry/api": "^1.9.1",
267
271
  "playwright": "^1.60.0"
268
272
  },
269
273
  "peerDependenciesMeta": {
@@ -416,3 +416,13 @@ before telling the user they are unauthenticated.
416
416
  - **a2a-protocol** — the `ask-agent` meta-tool and JSON-RPC peer calls
417
417
  - **adding-a-feature** — the four-area checklist (add a `link` builder when a
418
418
  feature produces a navigable resource)
419
+
420
+ ## Blueprint installer
421
+
422
+ To add a whole new integration the agent-native way, `agent-native add <kind>
423
+ <name|url>` prints a curated Markdown blueprint to stdout — pipe it into the
424
+ external coding agent you connected (`agent-native add provider stripe |
425
+ claude`) and it applies the changes against the live repo. A URL emits a
426
+ generic research-and-integrate blueprint instead. Seeded kinds:
427
+ `provider` / `channel` / `sandbox` / `action`. Add your own by dropping a
428
+ `.md` in `packages/core/blueprints/<kind>/`. See the Blueprint Installer doc.
@@ -80,6 +80,26 @@ existing run routes as `goalId=agent-harness`.
80
80
  Preserve `defineAction` auth, request context, timeouts, truncation, and
81
81
  read-only metadata.
82
82
 
83
+ ## Code Execution Sandbox
84
+
85
+ - The `run-code` tool executes through a pluggable `SandboxAdapter`
86
+ (`packages/core/src/coding-tools/sandbox/`). The default
87
+ `LocalChildProcessAdapter` spawns a locked-down local Node child process;
88
+ swap it via `AGENT_NATIVE_SANDBOX` or `registerSandboxAdapter()` for a
89
+ Docker/remote/durable backend (the lever to exceed the hosted ~40s code-exec
90
+ ceiling). An adapter only runs the already-prepared, non-secret module source
91
+ — it never sees app secrets. See the Sandbox Adapters doc; `agent-native add
92
+ sandbox docker` emits a full Docker-adapter recipe.
93
+
94
+ ## Sub-Agent Delegation Depth
95
+
96
+ - Sub-agent spawning is capped server-side (default depth `2`) so delegation
97
+ chains can't fan out indefinitely. Override at deploy time with
98
+ `AGENT_NATIVE_MAX_SUBAGENT_DEPTH` (`0` disables sub-agents; clamped to `16`).
99
+ Enforcement is ambient via `evaluateSubagentDepth` in
100
+ `packages/core/src/server/agent-teams.ts` — independent of any tool-level
101
+ guard. See the Agent Teams doc for the depth model.
102
+
83
103
  ## Don't
84
104
 
85
105
  - Don't add Claude Code, Codex, Cursor, Mastra, or Pi as an `AgentEngine`.
@@ -75,6 +75,26 @@ const criteria: EvalCriteria = {
75
75
  };
76
76
  ```
77
77
 
78
+ #### Evals (CI gate)
79
+
80
+ The three layers above score *real production runs* after the fact. For an active, deterministic gate, use the first-class `*.eval.ts` primitive from `@agent-native/core/eval` (source: `packages/core/src/eval/*`). It runs the actual agent loop against fixed inputs and exits non-zero below threshold, so it gates CI/deploys.
81
+
82
+ ```ts
83
+ // evals/faq.eval.ts
84
+ import { defineEval, contains, llmJudge } from "@agent-native/core/eval";
85
+
86
+ export default defineEval({
87
+ name: "answers the FAQ",
88
+ input: { prompt: "What is your return policy?" },
89
+ threshold: 0.7,
90
+ scorers: [contains("30 days"), llmJudge({ criteria: "accuracy" })],
91
+ });
92
+ ```
93
+
94
+ - Built-in scorers: `exactMatch` / `contains` / `usesTool` (pure JS) and `llmJudge` (provider-agnostic judge).
95
+ - Custom scorers: `createScorer` with the 4-step `preprocess → analyze → generateScore → generateReason` pipeline (only `generateScore` is required).
96
+ - Run as a gate: `agent-native eval [pattern] [--json] [--threshold N]` — discovers `**/*.eval.ts` and `evals/*.ts`, runs the agent, and exits non-zero if any eval is below its threshold. An app with no eval files exits `0`. Complements (does not replace) the post-hoc scoring in `evals.ts`. See the Evals doc.
97
+
78
98
  ### 4. Experiments
79
99
 
80
100
  A/B testing with sticky user-level assignment: