(assemble-prompt-text messages)Flatten messages into "role: content" lines — the FULL request, every
turn (an ACP session is stateful, so sending only the delta would make this
client a second, shadow copy of conversation state) — and append the
supersedes marker naming the latest message's text, so a stateful agent
answers the CURRENT request rather than an earlier near-duplicate already
sitting in its own session history (ADR 0031).
Flatten `messages` into "role: content" lines — the FULL request, every turn (an ACP session is stateful, so sending only the delta would make this client a second, shadow copy of conversation state) — and append the supersedes marker naming the latest message's text, so a stateful agent answers the CURRENT request rather than an earlier near-duplicate already sitting in its own session history (ADR 0031).
(close client)Terminate the child process. Idempotent — calling it more than once past the first call is a no-op (guarded by a compare-and-set! "close once" flag, the portable equivalent of Go's sync.Once).
Terminate the child process. Idempotent — calling it more than once past the first call is a no-op (guarded by a compare-and-set! "close once" flag, the portable equivalent of Go's sync.Once).
(connect command)(connect command opts)Spawn command (a vector, e.g. ["devin" "acp"]) and complete
initialize -> session/new (-> optional session/set_mode). Returns a
live, warm client map. Throws (ex-info) on any handshake failure — a model
source that cannot connect is a construction-time error, matching
toolnexus.agents.runtime/create-runtime's own validation.
opts:
:cwd absolute working directory handed to session/new.
A real devin acp REJECTS session/new with -32602
without an absolute cwd (ADR 0031) — defaults to
the process's own resolved cwd (koine.fs/real-path
on "."), which is always absolute.
:mcp-servers the mcpServers array on session/new (default
[]). Real devin acp requires the key to be
present, even empty.
:environment / :env extra env vars for the child (merged; matches
toolnexus.mcp's environment/env alias).
:mode if set, issues an optional session/set_mode after
session/new.
:timeout per-call timeout ms for the setup handshake.
Default 30000.
:permission-timeout the safety net bounding a session/prompt reply
— see default-permission-timeout-ms. Default 30000.
Spawn `command` (a vector, e.g. ["devin" "acp"]) and complete
`initialize` -> `session/new` (-> optional `session/set_mode`). Returns a
live, warm client map. Throws (ex-info) on any handshake failure — a model
source that cannot connect is a construction-time error, matching
`toolnexus.agents.runtime/create-runtime`'s own validation.
opts:
:cwd absolute working directory handed to `session/new`.
A real `devin acp` REJECTS session/new with -32602
without an absolute cwd (ADR 0031) — defaults to
the process's own resolved cwd (`koine.fs/real-path`
on "."), which is always absolute.
:mcp-servers the `mcpServers` array on `session/new` (default
[]). Real `devin acp` requires the key to be
present, even empty.
:environment / :env extra env vars for the child (merged; matches
toolnexus.mcp's `environment`/`env` alias).
:mode if set, issues an optional `session/set_mode` after
`session/new`.
:timeout per-call timeout ms for the setup handshake.
Default 30000.
:permission-timeout the safety net bounding a `session/prompt` reply
— see default-permission-timeout-ms. Default 30000.(generate client)Build a semantic generate fn — (fn [req] -> {:content ...}) — backed by
this warm ACP client, in the exact shape
toolnexus.client/create-in-process-client and
toolnexus.agents.runtime/create-runtime's :in-process option accept.
(let [c (toolnexus.acp/connect ["devin" "acp"])] (toolnexus.client/create-in-process-client {:model "devin" :generate (toolnexus.acp/generate c)}))
Throws on an ACP-level failure (a closed session, a timed-out call, an RPC
error) — the same failure shape any other generate fn raising surfaces to
the caller.
Build a semantic `generate` fn — (fn [req] -> {:content ...}) — backed by
this warm ACP client, in the exact shape
`toolnexus.client/create-in-process-client` and
`toolnexus.agents.runtime/create-runtime`'s `:in-process` option accept.
(let [c (toolnexus.acp/connect ["devin" "acp"])]
(toolnexus.client/create-in-process-client
{:model "devin" :generate (toolnexus.acp/generate c)}))
Throws on an ACP-level failure (a closed session, a timed-out call, an RPC
error) — the same failure shape any other `generate` fn raising surfaces to
the caller.(prompt client text)Send one turn's FULL prompt text and wait for the accumulated agent_message_chunk reply. Turns on the same client are serialised — {:ok content} or {:error reason}.
Send one turn's FULL prompt text and wait for the accumulated
agent_message_chunk reply. Turns on the same client are serialised —
{:ok content} or {:error reason}.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |