@automatalabs/acp-agents 0.1.0 → 0.1.2

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 (2) hide show
  1. package/README.md +74 -0
  2. package/package.json +7 -2
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # @automatalabs/acp-agents
2
+
3
+ Low-level building block: the [Agent Client Protocol](https://agentclientprotocol.com) (ACP) client plus Claude and Codex backends that implement the `AgentRunner` seam from `@automatalabs/shared-types`. It spawns `claude-agent-acp` / `codex-acp` as child processes, drives one subagent turn to completion over ACP, and returns structured output or text.
4
+
5
+ This is the layer `@automatalabs/workflows` and `@automatalabs/mcp-server` are built on.
6
+
7
+ ## Most users want `@automatalabs/workflows`
8
+
9
+ If you are orchestrating a workflow, use [`@automatalabs/workflows`](../workflows) instead — it re-exports `createAcpRunner` and wires it into the engine for you. Reach for this package directly only when you want to drive a **single** Claude/Codex agent over ACP yourself.
10
+
11
+ ```bash
12
+ npm install @automatalabs/acp-agents
13
+ ```
14
+
15
+ ## Standalone use: drive one agent
16
+
17
+ `createAcpRunner().run(prompt, options)` runs a single agent to completion. Pass a [typebox](https://github.com/sinclairzx81/typebox) `schema` to get a validated object back (typed as `Static<typeof schema>`); omit it to get the final assistant text as a `string`. The backend (Claude vs Codex) is selected from `model` / `tier`. Call `dispose()` when you're done to tear down the pooled child processes.
18
+
19
+ ```ts
20
+ import { createAcpRunner } from "@automatalabs/acp-agents";
21
+ import { Type } from "typebox";
22
+
23
+ const runner = createAcpRunner();
24
+
25
+ try {
26
+ // Structured output: result is typed and validated against the schema.
27
+ const review = await runner.run("Review the diff and summarize risk.", {
28
+ schema: Type.Object({
29
+ risk: Type.Union([Type.Literal("low"), Type.Literal("high")]),
30
+ summary: Type.String(),
31
+ }),
32
+ model: "anthropic/claude-sonnet-4", // routes to the Claude backend
33
+ cwd: "/abs/path/to/worktree", // ACP session/new { cwd } — absolute
34
+ });
35
+ console.log(review.risk, review.summary);
36
+
37
+ // No schema: result is the final assistant text.
38
+ const text = await runner.run("Explain this repo in one paragraph.", {
39
+ model: "openai/gpt-5", // routes to the Codex backend
40
+ cwd: "/abs/path/to/worktree",
41
+ });
42
+ console.log(text);
43
+ } finally {
44
+ await runner.dispose();
45
+ }
46
+ ```
47
+
48
+ `run()` accepts the full `RunOptions` seam: `schema`, `model`, `tier`, `cwd`, `instructions`, `label`, `signal` (cancellation), `toolNames` / `disallowedToolNames`, `mcpServers`, `onUsage`, `onModelResolved`, `onModelFallback`, and `onHistory`. See `@automatalabs/shared-types` for the field-by-field contract.
49
+
50
+ ## Key exports
51
+
52
+ From [`src/index.ts`](./src/index.ts):
53
+
54
+ - **`createAcpRunner(options?)`** — factory returning an `AcpAgentRunner` (this is what `@automatalabs/workflows` injects into the engine).
55
+ - **`AcpAgentRunner`** — the `AgentRunner` implementation; `run(prompt, options)` and `dispose()`.
56
+ - **`selectBackend({ model, tier })`** — the cross-provider routing rule: which backend a spec maps to.
57
+ - **`ClaudeBackend` / `CodexBackend`** — the two backend strategies (spawn config + per-backend schema wiring).
58
+ - **`toJsonSchema(schema)` / `toStrictJsonSchema(schema)`** — turn a typebox schema into the on-the-wire shapes: a plain JSON Schema for Claude `outputFormat`, and an OpenAI-strict-normalized schema for Codex `outputSchema`.
59
+
60
+ Also exported: `AcpAgentPool` / `resolvePoolSize`, `PooledConnection` / `SessionHandle`, `decidePermission`, `UsageAccumulator`, `resolveStructuredOutput` / `extractValidated` / `findJsonBlock` / `validateValue`, and `errorText` / `mapThrownError`, plus their associated types.
61
+
62
+ ## Environment overrides
63
+
64
+ | Variable | Effect |
65
+ | --- | --- |
66
+ | `AGENTPRISM_DEFAULT_BACKEND` | Backend when `model`/`tier` don't pick one (`codex` selects Codex; anything else is Claude). |
67
+ | `AGENTPRISM_ACP_POOL_SIZE` | Long-lived processes to keep per backend (default `1`). |
68
+ | `AGENTPRISM_CLAUDE_ACP_CMD` / `AGENTPRISM_CLAUDE_ACP_ARGS` | Override the command (and args) used to spawn the Claude ACP server. |
69
+ | `AGENTPRISM_CODEX_ACP_CMD` / `AGENTPRISM_CODEX_ACP_ARGS` | Override the command (and args) used to spawn the Codex ACP server. |
70
+ | `AGENTPRISM_CODEX_ACP_BIN` | Override only the resolved Codex ACP bin path (keeps the default node launcher). |
71
+
72
+ ## License
73
+
74
+ Apache-2.0
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@automatalabs/acp-agents",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "license": "Apache-2.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/VikashLoomba/agentprism-workflows.git",
8
+ "directory": "packages/acp-agents"
9
+ },
5
10
  "type": "module",
6
11
  "main": "./dist/index.js",
7
12
  "types": "./dist/index.d.ts",
@@ -23,7 +28,7 @@
23
28
  "@agentclientprotocol/claude-agent-acp": "0.53.0",
24
29
  "@automatalabs/codex-acp": "1.0.2",
25
30
  "typebox": "1.3.2",
26
- "@automatalabs/shared-types": "0.1.0"
31
+ "@automatalabs/shared-types": "0.1.2"
27
32
  },
28
33
  "scripts": {
29
34
  "build": "tsc -b",