An open-source, faster Devin alternative
TypeScript
docs: the unconfirmed-publication retry, settled tool calls with settledBy, and what a stopped command promises
Igor Zalutskibed59791896a
diff --git a/docs/agents/api.mdx b/docs/agents/api.mdxindex 2e7670c2..efddebc3 100644--- a/docs/agents/api.mdx+++ b/docs/agents/api.mdx@@ -95,6 +95,12 @@ identifies the session within your organization:new key.- `503 memory_admission_unconfirmed` means the memory grants were notconfirmed in time. Retry with the same key; the retry resumes the wait.+- `503 session_publication_unconfirmed` means the session exists but its+ row in the list was not confirmed in time; `error.sessionId` names it.+ Retry with the same key and the same body until the answer is `201` or+ `200`. A success means [`GET /sessions`](#get-and-list) reflects the+ session; the platform keeps publishing the row in the background either+ way.Other codes: `400 invalid_environment`, `400 invalid_memory_binding`,`400 invalid_labels`, `404 deployment_not_found`, `409 deployment_not_promoted`@@ -178,6 +184,13 @@ The session's `labelsUpdatedAt` records the change. A patch that would exceedthe bounds, or a key or value that does not fit them, is `400 invalid_labels`and changes nothing. Labels can be changed on an ended session.+A `200` means the list reflects the change: the session's row carries the+new labels and the filters see them. `503 session_publication_unconfirmed`+(with `error.sessionId`) means the labels are recorded on the session but+the row was not confirmed in time; retry the same patch until it answers+`200`. The platform keeps publishing the row in the background either way,+and repeating the patch is safe because each key takes the last write.+### End and interrupt`POST /sessions/<id>/end` ends the session. Queued and running turns arediff --git a/docs/agents/events.mdx b/docs/agents/events.mdxindex 6403cfa2..d5675515 100644--- a/docs/agents/events.mdx+++ b/docs/agents/events.mdx@@ -102,7 +102,7 @@ no rule recognizes is `agent_failed`.| `tool.started` | The model called a tool | `tool`: its name; `callId`; `title`; `input`: the arguments as a JSON value || `tool.progress` | The tool reported progress | runtime-defined || `tool.completed` | The tool returned | `tool`, `callId`, `title`, `output`: what the tool returned as a JSON value; `result: true` when the output became the session's result |-| `tool.failed` | The tool raised an error | `tool`, `callId`, `message` |+| `tool.failed` | The tool raised an error, or its turn ended before it completed | `tool`, `callId`, `title`, `message`; `settledBy` when the turn's end settled the call: `turn.completed`, `turn.failed` or `turn.cancelled` |The exact fields come from the runtime's tool record; read them as optionaland key a tool call on `callId` when it is present. The memory tools@@ -118,11 +118,14 @@ same JSON value `GET /sessions/<id>` returns as `result.data`. The sessionwrites this event when it commits the result, before the model sees the callsucceed, and there is one per call.-A terminal turn event, `turn.completed`, `turn.failed` or `turn.cancelled`,-settles every tool call of the turn that has no completion of its own. The-log records a `tool.completed` or `tool.failed` per call while the runtime is-connected; a call without one ended with its turn, and the turn's outcome is-the call's outcome.+Every tool call ends in the log. The runtime reports a `tool.completed` or+`tool.failed` per call; when a turn ends with a call still open, whether+the turn completed, failed or was cancelled, the session records a+`tool.failed` for that call ahead of the terminal turn event, in the same+write, with `settledBy` naming the terminal event (`turn.completed`,+`turn.failed` or `turn.cancelled`) and a `message` saying the turn ended+first. A consumer therefore never sees a settled turn with a running call;+one that keys rows on `callId` needs no rule of its own for the turn's end.### Memorydiff --git a/docs/agents/react.mdx b/docs/agents/react.mdxindex d7d8cea0..80ebafc4 100644--- a/docs/agents/react.mdx+++ b/docs/agents/react.mdx@@ -221,11 +221,13 @@ Each turn is:| `failure` | `{ code, message }` from `turn.failed` |Tool calls are keyed on the runtime's `callId`, so a `tool.completed` updates-the entry its `tool.started` created rather than adding one. When a turn ends,-every call still `running` is settled with the turn: `completed` when the turn-completed, `failed` when it failed, `cancelled` when it was interrupted. A-settled turn therefore never shows a running call. An activity timeline-renders `turns` directly:+the entry its `tool.started` created rather than adding one. A call its turn+ended before it completed is `failed`: the log records a `tool.failed` for it+with `settledBy` naming the turn's end ([Session events](/agents/events#tools)).+Should a log carry no such record, the hook settles every call still+`running` when the turn ends: `completed` when the turn completed, `failed`+when it failed, `cancelled` when it was interrupted. A settled turn therefore+never shows a running call. An activity timeline renders `turns` directly:```tsx{turns.map((turn) => (diff --git a/docs/agents/tools.mdx b/docs/agents/tools.mdxindex 643ac75a..51fbb8ab 100644--- a/docs/agents/tools.mdx+++ b/docs/agents/tools.mdx@@ -335,6 +335,18 @@ stopped, and the call fails as a tool error the model sees: it names thecommand and the timeout and carries the output so far. The turn continues,and files the command wrote before it was stopped remain.+A command counts as stopped only once that is confirmed: every process it+started, detached ones included, is gone, or the computer itself was+replaced. When the computer stops answering while a command runs, its+outcome is unknown, and the call fails with that as the reason; the model+is never told a command was stopped when that was not confirmed. That+computer runs no further command until the unknown one is confirmed+stopped or the computer is replaced by a fresh one with the session's+workspace, which the next command does on its own. The same rule settles+an [interrupt](/agents/api#end-and-interrupt): the turn is cancelled only+after its commands are confirmed stopped, and a stop that cannot be+confirmed replaces the computer.+## Tools versus skills and MCP- A tool executes TypeScript you own.