Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

docs(agent): RPC is on main, and --max-turns exhaustion exits 53

thinhlpg0b65212bc11f
diff --git a/docs/src/pages/docs/agent/protocol.mdx b/docs/src/pages/docs/agent/protocol.mdx
index fbbb90e2d..01e4a7ba4 100644
--- a/docs/src/pages/docs/agent/protocol.mdx
+++ b/docs/src/pages/docs/agent/protocol.mdx
@@ -25,10 +25,10 @@ CLI run, start with the [Agent quickstart](/docs/agent/quickstart); for an embed
definitions. Read its `protocol_version`, `envelope`, `requests`, `notifications` and `events`
sections to navigate the artifact rather than copying field declarations from this page. Print
it with `jan cli agent rpc-schema`, or write it with
- `jan cli agent rpc-schema --out protocol/rpc-schema.json`. The transport merged in
- [PR #9049](https://github.com/janhq/jan/pull/9049) and is not in a release yet. See the
- [CLI `rpc` section](/docs/agent/cli#rpc) for the transport and [RPC host tools](#rpc-host-tools)
- below for host callbacks.
+ `jan cli agent rpc-schema --out protocol/rpc-schema.json`. The implementation and artifact were
+ merged in [PR #9049](https://github.com/janhq/jan/pull/9049) and are on `main`, not yet in a
+ nightly or release. See the [CLI `rpc` section](/docs/agent/cli#rpc) for the transport and
+ [RPC host tools](#rpc-host-tools) below for host callbacks.
Both artifacts are generated and checked for drift against their Rust source by the `protocol
schema` job in `.github/workflows/rust-check.yml`, which regenerates both and fails the job on a
@@ -46,9 +46,9 @@ publishing or deploying a client.
| | `stream-json` | RPC | ACP |
| --- | --- | --- | --- |
-| **Release state** | **Shipped** in `main` | **Merged** in `main`, not released | **Planned**, no implementation |
+| **Release state** | **Shipped** in `main` | **On `main`**, not yet in a nightly or release | **Planned**, no implementation |
| **Record reference** | Generated `protocol/schema.json` | Generated `protocol/rpc-schema.json` | No ACP record artifact or implemented surface |
-| **Evidence** | `src-tauri/src/core/cli/protocol_schema.rs:73-84,103-124`; `.github/workflows/rust-check.yml:130-176`; [PR #9023](https://github.com/janhq/jan/pull/9023) merged | `src-tauri/src/core/cli/rpc.rs:258-297`; `src-tauri/src/core/cli/rpc_schema.rs:87-106`; [PR #9049](https://github.com/janhq/jan/pull/9049) merged, [#360](https://github.com/janhq/jan-internal/issues/360) open | [#347](https://github.com/janhq/jan-internal/issues/347) open; no ACP subcommand in `src-tauri/jan-cli/src/main.rs:443-521` |
+| **Evidence** | `src-tauri/src/core/cli/protocol_schema.rs:73-84,103-124`; the `protocol schema` job in `.github/workflows/rust-check.yml`; [PR #9023](https://github.com/janhq/jan/pull/9023) merged | `src-tauri/src/core/cli/rpc.rs:258-297`; `src-tauri/src/core/cli/rpc_schema.rs:87-106`; [PR #9049](https://github.com/janhq/jan/pull/9049) merged, [#360](https://github.com/janhq/jan-internal/issues/360) open | [#347](https://github.com/janhq/jan-internal/issues/347) open; no ACP subcommand in `src-tauri/jan-cli/src/main.rs:443-521` |
A schema says which records a transport accepts or emits. A surface inventory would say what
that surface *can* do, but the table above is an evidence-backed release snapshot, not a generated
@@ -59,9 +59,10 @@ what **this RPC session** negotiated (`src-tauri/src/core/cli/rpc.rs:286-297`).
`stream-json`'s `init` fields into RPC or treat a negotiated response as universal availability.
<Callout type="warning">
-RPC is not in a shipped CLI or SDK release yet. ACP remains planned. JavaScript and Python SDK
-packages are not released ([#367](https://github.com/janhq/jan-internal/issues/367)). Host tools
-exist on both `stream-json` (`--host-tools`) and RPC (below).
+RPC is on `main` but not yet in a nightly or release. ACP remains planned. JavaScript and Python
+SDK packages are not released ([#367](https://github.com/janhq/jan-internal/issues/367)). Host tools
+exist on both `stream-json` (`--host-tools`) and RPC (below). See
+[what your build supports](/docs/agent/sdk#what-your-build-supports).
</Callout>
## RPC host tools
diff --git a/docs/src/pages/docs/agent/sdk-runtime.mdx b/docs/src/pages/docs/agent/sdk-runtime.mdx
index d94f55c6a..d136bfe1b 100644
--- a/docs/src/pages/docs/agent/sdk-runtime.mdx
+++ b/docs/src/pages/docs/agent/sdk-runtime.mdx
@@ -87,6 +87,7 @@ tool and refuses everything else.
| `0` | The run finished: a normal stop, `aborted`, or `budget_exceeded` |
| `1` | The run failed. The `result` has `is_error: true` and an `error` object |
| `2` | The command line was rejected - an unknown flag, for example. Nothing is printed on stdout |
+| `53` | `--max-turns` ran out while the model was still calling tools. The `result` has `is_error: true`; there is no final answer |
## Failures and retries
@@ -102,6 +103,7 @@ before retrying; never re-run a host side effect blindly.
| No model configured, or a bad `--host-tools` file | `result` alone, no `init`, `error.code: "setup_error"`, exit `1` | Safe once fixed - nothing ran |
| Provider refused or failed | An `error` record, then `result` with `error.code: "upstream_error"`, exit `1` | Only if the stream showed no tool calls |
| Conversation too long for the model | `error.code: "context_overflow"`, exit `1` | Only if the stream showed no tool calls; shorten the task or start a new session |
+| Turn cap reached | `error.message: "reached the N-turn limit while the model was still calling tools"`, exit `53` | Not as is: the tool calls it made already ran. Raise `--max-turns` or narrow the task |
| Any other failure | `error.code` is the raw code, exit `1` | Check the stream first |
| Your tool failed | Your `tool_result` with `is_error: true` - the model sees it and goes on | Not needed |
| A line on stdin was invalid | An `input_error` record; the line is skipped and the run goes on | Fix the client |
diff --git a/docs/src/pages/docs/agent/sdk.mdx b/docs/src/pages/docs/agent/sdk.mdx
index a20256c5e..140d850fe 100644
--- a/docs/src/pages/docs/agent/sdk.mdx
+++ b/docs/src/pages/docs/agent/sdk.mdx
@@ -38,7 +38,8 @@ drive the `jan` binary with nothing but Node.js or Python and their standard lib
| Run a first embedded task from Python | [Python quickstart](/docs/agent/sdk-python) |
| Let the model call a function in your code | [Host tools](/docs/agent/sdk-tools) |
| Own the process: permissions, stopping, failures, exit codes | [Process & failures](/docs/agent/sdk-runtime) |
-| Look up a record's fields, or validate against the generated schema | [CLI reference: streaming JSON](/docs/agent/cli#streaming-json-in-both-directions) |
+| Run several sessions in one long-lived process | [CLI reference: `rpc`](/docs/agent/cli#rpc) |
+| Look up a record's fields, or validate against the generated schemas | [Protocol records](/docs/agent/protocol) |
| Use Jan interactively instead | [Quickstart](/docs/agent/quickstart) |
Every code block these pages attribute to a file is an excerpt of a runnable example in
@@ -74,9 +75,8 @@ Check the build you run rather than trusting a page: the `init` record says what
| Follow-ups, permission answers, `abort` | `init.input_kinds` lists `user`, `permission` and `abort` | Yes |
| [Host tools](/docs/agent/sdk-tools) | `jan cli agent run --help` lists `--host-tools`; `init.input_kinds` lists `tool_result` | No - on `main`, arriving with the next nightly |
| The generated JSON Schema | `jan cli agent schema` exists | No - on `main`, arriving with the next nightly |
+| Several sessions in one process over JSON-RPC | `jan cli agent --help` lists `rpc` | No - on `main`, arriving with the next nightly. It has no host tools yet |
| Images in a `user` message | `init.input_content_parts` is not `null` | No. Builds from `main` accept and validate them but **do not forward them to the model yet**: only the text parts reach the provider |
Not in any build yet: images in a host tool result, host tools called from subagents, and the
-JavaScript and Python SDK packages. Addressable sessions over JSON-RPC (`jan cli agent rpc`) are in
-review in [janhq/jan#9049](https://github.com/janhq/jan/pull/9049), not released. Run `jan update`
-to move to the newest nightly.
+JavaScript and Python SDK packages. Run `jan update` to move to the newest nightly.