@agent-native/core 0.65.0 → 0.66.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,6 +62,65 @@ app that never uses a harness does not pay for it. Each adapter carries an
62
62
  error if the packages are missing, and `isAgentHarnessPackageInstalled(entry)`
63
63
  lets you check first.
64
64
 
65
+ `registerBuiltinAgentHarnesses()` also registers the [ACP](#acp) harnesses
66
+ (`acp`, `acp:gemini`, `acp:claude-code`).
67
+
68
+ ## ACP agents {#acp}
69
+
70
+ Agent-Native can act as an [ACP](https://agentclientprotocol.com) (Agent Client
71
+ Protocol) **client** and drive a local coding agent — Gemini CLI, Claude Code,
72
+ or any ACP-compliant agent — through this same substrate. The agent runs as a
73
+ local subprocess that speaks newline-delimited JSON-RPC over stdio; ACP's editor
74
+ ↔ agent model is exactly this shape.
75
+
76
+ This adapter is scoped to **local coding**. The child process inherits the
77
+ parent environment, so the agent reuses whatever local CLI login it already has
78
+ (for example `gemini` or `claude` auth in the user's home dir). It is not a
79
+ hosted or sandboxed transport, and it is not a chat/A2A transport — for those,
80
+ see [Agent Surfaces](/docs/agent-surfaces).
81
+
82
+ | Name | Default command | Resumable\* |
83
+ | ----------------- | ---------------------------------------------- | ----------- |
84
+ | `acp` | _(supply `command`/`args` via config)_ | yes |
85
+ | `acp:gemini` | `npx -y @google/gemini-cli --experimental-acp` | yes |
86
+ | `acp:claude-code` | `npx -y @zed-industries/claude-code-acp` | yes |
87
+
88
+ \*Resume works when the agent advertises the `loadSession` capability and
89
+ degrades to a fresh session otherwise.
90
+
91
+ ```ts
92
+ import {
93
+ registerBuiltinAgentHarnesses,
94
+ resolveAgentHarness,
95
+ } from "@agent-native/core/agent/harness";
96
+
97
+ registerBuiltinAgentHarnesses();
98
+
99
+ // A built-in preset (command/args are overridable through the resolve config):
100
+ const adapter = resolveAgentHarness("acp:gemini");
101
+
102
+ // Or any ACP agent by command:
103
+ const custom = resolveAgentHarness("acp", {
104
+ command: "gemini",
105
+ args: ["--experimental-acp"],
106
+ });
107
+ ```
108
+
109
+ The protocol transport (`@zed-industries/agent-client-protocol`) is an optional
110
+ dependency loaded lazily through the `installPackage` hint, just like the AI SDK
111
+ harnesses. The agent binary itself (`@google/gemini-cli`,
112
+ `@zed-industries/claude-code-acp`, …) is a separate external CLI; the presets
113
+ launch it through `npx` and the command/args stay overridable because agent ACP
114
+ entry flags still evolve.
115
+
116
+ `permissionMode` maps onto ACP `session/request_permission` using the tool-call
117
+ kind the agent reports: reads always run, edits run under `allow-edits`, and
118
+ everything risky prompts unless `allow-all`. Approvals surface as the normal
119
+ `approval-request` events. The adapter serves `fs/read_text_file` and
120
+ `fs/write_text_file` against the session workspace (refusing paths that escape
121
+ it) and writes emit `file-change` events; terminal methods are not advertised,
122
+ so the agent uses its own shell.
123
+
65
124
  ## Codex auth: Code UI vs harness sandboxes {#codex-auth}
66
125
 
67
126
  There are two Codex surfaces, and they authenticate differently:
@@ -26,6 +26,33 @@ Every agent-native app is three things working together:
26
26
 
27
27
  Headless apps can run the same production app-agent loop from the folder with `pnpm agent`, while UI apps mount the embedded agent panel and run locally with `pnpm dev`. In the cloud, Builder.io provides a managed frame — the environment that hosts the agent next to your app — with collaboration, visual editing, and managed infrastructure for teams.
28
28
 
29
+ ## Agent building blocks {#agent-building-blocks}
30
+
31
+ Every agent-native app has the same agent building blocks, regardless of whether
32
+ the product surface is headless, chat-first, or a full UI:
33
+
34
+ ```an-file-tree title="Guidance and behavior"
35
+ {
36
+ "entries": [
37
+ { "path": "AGENTS.md", "note": "always-on instructions: purpose, core rules, state keys, action index, skills index" },
38
+ { "path": ".agents/skills/<name>/SKILL.md", "note": "reusable behavior: workflow steps, policies, examples, references, and do/don't lists" },
39
+ { "path": "actions/<name>.ts", "note": "executable capability: typed operation exposed to the agent, UI, CLI, HTTP, MCP, A2A, jobs, and webhooks" }
40
+ ]
41
+ }
42
+ ```
43
+
44
+ | Building block | Use it for | Loaded when |
45
+ | ---------------- | --------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
46
+ | **Instructions** | Stable guidance the agent should carry into every task: what the app is, invariants, tone, indexes | Every turn |
47
+ | **Skills** | Reusable behavior: how to follow a workflow, apply a policy, inspect evidence, or verify an output | On demand when the skill description matches the task |
48
+ | **Actions** | Real operations: read or write data, call APIs, send messages, run approvals, produce typed results | Listed as tools every turn; executed only when called |
49
+
50
+ Skills and actions work together. A skill teaches the agent how to do a class of
51
+ work; an action is the code path it can call while doing that work. For example,
52
+ a `customer-research` skill might tell the agent which sources to inspect and
53
+ how to summarize evidence, while `search-crm` and `create-brief` actions fetch
54
+ and write the actual data.
55
+
29
56
  Six rules govern the architecture:
30
57
 
31
58
  1. **Data lives in SQL** — all app state lives in the database via Drizzle ORM
@@ -114,6 +114,26 @@ defineAction({
114
114
  });
115
115
  ```
116
116
 
117
+ ## Skills vs actions {#skills-vs-actions}
118
+
119
+ Skills and actions are complementary. A skill is guidance the agent reads; an
120
+ action is code the agent can run.
121
+
122
+ | Need | Use |
123
+ | ---------------------------------------------------------------------- | ---------------------------------- |
124
+ | The agent needs to follow a workflow, policy, checklist, or rubric | **Skill** |
125
+ | The agent needs examples, reference material, or domain-specific rules | **Skill** |
126
+ | The agent needs to read or write app data | **Action** |
127
+ | The agent needs to call an external API or perform an approval | **Action** |
128
+ | The agent calls the right operation but in the wrong way | Improve the **skill** |
129
+ | The agent cannot reliably invoke the operation | Improve the **action** |
130
+ | The agent chooses the wrong tool | Improve the **action description** |
131
+
132
+ Most real features use both: the skill explains how to approach the task, and
133
+ the action provides the typed operation. For example, an `invoice-review` skill
134
+ can explain the review policy and escalation rules, while `list-invoices`,
135
+ `flag-invoice`, and `approve-invoice` actions do the actual reads and writes.
136
+
117
137
  ## Bake in anti-fabrication and verify-before-done {#anti-fabrication}
118
138
 
119
139
  App instructions should make honesty and verification the default behavior:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.65.0",
3
+ "version": "0.66.1",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: harness-agents
3
3
  description: >-
4
- Add or use full agent harness runtimes like Claude Code, Codex, Pi, Cursor, or Mastra inside Agent Native.
4
+ Add or use full agent harness runtimes like Claude Code, Codex, Pi, Cursor, Mastra, or ACP agents inside Agent Native.
5
5
  scope: dev
6
6
  ---
7
7
 
@@ -68,6 +68,52 @@ Harness runs are projected into the shared `BackgroundAgentRun` shape with
68
68
  `createAgentHarnessBackgroundAgentController()` and are available through the
69
69
  existing run routes as `goalId=agent-harness`.
70
70
 
71
+ ## ACP Agents
72
+
73
+ Agent Native can act as an [ACP](https://agentclientprotocol.com) (Agent Client
74
+ Protocol) client and drive a local coding agent — Gemini CLI, Claude Code, or
75
+ any ACP-compliant agent — through this same substrate. This is scoped to **local
76
+ coding**: the agent is spawned as a child process speaking newline-delimited
77
+ JSON-RPC over stdio, and inherits the parent environment so it reuses the user's
78
+ local CLI login. It is not a hosted/sandboxed transport, and it is not a
79
+ chat/A2A transport.
80
+
81
+ ```ts
82
+ import {
83
+ registerBuiltinAgentHarnesses,
84
+ resolveAgentHarness,
85
+ } from "@agent-native/core/agent/harness";
86
+
87
+ registerBuiltinAgentHarnesses();
88
+
89
+ // Built-in presets (commands overridable via the resolve config):
90
+ const gemini = resolveAgentHarness("acp:gemini");
91
+ const claude = resolveAgentHarness("acp:claude-code");
92
+
93
+ // Or any ACP agent by command:
94
+ const custom = resolveAgentHarness("acp", {
95
+ command: "gemini",
96
+ args: ["--experimental-acp"],
97
+ });
98
+ ```
99
+
100
+ - The protocol transport (`@zed-industries/agent-client-protocol`) is an optional
101
+ dependency loaded lazily; `installPackage` surfaces a clear install hint.
102
+ - The agent binary (e.g. `@google/gemini-cli`, `@zed-industries/claude-code-acp`)
103
+ is a separate external CLI the user installs; presets launch it through `npx`
104
+ by default and the command/args are overridable because agent ACP entry flags
105
+ still evolve.
106
+ - `permissionMode` maps onto ACP `session/request_permission` using the reported
107
+ tool-call kind: reads always run, edits run under `allow-edits`, everything
108
+ risky prompts unless `allow-all`. Approvals surface as `approval-request`
109
+ events; answer them through the harness session's `approve()`.
110
+ - `resumeState` carries the ACP `sessionId`; resume works when the agent
111
+ advertises the `loadSession` capability and degrades to a fresh session
112
+ otherwise.
113
+ - `fs/read_text_file` and `fs/write_text_file` are served against the session
114
+ workspace and refuse paths that escape it; terminal methods are not advertised
115
+ (the agent uses its own shell).
116
+
71
117
  ## Adapter Guidance
72
118
 
73
119
  - Keep harness packages optional. Use dynamic imports in adapters and expose an