@agent-native/core 0.64.1 → 0.66.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 (40) hide show
  1. package/dist/agent/harness/acp-adapter.d.ts +145 -0
  2. package/dist/agent/harness/acp-adapter.d.ts.map +1 -0
  3. package/dist/agent/harness/acp-adapter.js +632 -0
  4. package/dist/agent/harness/acp-adapter.js.map +1 -0
  5. package/dist/agent/harness/acp-builtin.d.ts +25 -0
  6. package/dist/agent/harness/acp-builtin.d.ts.map +1 -0
  7. package/dist/agent/harness/acp-builtin.js +57 -0
  8. package/dist/agent/harness/acp-builtin.js.map +1 -0
  9. package/dist/agent/harness/builtin.d.ts.map +1 -1
  10. package/dist/agent/harness/builtin.js +15 -0
  11. package/dist/agent/harness/builtin.js.map +1 -1
  12. package/dist/agent/harness/index.d.ts +2 -0
  13. package/dist/agent/harness/index.d.ts.map +1 -1
  14. package/dist/agent/harness/index.js +2 -0
  15. package/dist/agent/harness/index.js.map +1 -1
  16. package/dist/embedding/agent.d.ts +32 -0
  17. package/dist/embedding/agent.d.ts.map +1 -0
  18. package/dist/embedding/agent.js +110 -0
  19. package/dist/embedding/agent.js.map +1 -0
  20. package/dist/embedding/bridge.d.ts +37 -0
  21. package/dist/embedding/bridge.d.ts.map +1 -0
  22. package/dist/embedding/bridge.js +148 -0
  23. package/dist/embedding/bridge.js.map +1 -0
  24. package/dist/embedding/index.d.ts +5 -0
  25. package/dist/embedding/index.d.ts.map +1 -0
  26. package/dist/embedding/index.js +5 -0
  27. package/dist/embedding/index.js.map +1 -0
  28. package/dist/embedding/protocol.d.ts +46 -0
  29. package/dist/embedding/protocol.d.ts.map +1 -0
  30. package/dist/embedding/protocol.js +122 -0
  31. package/dist/embedding/protocol.js.map +1 -0
  32. package/dist/embedding/react.d.ts +39 -0
  33. package/dist/embedding/react.d.ts.map +1 -0
  34. package/dist/embedding/react.js +147 -0
  35. package/dist/embedding/react.js.map +1 -0
  36. package/dist/templates/workspace-core/.agents/skills/harness-agents/SKILL.md +47 -1
  37. package/docs/content/agent-surfaces.md +4 -2
  38. package/docs/content/harness-agents.md +59 -0
  39. package/package.json +6 -1
  40. package/src/templates/workspace-core/.agents/skills/harness-agents/SKILL.md +47 -1
@@ -0,0 +1,145 @@
1
+ /**
2
+ * ACP (Agent Client Protocol) harness adapter.
3
+ *
4
+ * Lets Agent-Native act as an ACP *client* and drive a local coding agent —
5
+ * Gemini CLI, Claude Code, or any other ACP-compliant agent — through the
6
+ * existing {@link AgentHarnessAdapter} substrate. The agent runs as a local
7
+ * subprocess that owns its own loop, tools, and workspace filesystem access,
8
+ * which is exactly the shape ACP was designed for. See:
9
+ * https://agentclientprotocol.com
10
+ *
11
+ * Scope: this adapter targets *local* coding. The agent is spawned as a child
12
+ * process and speaks newline-delimited JSON-RPC over stdio. It reuses whatever
13
+ * local CLI login the agent already has (e.g. `gemini`/`claude` auth in the
14
+ * user's home dir) by inheriting the parent environment. It is not a hosted or
15
+ * sandboxed transport, and it is not a chat/A2A transport.
16
+ *
17
+ * The protocol transport and framing are handled by the official
18
+ * `@zed-industries/agent-client-protocol` package, loaded lazily as an optional
19
+ * dependency so apps that never use ACP do not pay for it. Everything in this
20
+ * file beyond the thin spawn/connection glue is pure mapping logic between ACP
21
+ * `session/update` notifications and {@link AgentHarnessEvent}s.
22
+ */
23
+ import type { AgentHarnessAdapter, AgentHarnessEvent, AgentHarnessMessage, AgentHarnessPermissionMode } from "./types.js";
24
+ /**
25
+ * The optional package that carries the ACP protocol transport. Loaded lazily;
26
+ * `resolveAgentHarness` surfaces a clear install error when it is missing.
27
+ */
28
+ export declare const ACP_PACKAGE = "@zed-industries/agent-client-protocol";
29
+ export interface AcpHarnessAdapterOptions {
30
+ /** Adapter id, e.g. "acp:gemini". Defaults to "acp". */
31
+ name?: string;
32
+ /** Human-readable label for pickers. */
33
+ label?: string;
34
+ /** Short description for pickers and diagnostics. */
35
+ description?: string;
36
+ /** Executable to spawn (the ACP agent binary), e.g. "gemini" or "npx". */
37
+ command?: string;
38
+ /** Arguments passed to the agent binary, e.g. ["--experimental-acp"]. */
39
+ args?: string[];
40
+ /**
41
+ * Extra environment variables for the agent process. Merged over the parent
42
+ * environment, which the agent inherits so it can reuse the user's local CLI
43
+ * login.
44
+ */
45
+ env?: Record<string, string>;
46
+ /** Default working directory when a turn does not specify one. */
47
+ cwd?: string;
48
+ /** Hint shown when the optional ACP package is missing. */
49
+ installPackage?: string;
50
+ }
51
+ export declare function createAcpHarnessAdapter(options: AcpHarnessAdapterOptions): AgentHarnessAdapter;
52
+ /** Build the ACP prompt content blocks for a turn. */
53
+ export declare function buildAcpPromptBlocks(input: {
54
+ prompt?: string;
55
+ messages?: AgentHarnessMessage[];
56
+ }): Array<{
57
+ type: "text";
58
+ text: string;
59
+ }>;
60
+ /**
61
+ * Translate a single ACP `session/update` payload into harness events. Pure and
62
+ * stateless; the caller supplies a resolver for tool titles seen on earlier
63
+ * `tool_call` updates so completion events can be labelled.
64
+ */
65
+ export declare function acpUpdateToHarnessEvents(update: AcpSessionUpdate, titleFor?: (toolCallId: string) => string | undefined): AgentHarnessEvent[];
66
+ /** Extract displayable text from an ACP content block. */
67
+ export declare function acpContentBlockToText(block: AcpContentBlock | undefined): string;
68
+ /** Derive file-change events from a tool call's `diff` content blocks. */
69
+ export declare function acpFileChangeEventsFromToolContent(content: AcpToolCallContent[] | undefined | null): AgentHarnessEvent[];
70
+ /**
71
+ * Map an Agent-Native permission mode onto a decision for an ACP permission
72
+ * request, using the tool-call kind the agent reports. Reads always run; edits
73
+ * run under `allow-edits`; everything risky prompts unless `allow-all`.
74
+ */
75
+ export declare function acpAutoPermissionDecision(kind: string | undefined, mode: AgentHarnessPermissionMode): "allow" | "prompt";
76
+ /**
77
+ * Pick the option id to return for an ACP permission request. Prefers the
78
+ * "once" variant so approvals do not silently become "always".
79
+ */
80
+ export declare function selectAcpPermissionOption(options: AcpPermissionOption[], approved: boolean): string | undefined;
81
+ /**
82
+ * Resolve a path requested by the agent against the session workspace, refusing
83
+ * anything that escapes it. The agent already has its own filesystem tools;
84
+ * this `fs/*` surface is a scoped convenience, not an arbitrary read/write hole.
85
+ */
86
+ export declare function resolveAcpWorkspacePath(cwd: string, requestedPath: string): string;
87
+ interface AcpContentBlock {
88
+ type: string;
89
+ text?: string;
90
+ uri?: string;
91
+ name?: string;
92
+ [key: string]: unknown;
93
+ }
94
+ interface AcpToolCallContent {
95
+ type: string;
96
+ content?: AcpContentBlock;
97
+ path?: string;
98
+ oldText?: string | null;
99
+ newText?: string;
100
+ terminalId?: string;
101
+ }
102
+ interface AcpPlanEntry {
103
+ content?: string;
104
+ status?: string;
105
+ priority?: string;
106
+ }
107
+ export type AcpSessionUpdate = {
108
+ sessionUpdate: "agent_message_chunk" | "user_message_chunk" | "agent_thought_chunk";
109
+ content: AcpContentBlock;
110
+ } | {
111
+ sessionUpdate: "tool_call";
112
+ toolCallId: string;
113
+ title: string;
114
+ kind?: string;
115
+ status?: string;
116
+ content?: AcpToolCallContent[];
117
+ rawInput?: Record<string, unknown>;
118
+ rawOutput?: Record<string, unknown>;
119
+ locations?: unknown[];
120
+ } | {
121
+ sessionUpdate: "tool_call_update";
122
+ toolCallId: string;
123
+ title?: string | null;
124
+ kind?: string | null;
125
+ status?: string | null;
126
+ content?: AcpToolCallContent[] | null;
127
+ rawInput?: Record<string, unknown>;
128
+ rawOutput?: Record<string, unknown>;
129
+ } | {
130
+ sessionUpdate: "plan";
131
+ entries: AcpPlanEntry[];
132
+ } | {
133
+ sessionUpdate: "available_commands_update";
134
+ availableCommands: unknown[];
135
+ } | {
136
+ sessionUpdate: "current_mode_update";
137
+ currentModeId: string;
138
+ };
139
+ interface AcpPermissionOption {
140
+ optionId: string;
141
+ name: string;
142
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
143
+ }
144
+ export {};
145
+ //# sourceMappingURL=acp-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acp-adapter.d.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