mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-12-04 23:22:01 +00:00
Compare commits
16 Commits
v0.115.0
...
air/compac
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ddb74ebf5 | ||
|
|
a94e4edd0d | ||
|
|
95ef066fae | ||
|
|
f9b2ce422f | ||
|
|
131110a84e | ||
|
|
84a148f7fd | ||
|
|
8c473cc4d0 | ||
|
|
eeb6f9cc97 | ||
|
|
99d906d6bb | ||
|
|
6f5e8665fe | ||
|
|
44360be253 | ||
|
|
5423b66bc8 | ||
|
|
0cf44c4ceb | ||
|
|
b1f55b7f9d | ||
|
|
2eda6a9d9c | ||
|
|
48461736de |
@@ -5,7 +5,7 @@ An ACP v1 or v2 client can poll `_session/read` while a terminal continues a Cla
|
||||
Check `_meta.sessionRead.supported` in the initialize response. On v1 declare `clientCapabilities.session.cursors: {}` to receive read cursors. V2 supports them automatically.
|
||||
|
||||
1. Send `{"sessionId":"…","replayFrom":{"type":"start"}}`. Collect the replay and its root `cursor_update` with `capabilities.read`. On success, save the response's `cursorId` alongside the transcript. A session with no anchor returns `{}`. Poll it from the start until a cursor is available.
|
||||
2. Send `{"sessionId":"…","replayFrom":{"type":"cursor","cursorId":"…"}}`. Append the updates and save the returned ID only after success. The cursor survives a reader restart with the same protocol, client capabilities, working directory and adapter version. An unchanged session returns the same ID. V2 sends the root `replay_complete` followed by a `session_info_update` with the current title. Apply the title even if the cursor stays the same. A null title clears the previous one. On v1, a change to an already replayed title invalidates the cursor.
|
||||
2. Send `{"sessionId":"…","replayFrom":{"type":"cursor","cursorId":"…"}}`. Append the updates and save the returned ID only after success. The cursor survives a reader restart with the same protocol, client capabilities, working directory and adapter version. An unchanged session returns the same ID. V2 sends the root `replay_complete` followed by a `session_info_update` with the current title. Apply the title even if the cursor stays the same. A null title clears the previous one. In a default read on v1, a change to an already replayed title invalidates the cursor; a [status read](#status-read) sends the title as v2 does.
|
||||
3. If the read fails with `-32602` and `data.reason: "invalid_cursor"`, read from the start and replace the saved transcript on success. A rewind, compaction, or change to an already rendered tool call or subagent state can invalidate the prefix. On cancellation or a retryable read error, discard the staged updates and keep the last successful cursor.
|
||||
|
||||
Omitting `replayFrom` or setting it to `null` requests a full replay and returns `{}`. A v1 client without cursor support gets the same result from `start`. The optional absolute `cwd` overrides the working directory recorded in the root transcript for replay.
|
||||
@@ -19,3 +19,107 @@ A reader with a cached cursor for a root transcript checks the root file identit
|
||||
The title is the custom title from the transcript tail or `custom-title.json`, as in Claude’s session index. Otherwise it is the last `custom-title` record, or else the last `ai-title` record, of the whole captured transcript. The index reads only the first and last 64 KB of the file, so a large tool result would otherwise hide an unchanged title. The quiet check assumes the local filesystem updates file identity or timestamps on rewrites. The cursor describes the rendered transcript. For current session activity, AIR clients can use the [session index](air-extensions.md#session-index). For clients also talking to older adapters, a successful cursor request that returns `{}` means a full replay. Replace the saved view and clear the cursor.
|
||||
|
||||
A client switching from a live load to polling closes the session on its own connection and starts a fresh read.
|
||||
|
||||
## Read subagents lazily
|
||||
|
||||
By default each read renders the root and the whole transcript of every subagent. A client with native subagent sessions can read the root with only the status of each subagent, and read the stream of one subagent when it needs it. The initialize response then has `_meta.sessionRead.subagents: {}` for the child read and `_meta.sessionRead.filters.subagents: {}` for the status read. V1 clients get them with the RFD form (`clientCapabilities.subagents`) or AIR's native subagent sessions. V2 clients always get them.
|
||||
|
||||
### Filters
|
||||
|
||||
The optional `filters` object of a read says what the read sends. Its only key is `subagents`: `"full"`, the default, or `"status"`. A read without `filters`, or with `filters.subagents: "full"`, is the default read and shares its cursor. The keys that an adapter supports are the keys of `_meta.sessionRead.filters` in its initialize response. A read with another key, or with another value of `subagents`, returns `-32602` with `data.reason: "unsupported_filter"` and the refused keys in `data.filters`, so that a client never gets more than it asked for. A cursor belongs to the filters of the read that returned it: a read with other filters refuses it as `invalid_cursor`.
|
||||
|
||||
### Status read
|
||||
|
||||
Send `filters.subagents: "status"` with a root read:
|
||||
|
||||
```json
|
||||
{ "sessionId": "…", "replayFrom": { "type": "start" }, "filters": { "subagents": "status" } }
|
||||
```
|
||||
|
||||
The read renders the root history as a default read does, with the announcement of each child on its parent's stream: `subagent_spawned` for AIR clients on v1, `subagent_update` with `running` on the RFD form and on v2. It sends none of the end states that a default read sends after the history (`subagent_state_update` on v1 AIR, `subagent_update` with an end otherwise). The status update below holds the current state of each child. A child's stream gets at most the prompt of its launch, the lifecycle updates of its own children and, on v2, its `replay_complete`. No message or tool call of a child's own history is sent.
|
||||
|
||||
The read parses no child transcript. Of each child it reads the metadata file and the end of the transcript: the last 64 KB, or twice as many bytes each time while they do not hold a whole record with the model and the end of the last turn, up to 4 MB. A child whose metadata names a working directory, such as a worktree child, also has its transcript read up to the first line with a `cwd`. The transcript of a child that launched children is searched as bytes for the lines that name those launches, and only those lines are parsed. The adapter keeps the places of those lines for each file, so a later read searches only the bytes appended since. A rewritten or replaced file is searched again from the start. A v1 connection without native subagent sessions ignores `filters.subagents` and sends a default read.
|
||||
|
||||
After the replay and its cursor update, and before the title, each status read sends one update with the current status of every announced child. It is outside the cursor: it comes on every poll, also when the cursor stays the same, and replaces the previous one. The title follows it outside the cursor on v1 too, as on v2 in step 2 above: a null title clears the previous one.
|
||||
|
||||
On v2 the update is the custom variant `_subagent_status`, with the entries in `subagents`:
|
||||
|
||||
```json
|
||||
{
|
||||
"sessionId": "<root>",
|
||||
"update": {
|
||||
"sessionUpdate": "_subagent_status",
|
||||
"subagents": [
|
||||
{ "sessionId": "a1b2c3d4e5f6a7b8c", "state": { "state": "running" }, "size": 48211 }
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
V1 has no custom update variants, so on v1 the update is a `session_info_update` with the same entries in `_meta.sessionRead.subagents`:
|
||||
|
||||
```json
|
||||
{
|
||||
"sessionId": "<root>",
|
||||
"update": {
|
||||
"sessionUpdate": "session_info_update",
|
||||
"_meta": {
|
||||
"sessionRead": {
|
||||
"subagents": [
|
||||
{
|
||||
"sessionId": "a1b2c3d4e5f6a7b8c",
|
||||
"state": { "state": "running" },
|
||||
"background": true,
|
||||
"agentType": "general-purpose",
|
||||
"model": "claude-haiku-5",
|
||||
"updatedAt": "2026-12-01T10:15:02.120Z",
|
||||
"size": 48211
|
||||
},
|
||||
{
|
||||
"sessionId": "c3d4e5f6a7b8c9d0e",
|
||||
"parentSessionId": "a1b2c3d4e5f6a7b8c",
|
||||
"state": { "state": "idle", "stopReason": "end_turn" },
|
||||
"agentType": "Explore",
|
||||
"size": 9120
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `sessionId` is the child session id of the lifecycle updates: the agent id, or `<root>:replay-subagent:<launch id>` for AIR clients on v1. `parentSessionId` is absent for a child of the root.
|
||||
- `state` uses the vocabulary of the lifecycle updates. On v1 AIR clients it is a string: `running`, `idle`, `completed`, `failed`, `cancelled` or `disconnected`. Otherwise it is a `subagent_update` state: `{"state":"running"}`, `{"state":"idle"}`, or `{"state":"idle","stopReason":"end_turn" | "cancelled" | "error"}`. The end comes from the last task notification of the child, then from a stop by the user, then from the result of a foreground launch. A background launch's result is no end. A launch whose parent cannot be restored, or a launch with neither a metadata file nor an end, is `disconnected` on v1 AIR clients. Without an end, a child is `idle` when the last user or assistant record of its transcript ends the turn, else `running`. An answer ends the turn with any stop reason except `tool_use` and `pause_turn`, such as `end_turn`, `max_tokens` or `refusal`. So do a record that no model wrote (model `<synthetic>`, such as an API error) and the successful result of a `SubagentHandback` call. `model` is the model of the last record that a model wrote. On the RFD form and v2 a full read reports such a child `idle` too. Past 4 MB without a whole record, a child is `running` with no `model` or `updatedAt`.
|
||||
- `background`, `agentType` and `cwd` come from the metadata file. `model`, `updatedAt` (the `timestamp` of the last record) and `size` (bytes) come from the transcript. A child without a transcript yet has no `size`.
|
||||
|
||||
A child that continues after its end, such as one resumed by `SendMessage`, keeps its end in `state`, and its `size` and `updatedAt` grow. Compare `size` with the previous status to see new work. Because the cursor covers no end state and no title, a child that ends, a stop by the user and a title change keep the cursor valid. The next cursor read returns only new records and the current status. A cached status cursor also covers sessions with Agent and Task calls: it checks the metadata of every child and the file version of each child transcript. A child transcript that is not a regular file, such as a symbolic link, gives no cached cursor.
|
||||
|
||||
Limits:
|
||||
|
||||
- A permission or input request of a child is not in any file, so the status cannot show that a child waits for the user.
|
||||
- `running` cannot tell a child whose writer process died from one that still works.
|
||||
- A status read places a nested child under the parent that its metadata file names in `parentAgentId`. Older Claude Code versions do not write that field, so a status read does not announce a nested child with such metadata, while a default read can show it.
|
||||
- A status read finds a nested launch anywhere in its parent's transcript. A default read shows only the launches in the parent's active history, which starts after its last compaction. So a nested launch before that compaction is announced only by a status read, and its child read returns nothing.
|
||||
- A status read sees a nested launch only through its metadata file. A launch without one, such as a launch that the permission classifier denied, is not announced to v1 AIR clients, which get it in a default read. The RFD form and v2 do not count it in the missing-history notice.
|
||||
- The status read does not replay a child's `SubagentHandback` report on the parent stream. A foreground child's reply to its parent comes from its launch result.
|
||||
|
||||
### Child read
|
||||
|
||||
Send the root session and one child session id that the client got:
|
||||
|
||||
```json
|
||||
{
|
||||
"sessionId": "<root>",
|
||||
"subagentSessionId": "a1b2c3d4e5f6a7b8c",
|
||||
"replayFrom": { "type": "start" }
|
||||
}
|
||||
```
|
||||
|
||||
The response and the updates are those of a root read, restricted to the child's stream: every update has the child's session id, including the `cursor_update` and, on v2, the `replay_complete`. They are the updates of that stream in a default read. A child read sends no title. The child id can be the agent id, the agent id with a `:generation:<n>` suffix of a live child, or AIR's `<root>:replay-subagent:<launch id>`. All ids of one child share its stream and cursor.
|
||||
|
||||
The cursor belongs to that child: its scope includes the stream, so a root cursor, or another child's, returns `invalid_cursor`. A rewritten child transcript, such as after a compaction, invalidates it too. The read renders only the transcripts of the child and its ancestors, and of the children it launched. A child that sends or gets a `SendMessage` renders every transcript, because the messages link both streams. A cached child cursor checks the child's transcript, the subagent metadata and the root's rewind file. It skips the render when they are unchanged, unless the child used a tool other than Bash, PowerShell, Read, Write, Edit, Glob, Grep or SubagentHandback.
|
||||
|
||||
A child that was just launched and has no transcript yet has no records on its stream: its read returns no cursor until the first record is written. Poll it from the start until then. Cached cursors of child reads and of root reads share one limit of 32 per connection; the oldest is dropped first, and its next read renders again.
|
||||
|
||||
An unknown child returns `-32002` with `data.reason: "subagent_not_found"`. Read the root again for the current children. A child read on a v1 connection without native subagent sessions returns `-32602` with `data.reason: "subagent_read_unsupported"`. A child read with `filters.subagents: "status"` returns `-32602` with `data.reason: "subagent_read_with_status"`.
|
||||
|
||||
@@ -19,6 +19,7 @@ const TAIL_CHUNK_BYTES = 64 * 1024;
|
||||
type ResumeLogger = {
|
||||
log: (...args: unknown[]) => void;
|
||||
error: (...args: unknown[]) => void;
|
||||
warn?: (...args: unknown[]) => void;
|
||||
};
|
||||
|
||||
export type ResumedSessionSnapshot = {
|
||||
@@ -110,9 +111,15 @@ export async function readHistoryAcrossCompactions(
|
||||
): Promise<SessionMessage[]> {
|
||||
if (!isCompactSummaryMessage(messages[0])) return messages;
|
||||
try {
|
||||
const entries = (snapshot ?? (await loadFullSessionHistory(sessionId, dir))).map(
|
||||
linkCompactBoundary,
|
||||
const records = snapshot ?? (await loadFullSessionHistory(sessionId, dir));
|
||||
const known = new Set(
|
||||
records.flatMap((entry) => (typeof entry.uuid === "string" ? [entry.uuid] : [])),
|
||||
);
|
||||
const warn = (message: string) => {
|
||||
const target = logger ?? console;
|
||||
(target.warn ?? target.error).call(target, message);
|
||||
};
|
||||
const entries = records.map((entry) => linkCompactBoundary(entry, known, sessionId, warn));
|
||||
const read = (records: SessionStoreEntry[]) =>
|
||||
getSessionMessages(sessionId, {
|
||||
dir,
|
||||
@@ -161,8 +168,27 @@ export async function loadFullSessionHistory(
|
||||
return entries;
|
||||
}
|
||||
|
||||
/** The record unchanged, or a compaction boundary linked to the message before it. */
|
||||
function linkCompactBoundary(entry: SessionStoreEntry): SessionStoreEntry {
|
||||
/** The `${sessionId}/${boundaryUuid}` keys of the cut boundaries that a warning reported. */
|
||||
const reportedCuts = new Set<string>();
|
||||
|
||||
/**
|
||||
* The record unchanged, or a compaction boundary linked to the message before it.
|
||||
*
|
||||
* The boundary names that message in `logicalParentUuid`. Claude Code can
|
||||
* write a boundary whose `logicalParentUuid` names a record that is not in the
|
||||
* transcript. The link then goes to the last preserved message of the
|
||||
* compaction when the transcript has it (see {@link logicalParentOf}): it is
|
||||
* the last message before the boundary. Without it, the link goes to the
|
||||
* missing record and the history starts at the boundary. `warn` then reports
|
||||
* the cut, once per boundary in this process: each status poll reads the same
|
||||
* boundary again.
|
||||
*/
|
||||
function linkCompactBoundary(
|
||||
entry: SessionStoreEntry,
|
||||
known: ReadonlySet<string>,
|
||||
sessionId: string,
|
||||
warn: (message: string) => void,
|
||||
): SessionStoreEntry {
|
||||
if (
|
||||
entry.type !== "system" ||
|
||||
entry.subtype !== "compact_boundary" ||
|
||||
@@ -174,9 +200,45 @@ function linkCompactBoundary(entry: SessionStoreEntry): SessionStoreEntry {
|
||||
typeof entry.compactMetadata === "object" && entry.compactMetadata !== null
|
||||
? { ...entry.compactMetadata }
|
||||
: {};
|
||||
const parentUuid = logicalParentOf(entry, (uuid) => known.has(uuid))!;
|
||||
const key = `${sessionId}/${String(entry.uuid)}`;
|
||||
if (!known.has(parentUuid) && !reportedCuts.has(key)) {
|
||||
reportedCuts.add(key);
|
||||
warn(
|
||||
`The compaction boundary ${String(entry.uuid)} of session ${sessionId} links to message ${entry.logicalParentUuid}, which is not in the transcript: the history starts at this boundary`,
|
||||
);
|
||||
}
|
||||
delete compactMetadata.preservedSegment;
|
||||
delete compactMetadata.preservedMessages;
|
||||
return { ...entry, parentUuid: entry.logicalParentUuid, compactMetadata };
|
||||
return { ...entry, parentUuid, compactMetadata };
|
||||
}
|
||||
|
||||
/**
|
||||
* The message before a record that has no `parentUuid`, such as a compaction
|
||||
* boundary. This is `logicalParentUuid` when `has` finds it. Else it is the
|
||||
* first that `has` finds of `compactMetadata.preservedSegment.tailUuid` and
|
||||
* the last uuid of `compactMetadata.preservedMessages.uuids`. Else it is
|
||||
* `logicalParentUuid` as it is, or undefined without one.
|
||||
*/
|
||||
export function logicalParentOf(
|
||||
entry: SessionStoreEntry,
|
||||
has: (uuid: string) => boolean,
|
||||
): string | undefined {
|
||||
const logical = entry.logicalParentUuid;
|
||||
if (typeof logical !== "string") return undefined;
|
||||
if (has(logical)) return logical;
|
||||
const metadata = entry.compactMetadata as {
|
||||
preservedSegment?: { tailUuid?: unknown } | null;
|
||||
preservedMessages?: { uuids?: unknown } | null;
|
||||
} | null;
|
||||
const uuids = metadata?.preservedMessages?.uuids;
|
||||
const candidates = [
|
||||
metadata?.preservedSegment?.tailUuid,
|
||||
Array.isArray(uuids) ? (uuids.at(-1) as unknown) : undefined,
|
||||
];
|
||||
return (
|
||||
candidates.find((uuid): uuid is string => typeof uuid === "string" && has(uuid)) ?? logical
|
||||
);
|
||||
}
|
||||
|
||||
/** What a resume restores from the end of the local transcript. */
|
||||
|
||||
@@ -94,10 +94,12 @@ export class LastReportedEntity {
|
||||
update: { sessionUpdate: string; _meta?: unknown } & Record<string, unknown>;
|
||||
},
|
||||
protocol: 1 | 2 = 1,
|
||||
/** The session is a child's own stream, whose entities name their launch. */
|
||||
child = false,
|
||||
): void {
|
||||
const { sessionId, update } = notification;
|
||||
const meta = update._meta as { claudeCode?: { parentToolUseId?: unknown } } | null | undefined;
|
||||
if (meta?.claudeCode?.parentToolUseId) return;
|
||||
if (!child && meta?.claudeCode?.parentToolUseId) return;
|
||||
const messageId = typeof update.messageId === "string" ? update.messageId : undefined;
|
||||
switch (update.sessionUpdate) {
|
||||
case "user_message":
|
||||
|
||||
@@ -2,7 +2,7 @@ import { RequestError } from "@agentclientprotocol/sdk/unstable";
|
||||
import { getSessionMessages, type SessionStoreEntry } from "@anthropic-ai/claude-agent-sdk";
|
||||
import { createHash } from "node:crypto";
|
||||
import type { BigIntStats } from "node:fs";
|
||||
import { lstat, open } from "node:fs/promises";
|
||||
import { lstat, open, readFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { z } from "zod";
|
||||
import packageJson from "../package.json" with { type: "json" };
|
||||
@@ -22,9 +22,27 @@ import {
|
||||
import { sanitizeTitle } from "./session-titles.js";
|
||||
import { activeSessionMessages, readRewindPoint } from "./session-rewind.js";
|
||||
import { withReplyBranches } from "./transcript-branches.js";
|
||||
import { isNativeSubagentControlTool } from "./native-subagents.js";
|
||||
import {
|
||||
isMissing,
|
||||
subagentHistory,
|
||||
subagentLaunchIds,
|
||||
subagentTranscript,
|
||||
type SubagentHistory,
|
||||
} from "./subagent-history.js";
|
||||
import { SubagentStatus } from "./subagent-status.js";
|
||||
|
||||
export const SESSION_READ_METHOD = "_session/read";
|
||||
export const SESSION_READ_CAPABILITY = { supported: true } as const;
|
||||
/** The capability of a connection that can read subagents lazily (see `docs/session-read.md`). */
|
||||
export const SESSION_READ_SUBAGENTS_CAPABILITY = {
|
||||
supported: true,
|
||||
subagents: {},
|
||||
filters: { subagents: {} },
|
||||
} as const;
|
||||
|
||||
/** The keys of `filters` this adapter applies. A read with another key is refused. */
|
||||
const SUPPORTED_FILTERS = new Set(["subagents"]);
|
||||
|
||||
export type SessionReadFrame = {
|
||||
sessionId: string;
|
||||
@@ -34,6 +52,10 @@ export type SessionReadFrame = {
|
||||
|
||||
const request = z.object({
|
||||
sessionId: z.string().trim().min(1),
|
||||
/** A child session of `sessionId`, as the client got it: reads that child's stream only. */
|
||||
subagentSessionId: z.string().trim().min(1).nullish(),
|
||||
/** What the read sends: `subagents` is `"full"` (the default) or `"status"`. */
|
||||
filters: z.record(z.string(), z.unknown()).nullish(),
|
||||
_meta: z.record(z.string(), z.unknown()).nullish(),
|
||||
cwd: z.string().refine(path.isAbsolute, "cwd must be an absolute path").nullish(),
|
||||
replayFrom: z
|
||||
@@ -44,10 +66,19 @@ const request = z.object({
|
||||
.nullish(),
|
||||
});
|
||||
|
||||
/**
|
||||
* What a read renders besides the root: every subagent transcript (the
|
||||
* default), only the status of each subagent (`filters.subagents: "status"`), or
|
||||
* only the stream of the child `subagentSessionId`.
|
||||
*/
|
||||
export type SessionReadScope = { subagents?: "status"; subagentSessionId?: string };
|
||||
|
||||
type ReadOptions = {
|
||||
protocol: 1 | 2;
|
||||
capabilities: unknown;
|
||||
cursors: boolean;
|
||||
/** Whether the client has native subagent sessions, which the status and child reads need. */
|
||||
subagents?: boolean;
|
||||
signal?: AbortSignal;
|
||||
isOpen(sessionId: string): boolean;
|
||||
assertRoot?(sessionId: string): void;
|
||||
@@ -55,19 +86,29 @@ type ReadOptions = {
|
||||
sessionId: string,
|
||||
cwd: string | undefined,
|
||||
observeStorage: boolean,
|
||||
scope: SessionReadScope,
|
||||
): Promise<{
|
||||
frames: SessionReadFrame[];
|
||||
cwd: string;
|
||||
historyEnd?: number;
|
||||
title?: string;
|
||||
storage?: SessionReadStorage;
|
||||
/** For a status read: the status update, which goes out outside the cursor. */
|
||||
status?: SessionReadFrame;
|
||||
/** For a child read: the session id of the child's stream in `frames`. */
|
||||
stream?: string;
|
||||
}>;
|
||||
send(frame: SessionReadFrame): Promise<void> | void;
|
||||
};
|
||||
|
||||
export type SessionReadStorage = {
|
||||
transcript: string;
|
||||
version: string;
|
||||
/** The root transcript's version; undefined for a child read, which checks `files`. */
|
||||
version?: string;
|
||||
/** Subagent transcripts that the replay depends on, with their version, `null` for a missing one. */
|
||||
files?: [path: string, version: string | null][];
|
||||
/** The metadata of the session's subagents, when the replay depends on it (see {@link subagentRecords}). */
|
||||
subagents?: string;
|
||||
/** Undefined when replay skipped the sidecar, null when it had no title. */
|
||||
sidecarTitle?: string | null;
|
||||
};
|
||||
@@ -77,6 +118,43 @@ function fileVersion(stats: BigIntStats): string {
|
||||
return [dev, ino, mode, size, mtimeNs, ctimeNs].join(":");
|
||||
}
|
||||
|
||||
/**
|
||||
* The version of the file `name`, `null` when it is missing. Undefined when
|
||||
* it is not a regular file, such as a symbolic link, whose version does not
|
||||
* change when its target does: as for the root, no checkpoint can rely on it.
|
||||
*/
|
||||
async function fileVersionAt(name: string): Promise<string | null | undefined> {
|
||||
try {
|
||||
const stats = await lstat(name, { bigint: true });
|
||||
return stats.isFile() ? fileVersion(stats) : undefined;
|
||||
} catch (error) {
|
||||
if (isMissing(error)) return null;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/** The versions of `names`, read in parallel; undefined when one is not a regular file. */
|
||||
async function fileVersions(names: string[]): Promise<[string, string | null][] | undefined> {
|
||||
const versions = await Promise.all(names.map(async (name) => [name, await fileVersionAt(name)]));
|
||||
return versions.every(([, version]) => version !== undefined)
|
||||
? (versions as [string, string | null][])
|
||||
: undefined;
|
||||
}
|
||||
|
||||
/** The transcript of the child `agentId`. */
|
||||
function childFile(history: SubagentHistory, agentId: string): string | undefined {
|
||||
return history.directory && subagentTranscript(history.directory, agentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* The metadata of the subagents of `history`, to compare. A checkpoint
|
||||
* compares the content, not file versions: the files are read before their
|
||||
* versions could be.
|
||||
*/
|
||||
function subagentRecords(history: SubagentHistory): string {
|
||||
return json([...history.agents].sort(([a], [b]) => a.localeCompare(b)));
|
||||
}
|
||||
|
||||
/** Checks the transcript's metadata and the sidecar inputs read by the replay. */
|
||||
async function storageUnchanged(sessionId: string, storage: SessionReadStorage): Promise<boolean> {
|
||||
try {
|
||||
@@ -84,10 +162,23 @@ async function storageUnchanged(sessionId: string, storage: SessionReadStorage):
|
||||
const transcript = await findTranscript(sessionId, { strict: true });
|
||||
if (transcript !== storage.transcript) return false;
|
||||
const matchesTranscript = async () => {
|
||||
const root = await lstat(transcript, { bigint: true });
|
||||
return root.isFile() && fileVersion(root) === storage.version;
|
||||
if (storage.version !== undefined) {
|
||||
const root = await lstat(transcript, { bigint: true });
|
||||
if (!root.isFile() || fileVersion(root) !== storage.version) return false;
|
||||
}
|
||||
for (const [file, version] of storage.files ?? []) {
|
||||
const current = await fileVersionAt(file);
|
||||
if (current === undefined || current !== version) return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
if (!(await matchesTranscript())) return false;
|
||||
if (
|
||||
storage.subagents !== undefined &&
|
||||
subagentRecords(await subagentHistory(sessionId, { strict: true, transcript })) !==
|
||||
storage.subagents
|
||||
)
|
||||
return false;
|
||||
if (storage.sidecarTitle !== undefined) {
|
||||
const title = await readSidecarTitle(transcript, { strict: true });
|
||||
if ((title ?? null) !== storage.sidecarTitle) return false;
|
||||
@@ -103,17 +194,34 @@ async function storageUnchanged(sessionId: string, storage: SessionReadStorage):
|
||||
/** These tools render their stored input and result, with no child or workspace reads. */
|
||||
const ROOT_ONLY_TOOLS = new Set(["Bash", "PowerShell", "Read", "Write", "Edit", "Glob", "Grep"]);
|
||||
|
||||
function hasIndependentHistory(content: unknown): boolean {
|
||||
/** A child's hand-back renders from its own input and result too. */
|
||||
const CHILD_ONLY_TOOLS = new Set([...ROOT_ONLY_TOOLS, "SubagentHandback"]);
|
||||
|
||||
/**
|
||||
* Whether `content` has a tool call that renders from files that a
|
||||
* checkpoint does not observe. A status read observes the subagent files, so
|
||||
* an Agent or Task call is no such call there.
|
||||
*/
|
||||
function hasIndependentHistory(
|
||||
content: unknown,
|
||||
tools = ROOT_ONLY_TOOLS,
|
||||
launches = false,
|
||||
): boolean {
|
||||
return (
|
||||
Array.isArray(content) &&
|
||||
content.some(
|
||||
(block) =>
|
||||
["tool_use", "server_tool_use", "mcp_tool_use"].includes(block?.type) &&
|
||||
!ROOT_ONLY_TOOLS.has(block.name),
|
||||
!tools.has(block.name) &&
|
||||
!(launches && isNativeSubagentControlTool(block.name)),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function contentOf(message: { message?: unknown }): unknown {
|
||||
return (message.message as { content?: unknown } | null)?.content;
|
||||
}
|
||||
|
||||
function currentDirectory(): string | undefined {
|
||||
try {
|
||||
return process.cwd();
|
||||
@@ -123,11 +231,126 @@ function currentDirectory(): string | undefined {
|
||||
}
|
||||
}
|
||||
|
||||
/** The id that AIR's draft gives a replayed child (see `replaySessionHistory` in the v1 agent). */
|
||||
const AIR_REPLAY_CHILD = ":replay-subagent:";
|
||||
|
||||
/** The child that a child read selects (see {@link findChild}). */
|
||||
export class SessionReadChild {
|
||||
/** The messages of the child's transcript, once the replay read them. */
|
||||
private messages: readonly { message?: unknown }[] | undefined;
|
||||
|
||||
constructor(
|
||||
readonly agentId: string,
|
||||
private readonly launchId: string,
|
||||
readonly history: SubagentHistory,
|
||||
private readonly rootSessionId: string,
|
||||
/** The agents whose transcripts the replay reads; undefined for every agent. */
|
||||
private readonly lineage: Set<string> | undefined,
|
||||
/** The version of the child's transcript, read before the replay. */
|
||||
private readonly files: [string, string | null][] | undefined,
|
||||
) {}
|
||||
|
||||
/** Whether the replay reads the transcript of the agent `agentId`. Others keep their association only. */
|
||||
expand(agentId: string): boolean {
|
||||
return !this.lineage || this.lineage.has(agentId);
|
||||
}
|
||||
|
||||
/** Takes each child transcript that the replay read. */
|
||||
read(agentId: string, messages: readonly { message?: unknown }[]): void {
|
||||
if (agentId === this.agentId) this.messages = messages;
|
||||
}
|
||||
|
||||
/** The session id of the child's stream: AIR's replay id, or the agent id. */
|
||||
streamId(form: "air" | "rfd"): string {
|
||||
return form === "air" ? this.rootSessionId + AIR_REPLAY_CHILD + this.launchId : this.agentId;
|
||||
}
|
||||
|
||||
/** The storage of a checkpoint, when the child's stream renders from its own files alone. */
|
||||
storage(transcript: string, rewound: boolean): SessionReadStorage | undefined {
|
||||
if (!this.files || rewound || !this.messages) return undefined;
|
||||
if (
|
||||
this.messages.some((message) => hasIndependentHistory(contentOf(message), CHILD_ONLY_TOOLS))
|
||||
)
|
||||
return undefined;
|
||||
return { transcript, files: this.files, subagents: subagentRecords(this.history) };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the child `subagent` of the session `sessionId`. It is a child
|
||||
* session id that the client got: AIR's `<root>:replay-subagent:<launch>`,
|
||||
* an agent id, or an agent id with a live generation suffix. Every
|
||||
* generation of an agent shares its transcript, so they are one stream.
|
||||
*/
|
||||
async function findChild(
|
||||
sessionId: string,
|
||||
transcript: string,
|
||||
subagent: string,
|
||||
rootLaunches: Set<string>,
|
||||
observeStorage: boolean,
|
||||
): Promise<SessionReadChild> {
|
||||
const history = await subagentHistory(sessionId, { strict: true, transcript });
|
||||
const byAgent = new Map(
|
||||
[...history.agents].map(([launchId, record]) => [record.agentId, { launchId, record }]),
|
||||
);
|
||||
const prefix = sessionId + AIR_REPLAY_CHILD;
|
||||
const launchId = subagent.startsWith(prefix) ? subagent.slice(prefix.length) : undefined;
|
||||
const target =
|
||||
launchId !== undefined
|
||||
? history.agents.has(launchId)
|
||||
? { launchId, record: history.agents.get(launchId)! }
|
||||
: undefined
|
||||
: byAgent.get(subagent.replace(/:generation:\d+$/, ""));
|
||||
if (!target) {
|
||||
throw new RequestError(
|
||||
-32002,
|
||||
"The session has no recorded subagent with this id. Read its root again.",
|
||||
{ reason: "subagent_not_found", sessionId, subagentSessionId: subagent },
|
||||
);
|
||||
}
|
||||
const { agentId } = target.record;
|
||||
// Read before the transcripts, so that a checkpoint never pairs them with a later append.
|
||||
const file = childFile(history, agentId);
|
||||
const files = observeStorage && file ? await fileVersions([file]) : undefined;
|
||||
// The child and its ancestors, by the parent that each metadata file names.
|
||||
// Without one, a launch outside the root history replays every child.
|
||||
let lineage: Set<string> | undefined = new Set();
|
||||
for (let current: typeof target | undefined = target; current && lineage;) {
|
||||
if (lineage.has(current.record.agentId)) break;
|
||||
lineage.add(current.record.agentId);
|
||||
const parent = current.record.parentAgentId;
|
||||
if (parent) {
|
||||
current = byAgent.get(parent);
|
||||
if (!current) lineage = undefined;
|
||||
} else {
|
||||
if (!rootLaunches.has(current.launchId)) lineage = undefined;
|
||||
current = undefined;
|
||||
}
|
||||
}
|
||||
if (lineage && file) {
|
||||
const text = await readFile(file, "utf8").catch(() => "");
|
||||
// A SendMessage between agents links both streams, and the replay links
|
||||
// them only with the other agent's transcript: such a child replays them all.
|
||||
if (text.includes('"name":"SendMessage"') || text.includes('"kind":"coordinator"')) {
|
||||
lineage = undefined;
|
||||
} else {
|
||||
// A child's hand-back is a message on this stream, so its direct children replay too.
|
||||
for (const [launch, record] of history.agents) {
|
||||
if (record.parentAgentId === agentId || text.includes(`"${launch}"`)) {
|
||||
lineage.add(record.agentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return new SessionReadChild(agentId, target.launchId, history, sessionId, lineage, files);
|
||||
}
|
||||
|
||||
/** The SDK follows parent links in these records, including the branch selected by rewind.json. */
|
||||
export async function readSessionTranscript(
|
||||
sessionId: string,
|
||||
cwd?: string,
|
||||
observeStorage = false,
|
||||
scope: SessionReadScope = {},
|
||||
) {
|
||||
if (!isSessionId(sessionId)) {
|
||||
throw RequestError.invalidParams({ sessionId }, "Read the root Claude session by its UUID.");
|
||||
@@ -177,22 +400,62 @@ export async function readSessionTranscript(
|
||||
effectiveCwd,
|
||||
records,
|
||||
);
|
||||
const rootLaunches = new Set(
|
||||
messages.flatMap((message) => subagentLaunchIds(contentOf(message))),
|
||||
);
|
||||
const child =
|
||||
scope.subagentSessionId === undefined
|
||||
? undefined
|
||||
: await findChild(
|
||||
sessionId,
|
||||
transcript,
|
||||
scope.subagentSessionId,
|
||||
rootLaunches,
|
||||
observeStorage,
|
||||
);
|
||||
const statusRead = scope.subagents === "status";
|
||||
const history =
|
||||
statusRead && rootLaunches.size > 0
|
||||
? await subagentHistory(sessionId, { strict: true, transcript })
|
||||
: undefined;
|
||||
const quiet =
|
||||
version &&
|
||||
!rewind &&
|
||||
!messages.some((message) =>
|
||||
hasIndependentHistory(contentOf(message), ROOT_ONLY_TOOLS, statusRead),
|
||||
);
|
||||
// Before the transcript ends, so that a checkpoint never pairs them with a later append.
|
||||
const files = quiet && history ? await fileVersions(subagentFiles(history)) : undefined;
|
||||
return {
|
||||
messages,
|
||||
cwd: effectiveCwd,
|
||||
transcript,
|
||||
child,
|
||||
rewound: rewind !== undefined && rewind !== null,
|
||||
subagentStatus: statusRead
|
||||
? await SubagentStatus.read(history ?? { agents: new Map() })
|
||||
: undefined,
|
||||
title: title && sanitizeTitle(title),
|
||||
// A status read depends on the children's files: without their versions it keeps no checkpoint.
|
||||
storage:
|
||||
version &&
|
||||
!rewind &&
|
||||
!messages.some((message) =>
|
||||
hasIndependentHistory((message.message as { content?: unknown } | null)?.content),
|
||||
)
|
||||
? { transcript, version, sidecarTitle }
|
||||
!child && quiet && (!history || files)
|
||||
? {
|
||||
transcript,
|
||||
version,
|
||||
sidecarTitle,
|
||||
...(files && history ? { files, subagents: subagentRecords(history) } : {}),
|
||||
}
|
||||
: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
/** The child transcripts that a status read depends on, in a stable order: it reads their ends. */
|
||||
function subagentFiles(history: SubagentHistory): string[] {
|
||||
return [...history.agents.values()]
|
||||
.flatMap(({ agentId }) => childFile(history, agentId) ?? [])
|
||||
.sort();
|
||||
}
|
||||
|
||||
/**
|
||||
* The `field` of the last `type` record of the snapshot, undefined when it is
|
||||
* empty. The SDK reads the head and tail 64 KB windows instead, so a large
|
||||
@@ -268,6 +531,8 @@ function snapshot(
|
||||
scope: string,
|
||||
previous?: string,
|
||||
historyEnd = frames.length,
|
||||
/** `root` is a child's stream, whose entities name their launch. */
|
||||
child = false,
|
||||
) {
|
||||
const saved = previous ? decodeLengths(previous) : new Map<string, number>();
|
||||
const streams = new Map<
|
||||
@@ -306,7 +571,7 @@ function snapshot(
|
||||
stream.count++;
|
||||
if (stream.count === before) stream.prefix = stream.history.copy().digest("base64url");
|
||||
if (before === undefined || stream.count > before) outgoing.push(frame);
|
||||
entities.sending(frame, protocol);
|
||||
entities.sending(frame, protocol, child);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,11 +604,17 @@ type Checkpoint = {
|
||||
storage: SessionReadStorage;
|
||||
boundaries: SessionReadFrame[];
|
||||
title?: string;
|
||||
status?: SessionReadFrame;
|
||||
/** The root session, for a child read too. */
|
||||
root: string;
|
||||
/** The child's stream, for a child read. */
|
||||
stream?: string;
|
||||
};
|
||||
|
||||
/** A read owns only a replay on this connection. Closing it invalidates the pending delivery. */
|
||||
export class SessionReads {
|
||||
private readonly active = new Map<string, { invalidated: boolean }>();
|
||||
/** Reads by root session, or by root, child and mode for the other scopes. */
|
||||
private readonly active = new Map<string, { root: string; invalidated: boolean }>();
|
||||
|
||||
private readonly transitions = new Map<string, number>();
|
||||
|
||||
@@ -356,12 +627,14 @@ export class SessionReads {
|
||||
run: () => Promise<T>,
|
||||
): Promise<T> {
|
||||
if (sessionId === undefined) return run();
|
||||
const read = this.active.get(sessionId);
|
||||
if (read) {
|
||||
const reads = [...this.active.values()].filter((read) => read.root === sessionId);
|
||||
if (reads.length > 0) {
|
||||
if (kind === "open") throw alreadyOpen(sessionId);
|
||||
read.invalidated = true;
|
||||
for (const read of reads) read.invalidated = true;
|
||||
}
|
||||
for (const [key, checkpoint] of this.checkpoints) {
|
||||
if (checkpoint.root === sessionId) this.checkpoints.delete(key);
|
||||
}
|
||||
this.checkpoints.delete(sessionId);
|
||||
this.transitions.set(sessionId, (this.transitions.get(sessionId) ?? 0) + 1);
|
||||
try {
|
||||
return await run();
|
||||
@@ -377,6 +650,45 @@ export class SessionReads {
|
||||
if (!parsed.success)
|
||||
throw RequestError.invalidParams(undefined, parsed.error.issues[0]?.message);
|
||||
const { sessionId, replayFrom } = parsed.data;
|
||||
const subagent = parsed.data.subagentSessionId ?? undefined;
|
||||
if (subagent !== undefined && !options.subagents) {
|
||||
throw RequestError.invalidParams(
|
||||
{ reason: "subagent_read_unsupported", subagentSessionId: subagent },
|
||||
"Reading a subagent needs native subagent sessions. Read the root session instead.",
|
||||
);
|
||||
}
|
||||
const filters = parsed.data.filters ?? {};
|
||||
// An adapter that ignored an unknown filter would send more than the client asked for.
|
||||
const unsupported = Object.keys(filters).filter((name) => !SUPPORTED_FILTERS.has(name));
|
||||
if (unsupported.length > 0) {
|
||||
throw RequestError.invalidParams(
|
||||
{ reason: "unsupported_filter", filters: unsupported },
|
||||
`This adapter does not support the read filters ${unsupported.join(", ")}. Check \`_meta.sessionRead.filters\` in the initialize response and remove them.`,
|
||||
);
|
||||
}
|
||||
if (
|
||||
filters.subagents != null &&
|
||||
filters.subagents !== "full" &&
|
||||
filters.subagents !== "status"
|
||||
) {
|
||||
throw RequestError.invalidParams(
|
||||
{ reason: "unsupported_filter", filters: ["subagents"] },
|
||||
'`filters.subagents` is "full" or "status".',
|
||||
);
|
||||
}
|
||||
// Without native subagent sessions there are no child transcripts to leave out.
|
||||
const status = options.subagents === true && filters.subagents === "status";
|
||||
if (subagent !== undefined && status) {
|
||||
throw RequestError.invalidParams(
|
||||
{ reason: "subagent_read_with_status", subagentSessionId: subagent },
|
||||
'A subagent read has no `filters.subagents: "status"`. Remove one of them.',
|
||||
);
|
||||
}
|
||||
const readScope: SessionReadScope = {
|
||||
...(status ? { subagents: "status" as const } : {}),
|
||||
...(subagent !== undefined ? { subagentSessionId: subagent } : {}),
|
||||
};
|
||||
const key = subagent === undefined && !status ? sessionId : json([sessionId, readScope]);
|
||||
const cwd = parsed.data.cwd ?? undefined;
|
||||
const previous = replayFrom?.type === "cursor" ? replayFrom.cursorId : undefined;
|
||||
if (
|
||||
@@ -385,8 +697,8 @@ export class SessionReads {
|
||||
)
|
||||
throw invalidCursor();
|
||||
const cursor = typeof previous === "string" ? previous : undefined;
|
||||
if (this.active.has(sessionId)) throw alreadyOpen(sessionId);
|
||||
const read = { invalidated: false };
|
||||
if (this.active.has(key)) throw alreadyOpen(sessionId);
|
||||
const read = { root: sessionId, invalidated: false };
|
||||
const check = () => {
|
||||
if (options.signal?.aborted) throw RequestError.requestCancelled();
|
||||
if (read.invalidated || this.transitions.has(sessionId) || options.isOpen(sessionId))
|
||||
@@ -394,10 +706,11 @@ export class SessionReads {
|
||||
};
|
||||
check();
|
||||
options.assertRoot?.(sessionId);
|
||||
this.active.set(sessionId, read);
|
||||
this.active.set(key, read);
|
||||
const useCursor = options.cursors && replayFrom != null;
|
||||
const processCwd = useCursor ? currentDirectory() : undefined;
|
||||
const scopeFor = (effectiveCwd: string) =>
|
||||
// A child's scope names its resolved stream, so each id of it shares a cursor.
|
||||
const scopeFor = (effectiveCwd: string, stream?: string) =>
|
||||
json([
|
||||
sessionId,
|
||||
effectiveCwd,
|
||||
@@ -405,11 +718,26 @@ export class SessionReads {
|
||||
options.protocol,
|
||||
options.capabilities,
|
||||
packageJson.version,
|
||||
// The cursor belongs to the read's filters: a read with other filters refuses it.
|
||||
...(status ? [{ filters: { subagents: "status" } }] : []),
|
||||
...(stream === undefined ? [] : [stream]),
|
||||
]);
|
||||
const replay = async () => {
|
||||
try {
|
||||
const view = await options.replay(sessionId, cwd, useCursor);
|
||||
if (options.protocol === 1 && view.title)
|
||||
const view = await options.replay(sessionId, cwd, useCursor, readScope);
|
||||
if (view.stream !== undefined) {
|
||||
// The child's stream only. Other streams belong to their own reads.
|
||||
const end = view.historyEnd ?? view.frames.length;
|
||||
const own = (frame: SessionReadFrame) => frame.sessionId === view.stream;
|
||||
return {
|
||||
...view,
|
||||
frames: view.frames.filter(own),
|
||||
historyEnd: view.frames.slice(0, end).filter(own).length,
|
||||
title: undefined,
|
||||
};
|
||||
}
|
||||
// A status read sends the title outside the cursor, as on v2 (see `deliver`).
|
||||
if (options.protocol === 1 && view.title && view.status === undefined)
|
||||
view.frames.push({
|
||||
sessionId,
|
||||
update: { sessionUpdate: "session_info_update", title: view.title },
|
||||
@@ -434,13 +762,23 @@ export class SessionReads {
|
||||
outgoing: SessionReadFrame[],
|
||||
cursorId: string | undefined,
|
||||
title: string | undefined,
|
||||
current: SessionReadFrame | undefined,
|
||||
) => {
|
||||
for (const frame of outgoing) {
|
||||
check();
|
||||
await options.send(frame);
|
||||
}
|
||||
// On v2 the title is current session info, outside the replay cursor.
|
||||
if (options.protocol === 2 && (title || useCursor)) {
|
||||
// The subagent status is current, outside the replay cursor.
|
||||
if (current) {
|
||||
check();
|
||||
await options.send(current);
|
||||
}
|
||||
// On v2, and in a v1 status read, the title is current session info, outside the replay cursor.
|
||||
if (
|
||||
(options.protocol === 2 || current !== undefined) &&
|
||||
subagent === undefined &&
|
||||
(title || useCursor)
|
||||
) {
|
||||
check();
|
||||
await options.send({
|
||||
sessionId,
|
||||
@@ -451,35 +789,39 @@ export class SessionReads {
|
||||
return cursorId ? { cursorId } : {};
|
||||
};
|
||||
try {
|
||||
const cached = cursor ? this.checkpoints.get(sessionId) : undefined;
|
||||
const cached = cursor ? this.checkpoints.get(key) : undefined;
|
||||
if (
|
||||
cached &&
|
||||
cached.cursorId === cursor &&
|
||||
(cached.requestedCwd === cwd || cached.cwd === cwd) &&
|
||||
cached.processCwd === processCwd &&
|
||||
cached.scope === scopeFor(cached.cwd) &&
|
||||
cached.scope === scopeFor(cached.cwd, cached.stream) &&
|
||||
(await storageUnchanged(sessionId, cached.storage)) &&
|
||||
cached.processCwd === currentDirectory()
|
||||
) {
|
||||
return await deliver(cached.boundaries, cached.cursorId, cached.title);
|
||||
return await deliver(cached.boundaries, cached.cursorId, cached.title, cached.status);
|
||||
}
|
||||
check();
|
||||
if (useCursor) this.checkpoints.delete(sessionId);
|
||||
const { frames, cwd: effectiveCwd, historyEnd, title, storage } = await replay();
|
||||
if (useCursor) this.checkpoints.delete(key);
|
||||
const view = await replay();
|
||||
const { frames, cwd: effectiveCwd, historyEnd, title, storage, stream } = view;
|
||||
let current = view.status;
|
||||
const streamId = stream ?? sessionId;
|
||||
check();
|
||||
if (!useCursor) return await deliver(frames, undefined, title);
|
||||
const scope = scopeFor(effectiveCwd);
|
||||
if (!useCursor) return await deliver(frames, undefined, title, current);
|
||||
const scope = scopeFor(effectiveCwd, stream);
|
||||
const { outgoing, cursorId, anchor } = snapshot(
|
||||
frames,
|
||||
sessionId,
|
||||
streamId,
|
||||
options.protocol,
|
||||
scope,
|
||||
cursor,
|
||||
historyEnd,
|
||||
stream !== undefined,
|
||||
);
|
||||
let verifiedStorage = storage;
|
||||
const isRootBoundary = (frame: SessionReadFrame) =>
|
||||
frame.sessionId === sessionId && frame.update.sessionUpdate === "replay_complete";
|
||||
const isStreamBoundary = (frame: SessionReadFrame) =>
|
||||
frame.sessionId === streamId && frame.update.sessionUpdate === "replay_complete";
|
||||
if (cursorId && cursorId !== cursor) {
|
||||
// A terminal can append or rewind between the reads of the root and a child.
|
||||
const again = await replay();
|
||||
@@ -495,16 +837,14 @@ export class SessionReads {
|
||||
"History changed during the read. Retry with the last successful cursor.",
|
||||
);
|
||||
}
|
||||
if (
|
||||
again.storage?.transcript !== storage?.transcript ||
|
||||
again.storage?.version !== storage?.version ||
|
||||
again.storage?.sidecarTitle !== storage?.sidecarTitle
|
||||
) {
|
||||
// The later status, which a child's append can change without changing the frames.
|
||||
current = again.status;
|
||||
if (json(again.storage ?? null) !== json(storage ?? null)) {
|
||||
verifiedStorage = undefined;
|
||||
}
|
||||
const end = outgoing.findIndex(isRootBoundary);
|
||||
const end = outgoing.findIndex(isStreamBoundary);
|
||||
outgoing.splice(end < 0 ? outgoing.length : end, 0, {
|
||||
sessionId,
|
||||
sessionId: streamId,
|
||||
update: {
|
||||
sessionUpdate: "cursor_update",
|
||||
cursorId,
|
||||
@@ -514,18 +854,21 @@ export class SessionReads {
|
||||
});
|
||||
}
|
||||
// Pair the cursor only with the inputs read by its render, never a later append.
|
||||
const result = await deliver(outgoing, cursorId, title);
|
||||
const result = await deliver(outgoing, cursorId, title, current);
|
||||
check();
|
||||
if (cursorId && verifiedStorage && processCwd && processCwd === currentDirectory()) {
|
||||
this.checkpoints.set(sessionId, {
|
||||
this.checkpoints.set(key, {
|
||||
root: sessionId,
|
||||
...(stream !== undefined ? { stream } : {}),
|
||||
cursorId,
|
||||
scope,
|
||||
requestedCwd: cwd,
|
||||
cwd: effectiveCwd,
|
||||
processCwd,
|
||||
storage: verifiedStorage,
|
||||
boundaries: frames.filter(isRootBoundary),
|
||||
boundaries: frames.filter(isStreamBoundary),
|
||||
title,
|
||||
...(current ? { status: current } : {}),
|
||||
});
|
||||
if (this.checkpoints.size > 32) {
|
||||
this.checkpoints.delete(this.checkpoints.keys().next().value!);
|
||||
@@ -533,7 +876,7 @@ export class SessionReads {
|
||||
}
|
||||
return result;
|
||||
} finally {
|
||||
this.active.delete(sessionId);
|
||||
this.active.delete(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import { isReplayHiddenMetaMessage } from "./message-filters.js";
|
||||
import {
|
||||
findTranscript,
|
||||
loadFullSessionHistory,
|
||||
logicalParentOf,
|
||||
readHistoryAcrossCompactions,
|
||||
} from "./resumed-session.js";
|
||||
import { cursorMessageId, forkPointOf } from "./session-cursors.js";
|
||||
@@ -328,9 +329,10 @@ export async function withoutRewoundBranch(
|
||||
const point = await readRewindPoint(sessionId, logger);
|
||||
if (!point) return entries;
|
||||
const dropped = new Set<string>([point.droppedPromptUuid]);
|
||||
const known = new Set(entries.map((entry) => entry.uuid));
|
||||
return entries.filter((entry) => {
|
||||
if (typeof entry.uuid !== "string") return true;
|
||||
const parent = entry.parentUuid || entry.logicalParentUuid;
|
||||
const parent = entry.parentUuid || logicalParentOf(entry, (uuid) => known.has(uuid));
|
||||
const inDropped =
|
||||
entry.uuid === point.droppedPromptUuid || (typeof parent === "string" && dropped.has(parent));
|
||||
if (inDropped) dropped.add(entry.uuid);
|
||||
@@ -581,7 +583,7 @@ function newestMainChainUuid(entries: SessionStoreEntry[]): string | undefined {
|
||||
}
|
||||
|
||||
/** The uuids of `leaf` and of every entry it descends from. A compaction
|
||||
* boundary has no `parentUuid`; its `logicalParentUuid` carries the chain on. */
|
||||
* boundary has no `parentUuid`; {@link logicalParentOf} carries the chain on. */
|
||||
function chainUuids(
|
||||
leaf: string | undefined,
|
||||
byUuid: ReadonlyMap<string, SessionStoreEntry>,
|
||||
@@ -592,7 +594,7 @@ function chainUuids(
|
||||
const entry = byUuid.get(cursor);
|
||||
if (!entry) break;
|
||||
chain.add(cursor);
|
||||
const parent = entry.parentUuid || entry.logicalParentUuid;
|
||||
const parent = entry.parentUuid || logicalParentOf(entry, (uuid) => byUuid.has(uuid));
|
||||
cursor = typeof parent === "string" ? parent : undefined;
|
||||
}
|
||||
return chain;
|
||||
|
||||
@@ -85,10 +85,8 @@ export async function subagentHistory(
|
||||
.map(text)
|
||||
.find((value) => value && path.isAbsolute(value));
|
||||
const cwd = placement
|
||||
? ((await recordedCwd(
|
||||
path.join(directory, `agent-${match[1]!}.jsonl`),
|
||||
options.strict,
|
||||
)) ?? placement)
|
||||
? ((await recordedCwd(subagentTranscript(directory, match[1]!), options.strict)) ??
|
||||
placement)
|
||||
: undefined;
|
||||
agents.set(meta.toolUseId, {
|
||||
agentId: match[1]!,
|
||||
@@ -144,6 +142,11 @@ function subagentsDirectory(transcript: string, sessionId: string): string {
|
||||
return path.join(path.dirname(transcript), sessionId, "subagents");
|
||||
}
|
||||
|
||||
/** The transcript of the child `agentId` in the subagent folder `directory`. */
|
||||
export function subagentTranscript(directory: string, agentId: string): string {
|
||||
return path.join(directory, `agent-${agentId}.jsonl`);
|
||||
}
|
||||
|
||||
/**
|
||||
* The agent that the Agent or Task call `launchId` launched, from the subagent
|
||||
* history of the session `sessionId`.
|
||||
@@ -191,7 +194,7 @@ export async function subagentLineage(
|
||||
let launches = agentLaunches.get(candidate);
|
||||
if (!launches) {
|
||||
launches = await readLaunchIdsFromTranscript(
|
||||
path.join(subagentsDirectory(transcript, sessionId), `agent-${candidate}.jsonl`),
|
||||
subagentTranscript(subagentsDirectory(transcript, sessionId), candidate),
|
||||
candidate,
|
||||
logger,
|
||||
);
|
||||
@@ -351,7 +354,7 @@ async function withSubagentBranches(
|
||||
if (messages.length === 0 || !history.directory) return messages;
|
||||
let entries: SessionStoreEntry[];
|
||||
try {
|
||||
entries = await readTranscriptEntries(path.join(history.directory, `agent-${agentId}.jsonl`));
|
||||
entries = await readTranscriptEntries(subagentTranscript(history.directory, agentId));
|
||||
} catch {
|
||||
return messages;
|
||||
}
|
||||
@@ -370,12 +373,12 @@ async function withSubagentBranches(
|
||||
}
|
||||
|
||||
/** Whether a filesystem error means a file does not exist. */
|
||||
function isMissing(error: unknown): boolean {
|
||||
export function isMissing(error: unknown): boolean {
|
||||
return (error as { code?: unknown } | null)?.code === "ENOENT";
|
||||
}
|
||||
|
||||
/** Retain the failed file for the caller's retryable error. */
|
||||
function withPath(error: unknown, file: string): Error & { path: string } {
|
||||
export function withPath(error: unknown, file: string): Error & { path: string } {
|
||||
if (error instanceof Error && typeof (error as { path?: unknown }).path === "string") {
|
||||
return error as Error & { path: string };
|
||||
}
|
||||
@@ -390,7 +393,7 @@ export async function readSubagentMessagesOrFail(
|
||||
launchId: string,
|
||||
): Promise<SessionMessage[]> {
|
||||
if (!history.directory) throw new Error("Subagent directory was not resolved");
|
||||
const file = path.join(history.directory, `agent-${agentId}.jsonl`);
|
||||
const file = subagentTranscript(history.directory, agentId);
|
||||
try {
|
||||
const entries = await readTranscriptEntries(file);
|
||||
const messages = await readSubagentChain(sessionId, agentId, entries);
|
||||
|
||||
@@ -58,7 +58,12 @@ import {
|
||||
type WorkState,
|
||||
} from "./native-subagents.js";
|
||||
import { noticeUpdate } from "./session-notices.js";
|
||||
import type { SubagentHistory, SubagentRecord } from "./subagent-history.js";
|
||||
import {
|
||||
subagentLaunchIds,
|
||||
type SubagentHistory,
|
||||
type SubagentRecord,
|
||||
} from "./subagent-history.js";
|
||||
import type { NestedLaunches, SubagentStatus, SubagentStatusEntry } from "./subagent-status.js";
|
||||
|
||||
type Publish = (notification: AcpSessionNotification) => Promise<void>;
|
||||
|
||||
@@ -187,6 +192,24 @@ export class ReplayTranscript<Child extends ReplayChild = ReplayChild> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A status read: registers the launches that the child session `owner`
|
||||
* made (see `SubagentStatus.launches`), with the states of their task
|
||||
* notifications. Returns the children that they launched, in launch order.
|
||||
*/
|
||||
scanLaunches(launches: NestedLaunches, owner: string): Child[] {
|
||||
this.scan(launches.messages, owner);
|
||||
for (const notification of launches.notifications) {
|
||||
const child = this.byAgentId.get(notification.task_id);
|
||||
if (child) child.notified = nativeSubagentState(notification.status) ?? child.notified;
|
||||
}
|
||||
return launches.messages
|
||||
.flatMap((message) =>
|
||||
subagentLaunchIds((message.message as { content?: unknown } | undefined)?.content),
|
||||
)
|
||||
.flatMap((launchId) => this.children.get(launchId) ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
* The report of a completed hand-back, once. `null` hides its other updates
|
||||
* and unfinished calls. `undefined` leaves failed calls and other updates visible.
|
||||
@@ -317,6 +340,26 @@ export class RfdSubagentReplay {
|
||||
return this.rootCwd;
|
||||
}
|
||||
|
||||
/**
|
||||
* A status read: announces `child` with the prompt of its launch, then the
|
||||
* children that it launched, from `status` without its transcript.
|
||||
*/
|
||||
async announceStatus(child: ReplayChild, status: SubagentStatus): Promise<void> {
|
||||
await this.announce(child);
|
||||
if (!child.promptSent && typeof child.input.prompt === "string") {
|
||||
await this.sendPrompt(child, child.input.prompt);
|
||||
}
|
||||
const launches = status.launches(child.record.agentId, child.launchId);
|
||||
for (const nested of this.transcript.scanLaunches(launches, child.sessionId)) {
|
||||
if (!nested.announced) await this.announceStatus(nested, status);
|
||||
}
|
||||
}
|
||||
|
||||
/** The status of each announced child (see `SubagentStatus.transcriptEntries`). */
|
||||
statusEntries(status: SubagentStatus, rootSessionId: string): SubagentStatusEntry[] {
|
||||
return status.transcriptEntries(this.transcript.children.values(), rootSessionId);
|
||||
}
|
||||
|
||||
/** Takes the model of a replayed response of the child `owner` (see {@link trackResponseModel}). */
|
||||
responseModel(owner: ReplayChild, model: string | undefined): void {
|
||||
trackResponseModel(owner, model);
|
||||
@@ -350,6 +393,22 @@ export class RfdSubagentReplay {
|
||||
return rest.length > 0 ? rest : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the replay of `child`'s history. When its transcript does not
|
||||
* start with the prompt (see {@link startsWithPrompt}), the prompt of the
|
||||
* launch goes first, so that new records come after it on the child's
|
||||
* stream and a cursor of that stream can continue.
|
||||
*/
|
||||
async childReplaying(child: ReplayChild, messages: readonly SessionMessage[]): Promise<void> {
|
||||
if (
|
||||
!child.promptSent &&
|
||||
typeof child.input.prompt === "string" &&
|
||||
!startsWithPrompt(messages)
|
||||
) {
|
||||
await this.sendPrompt(child, child.input.prompt);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends the replay of `child`'s history. `messages` is its transcript: when
|
||||
* it is empty, the replay has only the child's association, and the prompt
|
||||
@@ -439,11 +498,11 @@ export class RfdSubagentReplay {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the end of every announced child (see `replayEndState`), and a notice when
|
||||
* subagent history is missing.
|
||||
* Sends the end of every announced child (see `replayEndState`) unless
|
||||
* `endStates` is false, and a notice when subagent history is missing.
|
||||
*/
|
||||
async finish(supportsNotices: boolean, rootSessionId: string): Promise<void> {
|
||||
for (const child of [...this.transcript.children.values()].reverse()) {
|
||||
async finish(supportsNotices: boolean, rootSessionId: string, endStates = true): Promise<void> {
|
||||
for (const child of endStates ? [...this.transcript.children.values()].reverse() : []) {
|
||||
if (!child.announced) continue;
|
||||
await this.publish({
|
||||
sessionId: child.parentSessionId,
|
||||
@@ -695,6 +754,21 @@ export function isDirectory(dir: string): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a child's transcript `messages` starts with a user message with
|
||||
* text, which the replay sends as the prompt. A transcript can start without
|
||||
* it: the SDK can start a child's history after the prompt, such as after a
|
||||
* `system` record that the next record names as its parent.
|
||||
*/
|
||||
export function startsWithPrompt(messages: readonly SessionMessage[]): boolean {
|
||||
const [first] = messages;
|
||||
return (
|
||||
first?.type === "user" &&
|
||||
!isDelivery(first) &&
|
||||
textOf((first.message as { content?: unknown } | null)?.content).trim() !== ""
|
||||
);
|
||||
}
|
||||
|
||||
/** A message that a SendMessage call delivered to the child. */
|
||||
export function isDelivery(message: SessionMessage): boolean {
|
||||
return (message as { origin?: { kind?: unknown } | null }).origin?.kind === "coordinator";
|
||||
|
||||
525
src/subagent-status.ts
Normal file
525
src/subagent-status.ts
Normal file
@@ -0,0 +1,525 @@
|
||||
/**
|
||||
* The status read of a session's subagents: `_session/read` with
|
||||
* `filters.subagents: "status"`.
|
||||
*
|
||||
* The replay renders the root transcript and announces each child from its
|
||||
* metadata file, as the full replay does, but reads no child transcript. Of
|
||||
* each child it reads the file status and the end of the transcript, from
|
||||
* the last 64 KB (see `readTail`), for the model, the time of the last record
|
||||
* and whether the last turn ended.
|
||||
* A child whose metadata file names a parent (`parentAgentId`) is announced
|
||||
* under that parent. Its launch call, launch result and task notification are
|
||||
* in the parent's transcript, which is searched for the lines that name the
|
||||
* launch. Only those lines are parsed, and a later read searches only the
|
||||
* bytes appended since (see `readLaunches`).
|
||||
*
|
||||
* The read reports each announced child once more, in one update outside the
|
||||
* cursor (see {@link SubagentStatus.frame}).
|
||||
*/
|
||||
import type { SessionMessage } from "@anthropic-ai/claude-agent-sdk";
|
||||
import { open, type FileHandle } from "node:fs/promises";
|
||||
import type { SubagentState } from "./acp-subagents.js";
|
||||
import { HANDBACK_TOOL, type WorkState } from "./native-subagents.js";
|
||||
import {
|
||||
isMissing,
|
||||
subagentTranscript,
|
||||
withPath,
|
||||
type SubagentHistory,
|
||||
type SubagentRecord,
|
||||
} from "./subagent-history.js";
|
||||
import { replayEndState, type ReplayChild } from "./subagent-replay.js";
|
||||
import { taskNotificationsOf, type PersistedTaskNotification } from "./task-notifications.js";
|
||||
|
||||
/** The bytes read from the end of a child transcript. */
|
||||
const TAIL = 64 * 1024;
|
||||
|
||||
/** What the end of a child transcript says. */
|
||||
type ChildTail = {
|
||||
size: number;
|
||||
/** The model of the last assistant record. */
|
||||
model?: string;
|
||||
/** The `timestamp` of the last record. */
|
||||
updatedAt?: string;
|
||||
/** Whether the last turn ended: an answer that ends it (see `endsTurn`), or a hand-back that ends the transcript. */
|
||||
turnEnded: boolean;
|
||||
};
|
||||
|
||||
/** One child of a status read, as the client gets it. */
|
||||
export type SubagentStatusEntry = {
|
||||
sessionId: string;
|
||||
/** The child that launched it; absent for a child of the root. */
|
||||
parentSessionId?: string;
|
||||
/** A `subagent_state_update` state on v1 AIR clients, a `subagent_update` state otherwise. */
|
||||
state: string | WorkState;
|
||||
background?: true;
|
||||
agentType?: string;
|
||||
cwd?: string;
|
||||
model?: string;
|
||||
updatedAt?: string;
|
||||
/** The size of its transcript in bytes; absent when it has none yet. */
|
||||
size?: number;
|
||||
};
|
||||
|
||||
/** The launches that a child made, from the lines of its transcript that name them. */
|
||||
export type NestedLaunches = {
|
||||
/**
|
||||
* The launch calls and their results, each in a message of its own with
|
||||
* only that block. Each has `parent_tool_use_id`: the launch of the child,
|
||||
* as the messages of a child transcript have in the full replay.
|
||||
*/
|
||||
messages: SessionMessage[];
|
||||
/** The task notifications of these launches. */
|
||||
notifications: PersistedTaskNotification[];
|
||||
};
|
||||
|
||||
const NO_LAUNCHES: NestedLaunches = { messages: [], notifications: [] };
|
||||
|
||||
export class SubagentStatus {
|
||||
private readonly tails = new Map<string, ChildTail>();
|
||||
/** The launches of each child that launched children, by its agent id. */
|
||||
private readonly nested = new Map<string, NestedLaunches>();
|
||||
private reported: SubagentStatusEntry[] = [];
|
||||
|
||||
private constructor(readonly history: SubagentHistory) {}
|
||||
|
||||
/** Reads the transcript ends of the children of `history`, and the launches of nested children. */
|
||||
static async read(history: SubagentHistory): Promise<SubagentStatus> {
|
||||
const status = new SubagentStatus(history);
|
||||
const launchers = new Map<string, string[]>();
|
||||
for (const [launchId, record] of history.agents) {
|
||||
if (!record.parentAgentId) continue;
|
||||
launchers.set(record.parentAgentId, [
|
||||
...(launchers.get(record.parentAgentId) ?? []),
|
||||
launchId,
|
||||
]);
|
||||
}
|
||||
await Promise.all([
|
||||
...[...history.agents.values()].map(async ({ agentId }) => {
|
||||
const file = status.file(agentId);
|
||||
const tail = file ? await readTail(file) : undefined;
|
||||
if (tail) status.tails.set(agentId, tail);
|
||||
}),
|
||||
...[...launchers].map(async ([agentId, launchIds]) => {
|
||||
const file = status.file(agentId);
|
||||
if (file) status.nested.set(agentId, await readLaunches(file, launchIds, history));
|
||||
}),
|
||||
]);
|
||||
return status;
|
||||
}
|
||||
|
||||
/** The launches that the child `agentId`, launched by `launchId`, made (see {@link NestedLaunches}). */
|
||||
launches(agentId: string, launchId: string): NestedLaunches {
|
||||
const nested = this.nested.get(agentId);
|
||||
if (!nested) return NO_LAUNCHES;
|
||||
return {
|
||||
...nested,
|
||||
messages: nested.messages.map((message) => ({ ...message, parent_tool_use_id: launchId })),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The entry of a v1 AIR child (`replaySessionHistory` in the v1 agent): its
|
||||
* end, as the full replay's `subagent_state_update` names it, or `running`
|
||||
* or `idle` while it has none. Unlike that update, a background launch's
|
||||
* result is no end: the launch answers at once. A launch without a metadata
|
||||
* file and without an end is `disconnected`, as in that update.
|
||||
*/
|
||||
airEntry(
|
||||
launchId: string,
|
||||
child: {
|
||||
sessionId: string;
|
||||
reconstructable: boolean;
|
||||
terminalState?: SubagentState;
|
||||
notifiedState?: SubagentState;
|
||||
},
|
||||
parentSessionId: string | undefined,
|
||||
): SubagentStatusEntry {
|
||||
const record = this.history.agents.get(launchId);
|
||||
const end = child.reconstructable
|
||||
? (child.notifiedState ??
|
||||
(record?.stoppedByUser ? "cancelled" : undefined) ??
|
||||
(record?.background ? undefined : child.terminalState))
|
||||
: "disconnected";
|
||||
// Without a metadata file there is no transcript to show that the child runs, as in the full replay.
|
||||
return this.entry(
|
||||
child.sessionId,
|
||||
parentSessionId,
|
||||
record,
|
||||
end ?? (record ? this.activity(record) : "disconnected"),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The entries of the announced `children` on the subagents RFD form (v1)
|
||||
* and on v2: the end of each (see `replayEndState`), or `running` or `idle`
|
||||
* while it has none.
|
||||
*/
|
||||
transcriptEntries(children: Iterable<ReplayChild>, rootSessionId: string): SubagentStatusEntry[] {
|
||||
return [...children]
|
||||
.filter((child) => child.announced)
|
||||
.map((child) => {
|
||||
const ended =
|
||||
child.notified ?? (child.record.stoppedByUser ? "cancelled" : child.launchEnd);
|
||||
return this.entry(
|
||||
child.sessionId,
|
||||
child.parentSessionId === rootSessionId ? undefined : child.parentSessionId,
|
||||
child.record,
|
||||
ended ? replayEndState(child) : { state: this.activity(child.record) },
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/** Takes the entries of the replay's announced children. */
|
||||
report(entries: SubagentStatusEntry[]): void {
|
||||
this.reported = entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* The status update of the root session `sessionId`, with the {@link report}ed
|
||||
* entries: `_subagent_status` on v2, which accepts custom variants that start
|
||||
* with `_`, and `session_info_update` with `_meta.sessionRead.subagents` on v1,
|
||||
* whose update variants are closed.
|
||||
*/
|
||||
frame(sessionId: string, protocol: 1 | 2) {
|
||||
return {
|
||||
sessionId,
|
||||
update:
|
||||
protocol === 2
|
||||
? { sessionUpdate: "_subagent_status", subagents: this.reported }
|
||||
: {
|
||||
sessionUpdate: "session_info_update",
|
||||
_meta: { sessionRead: { subagents: this.reported } },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/** `idle` when the child's last turn ended (see `tailOf`). A writer that died stays `running`. */
|
||||
private activity(record: SubagentRecord | undefined): "running" | "idle" {
|
||||
return record && this.tails.get(record.agentId)?.turnEnded ? "idle" : "running";
|
||||
}
|
||||
|
||||
private entry(
|
||||
sessionId: string,
|
||||
parentSessionId: string | undefined,
|
||||
record: SubagentRecord | undefined,
|
||||
state: SubagentStatusEntry["state"],
|
||||
): SubagentStatusEntry {
|
||||
const tail = record && this.tails.get(record.agentId);
|
||||
return {
|
||||
sessionId,
|
||||
...(parentSessionId ? { parentSessionId } : {}),
|
||||
state,
|
||||
...(record?.background ? { background: true } : {}),
|
||||
...(record?.agentType ? { agentType: record.agentType } : {}),
|
||||
...(record?.cwd ? { cwd: record.cwd } : {}),
|
||||
...(tail?.model ? { model: tail.model } : {}),
|
||||
...(tail?.updatedAt ? { updatedAt: tail.updatedAt } : {}),
|
||||
...(tail ? { size: tail.size } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
private file(agentId: string): string | undefined {
|
||||
return this.history.directory && subagentTranscript(this.history.directory, agentId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The end of the transcript `file`, undefined when it is missing. It reads
|
||||
* the last {@link TAIL} bytes, and twice as many each time those do not hold
|
||||
* the records it needs, up to {@link MAX_TAIL}. Past that it reports what it
|
||||
* found: a child without a whole record there is `running`, with no model or
|
||||
* time.
|
||||
*/
|
||||
async function readTail(file: string): Promise<ChildTail | undefined> {
|
||||
let handle;
|
||||
try {
|
||||
handle = await open(file, "r");
|
||||
} catch (error) {
|
||||
if (isMissing(error)) return undefined;
|
||||
throw withPath(error, file);
|
||||
}
|
||||
try {
|
||||
const size = Number((await handle.stat()).size);
|
||||
for (let window = TAIL; ; window *= 2) {
|
||||
const length = Math.min(size, window, MAX_TAIL);
|
||||
const buffer = Buffer.alloc(length);
|
||||
const { bytesRead } = await handle.read(buffer, 0, length, size - length);
|
||||
const lines = buffer.toString("utf8", 0, bytesRead).split("\n");
|
||||
// The first line of a window that starts inside the file is cut.
|
||||
if (length < size) lines.shift();
|
||||
const tail = tailOf(lines);
|
||||
if (tail.done || length === size || length === MAX_TAIL) {
|
||||
return {
|
||||
size,
|
||||
...(tail.model ? { model: tail.model } : {}),
|
||||
...(tail.updatedAt ? { updatedAt: tail.updatedAt } : {}),
|
||||
turnEnded: tail.turnEnded ?? false,
|
||||
};
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
await handle.close();
|
||||
}
|
||||
}
|
||||
|
||||
/** The most bytes that {@link readTail} reads from the end of one transcript. */
|
||||
const MAX_TAIL = 4 * 1024 * 1024;
|
||||
|
||||
type TailRecord = {
|
||||
type?: unknown;
|
||||
timestamp?: unknown;
|
||||
message?: { model?: unknown; stop_reason?: unknown; content?: unknown };
|
||||
};
|
||||
|
||||
const SYNTHETIC_MODEL = "<synthetic>";
|
||||
|
||||
/** Stop reasons after which the model continues the same turn. */
|
||||
const CONTINUING_STOP_REASONS = new Set(["tool_use", "pause_turn"]);
|
||||
|
||||
/**
|
||||
* Whether the assistant `record` ends its turn: a message that no model wrote,
|
||||
* such as an API error, or an answer with any stop reason after which the
|
||||
* model does not continue (`end_turn`, `max_tokens`, `refusal`, ...).
|
||||
*/
|
||||
function endsTurn(record: TailRecord): boolean {
|
||||
if (record.message?.model === SYNTHETIC_MODEL) return true;
|
||||
const reason = record.message?.stop_reason;
|
||||
return typeof reason === "string" && !CONTINUING_STOP_REASONS.has(reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* What the whole `lines` at the end of a transcript say, from the last one
|
||||
* back. `done` when they had all of it. The last turn ended with an
|
||||
* answer that ends it (see `endsTurn`), or with a successful SubagentHandback call whose result
|
||||
* is the last record: the child then waits, as after an answer.
|
||||
*/
|
||||
function tailOf(lines: string[]): Omit<ChildTail, "size" | "turnEnded"> & {
|
||||
turnEnded?: boolean;
|
||||
done: boolean;
|
||||
} {
|
||||
let model: string | undefined;
|
||||
let updatedAt: string | undefined;
|
||||
let turnEnded: boolean | undefined;
|
||||
/** The calls of the results in the last record, while their calls are not found yet. */
|
||||
let pending: Set<string> | undefined;
|
||||
for (let i = lines.length - 1; i >= 0; i--) {
|
||||
const record = parse(lines[i]!) as TailRecord | null;
|
||||
if (!record) continue;
|
||||
if (typeof record.timestamp === "string") updatedAt ??= record.timestamp;
|
||||
const content = Array.isArray(record.message?.content)
|
||||
? (record.message.content as { type?: unknown; id?: unknown; name?: unknown }[])
|
||||
: [];
|
||||
if (record.type === "assistant") {
|
||||
const recordModel = record.message?.model;
|
||||
// `<synthetic>` marks a message that no model wrote, such as an API error.
|
||||
if (typeof recordModel === "string" && recordModel !== SYNTHETIC_MODEL) model ??= recordModel;
|
||||
if (pending) {
|
||||
for (const block of content) {
|
||||
if (block?.type !== "tool_use" || !pending.has(block.id as string)) continue;
|
||||
if (block.name !== HANDBACK_TOOL) turnEnded = false;
|
||||
pending.delete(block.id as string);
|
||||
}
|
||||
if (pending.size === 0) {
|
||||
turnEnded ??= true;
|
||||
pending = undefined;
|
||||
}
|
||||
} else {
|
||||
turnEnded ??= endsTurn(record);
|
||||
}
|
||||
} else if (record.type === "user") {
|
||||
if (turnEnded === undefined && !pending) {
|
||||
pending = handbackResults(content);
|
||||
if (!pending) turnEnded = false;
|
||||
} else if (pending) {
|
||||
// Another user record before the calls: not a hand-back alone.
|
||||
turnEnded = false;
|
||||
pending = undefined;
|
||||
}
|
||||
}
|
||||
if (model !== undefined && turnEnded !== undefined) break;
|
||||
}
|
||||
return {
|
||||
...(model ? { model } : {}),
|
||||
...(updatedAt ? { updatedAt } : {}),
|
||||
...(turnEnded !== undefined ? { turnEnded } : {}),
|
||||
done: model !== undefined && turnEnded !== undefined,
|
||||
};
|
||||
}
|
||||
|
||||
/** The calls of the successful results in `content`, when it has only results; else undefined. */
|
||||
function handbackResults(content: { type?: unknown }[]): Set<string> | undefined {
|
||||
if (content.length === 0) return undefined;
|
||||
const ids = new Set<string>();
|
||||
for (const block of content as { type?: unknown; tool_use_id?: unknown; is_error?: unknown }[]) {
|
||||
if (block?.type !== "tool_result" || block.is_error === true) return undefined;
|
||||
if (typeof block.tool_use_id !== "string") return undefined;
|
||||
ids.add(block.tool_use_id);
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* The lines of one transcript that name launches, from earlier status reads.
|
||||
* Only their places are kept, so a later read scans only the appended bytes.
|
||||
*/
|
||||
type LaunchScan = {
|
||||
/** The device and inode of the file. */
|
||||
identity: string;
|
||||
/** The launches that the scan looks for. */
|
||||
launches: string;
|
||||
/** The bytes scanned: up to the end of the last whole line. */
|
||||
scanned: number;
|
||||
/** The start and the end (the newline) of each line that names a launch, in file order. */
|
||||
lines: [start: number, end: number][];
|
||||
};
|
||||
|
||||
/** The scans by transcript, the most recent last. */
|
||||
const launchScans = new Map<string, LaunchScan>();
|
||||
const MAX_LAUNCH_SCANS = 256;
|
||||
|
||||
/** The bytes that launch scans read as new, for tests. */
|
||||
export const launchScanStats = { bytes: 0 };
|
||||
|
||||
/**
|
||||
* The launch calls `launchIds`, their results and their task notifications
|
||||
* in the transcript `file` (see {@link NestedLaunches}). The file is searched
|
||||
* as bytes; only the lines that name a launch are parsed. A scan of an
|
||||
* earlier read is continued from where it ended, while the file has the same
|
||||
* identity and did not shrink.
|
||||
*/
|
||||
async function readLaunches(
|
||||
file: string,
|
||||
launchIds: string[],
|
||||
history: SubagentHistory,
|
||||
): Promise<NestedLaunches> {
|
||||
let handle;
|
||||
try {
|
||||
handle = await open(file, "r");
|
||||
} catch (error) {
|
||||
launchScans.delete(file);
|
||||
if (isMissing(error)) return NO_LAUNCHES;
|
||||
throw withPath(error, file);
|
||||
}
|
||||
let found: string[];
|
||||
try {
|
||||
found = await scanLaunches(handle, file, launchIds);
|
||||
} catch (error) {
|
||||
throw withPath(error, file);
|
||||
} finally {
|
||||
await handle.close();
|
||||
}
|
||||
const agentIds = new Set(launchIds.map((id) => history.agents.get(id)?.agentId));
|
||||
const messages: SessionMessage[] = [];
|
||||
const notifications: PersistedTaskNotification[] = [];
|
||||
for (const line of found) {
|
||||
const record = parse(line) as {
|
||||
type?: unknown;
|
||||
uuid?: unknown;
|
||||
message?: { content?: unknown };
|
||||
attachment?: { type?: unknown; prompt?: unknown };
|
||||
} | null;
|
||||
if (record?.type === "attachment" && record.attachment?.type === "queued_command") {
|
||||
// A notification queued while the child worked; the SDK turns it into a user message.
|
||||
notifications.push(...taskNotificationsOf(record.attachment.prompt));
|
||||
continue;
|
||||
}
|
||||
if (record?.type !== "assistant" && record?.type !== "user") continue;
|
||||
const content = record.message?.content;
|
||||
if (record.type === "user") notifications.push(...taskNotificationsOf(content));
|
||||
if (!Array.isArray(content)) continue;
|
||||
for (const block of content) {
|
||||
const launch =
|
||||
record.type === "assistant"
|
||||
? block?.type === "tool_use" && launchIds.includes(block.id)
|
||||
: block?.type === "tool_result" && launchIds.includes(block.tool_use_id);
|
||||
if (!launch) continue;
|
||||
messages.push({
|
||||
type: record.type,
|
||||
uuid: typeof record.uuid === "string" ? record.uuid : "",
|
||||
session_id: "",
|
||||
parent_tool_use_id: null,
|
||||
message: { role: record.type, content: [block] },
|
||||
} as SessionMessage);
|
||||
}
|
||||
}
|
||||
return {
|
||||
messages,
|
||||
notifications: notifications.filter(
|
||||
(notification) =>
|
||||
launchIds.includes(notification.tool_use_id ?? "") || agentIds.has(notification.task_id),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
/** The lines of the open transcript `file` that name the launches `launchIds`, in file order. */
|
||||
async function scanLaunches(
|
||||
handle: FileHandle,
|
||||
file: string,
|
||||
launchIds: string[],
|
||||
): Promise<string[]> {
|
||||
const stats = await handle.stat({ bigint: true });
|
||||
const identity = `${stats.dev}:${stats.ino}`;
|
||||
const size = Number(stats.size);
|
||||
const launches = [...launchIds].sort().join(",");
|
||||
let scan = launchScans.get(file);
|
||||
if (!scan || scan.identity !== identity || scan.launches !== launches || scan.scanned > size) {
|
||||
scan = { identity, launches, scanned: 0, lines: [] };
|
||||
}
|
||||
// The lines found before, each still a whole line, else the file was rewritten.
|
||||
const known: string[] = [];
|
||||
for (const [start, end] of scan.lines) {
|
||||
const from = Math.max(start - 1, 0);
|
||||
const buffer = Buffer.alloc(end + 1 - from);
|
||||
const { bytesRead } = await handle.read(buffer, 0, buffer.length, from);
|
||||
if (
|
||||
bytesRead !== buffer.length ||
|
||||
buffer[bytesRead - 1] !== 10 ||
|
||||
(start > 0 && buffer[0] !== 10)
|
||||
) {
|
||||
launchScans.delete(file);
|
||||
return scanLaunches(handle, file, launchIds);
|
||||
}
|
||||
known.push(buffer.toString("utf8", start - from, bytesRead - 1));
|
||||
}
|
||||
const read = Buffer.alloc(size - scan.scanned);
|
||||
const { bytesRead } = await handle.read(read, 0, read.length, scan.scanned);
|
||||
launchScanStats.bytes += bytesRead;
|
||||
// Only whole lines: a line still being written is scanned once it ends.
|
||||
const buffer = read.subarray(0, read.subarray(0, bytesRead).lastIndexOf(10) + 1);
|
||||
// By line start, so a line that names two launches is read once.
|
||||
const lines = new Map<number, number>();
|
||||
const collect = (needle: string) => {
|
||||
for (let at = buffer.indexOf(needle); at >= 0;) {
|
||||
const start = buffer.lastIndexOf(10, at) + 1;
|
||||
const end = buffer.indexOf(10, at);
|
||||
lines.set(start, end);
|
||||
at = buffer.indexOf(needle, end);
|
||||
}
|
||||
};
|
||||
for (const id of launchIds) {
|
||||
collect(`"id":"${id}"`);
|
||||
collect(`"tool_use_id":"${id}"`);
|
||||
}
|
||||
collect(`<task-notification>`);
|
||||
const added = [...lines].sort(([a], [b]) => a - b);
|
||||
launchScans.delete(file);
|
||||
launchScans.set(file, {
|
||||
...scan,
|
||||
scanned: scan.scanned + buffer.length,
|
||||
lines: [
|
||||
...scan.lines,
|
||||
...added.map(([start, end]): [number, number] => [scan.scanned + start, scan.scanned + end]),
|
||||
],
|
||||
});
|
||||
if (launchScans.size > MAX_LAUNCH_SCANS) launchScans.delete(launchScans.keys().next().value!);
|
||||
return [...known, ...added.map(([start, end]) => buffer.toString("utf8", start, end))];
|
||||
}
|
||||
|
||||
function parse(line: string): unknown {
|
||||
try {
|
||||
return JSON.parse(line);
|
||||
} catch {
|
||||
// A line cut by a concurrent write, or by the start of a window.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"initialize","payload":{"_meta":{"jetbrains":{"air":{"capabilities":["sessionFailure","agentFileChangeReport","nativeSubagentSessions","asyncTasks","customInstructions","recommendedValue","diffPatch","planFile","backgroundSubagents"],"goal":{"actions":["set","clear"],"controlMethod":"_session/goal","version":1},"version":1}},"sessionRead":{"supported":true},"steering":{"supported":true}},"agentCapabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"logout":{},"status":{}},"loadSession":true,"mcpCapabilities":{"acp":true,"http":true,"sse":true},"promptCapabilities":{"embeddedContext":true,"image":true},"providers":{},"sessionCapabilities":{"additionalDirectories":{},"close":{},"delete":{},"fork":{},"list":{},"options":{},"resume":{},"status":{},"subagents":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"agentInfo":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"authMethods":[],"protocolVersion":1}}
|
||||
{"kind":"initialize","payload":{"_meta":{"jetbrains":{"air":{"capabilities":["sessionFailure","agentFileChangeReport","nativeSubagentSessions","asyncTasks","customInstructions","recommendedValue","diffPatch","planFile","backgroundSubagents"],"goal":{"actions":["set","clear"],"controlMethod":"_session/goal","version":1},"version":1}},"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true},"steering":{"supported":true}},"agentCapabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"logout":{},"status":{}},"loadSession":true,"mcpCapabilities":{"acp":true,"http":true,"sse":true},"promptCapabilities":{"embeddedContext":true,"image":true},"providers":{},"sessionCapabilities":{"additionalDirectories":{},"close":{},"delete":{},"fork":{},"list":{},"options":{},"resume":{},"status":{},"subagents":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"agentInfo":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"authMethods":[],"protocolVersion":1}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":{"text":"Fix the bug","type":"text"},"messageId":"00000000-0000-4000-8000-00000000c001","sessionUpdate":"user_message_chunk"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":{"text":"Check the file.","type":"text"},"messageId":"msg_r1","sessionUpdate":"agent_thought_chunk"}}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"content":{"text":"I will edit it.","type":"text"},"messageId":"msg_r1","sessionUpdate":"agent_message_chunk"}}}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{"kind":"initialize","payload":{"_meta":{"jetbrains":{"air":{"capabilities":["sessionFailure","agentFileChangeReport","nativeSubagentSessions","asyncTasks","customInstructions","recommendedValue","diffPatch","planFile","backgroundSubagents"],"goal":{"actions":["set","clear"],"controlMethod":"_session/goal","version":1},"version":1}},"sessionRead":{"supported":true},"steering":{"supported":true}},"agentCapabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"logout":{},"status":{}},"loadSession":true,"mcpCapabilities":{"acp":true,"http":true,"sse":true},"promptCapabilities":{"embeddedContext":true,"image":true},"providers":{},"sessionCapabilities":{"additionalDirectories":{},"close":{},"delete":{},"fork":{},"list":{},"options":{},"resume":{},"status":{},"subagents":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"agentInfo":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"authMethods":[],"protocolVersion":1}}
|
||||
{"kind":"initialize","payload":{"_meta":{"jetbrains":{"air":{"capabilities":["sessionFailure","agentFileChangeReport","nativeSubagentSessions","asyncTasks","customInstructions","recommendedValue","diffPatch","planFile","backgroundSubagents"],"goal":{"actions":["set","clear"],"controlMethod":"_session/goal","version":1},"version":1}},"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true},"steering":{"supported":true}},"agentCapabilities":{"_meta":{"authStatus":{},"claudeCode":{"promptQueueing":true}},"auth":{"logout":{},"status":{}},"loadSession":true,"mcpCapabilities":{"acp":true,"http":true,"sse":true},"promptCapabilities":{"embeddedContext":true,"image":true},"providers":{},"sessionCapabilities":{"additionalDirectories":{},"close":{},"delete":{},"fork":{},"list":{},"options":{},"resume":{},"status":{},"subagents":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"agentInfo":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"authMethods":[],"protocolVersion":1}}
|
||||
{"kind":"newSession","payload":{"configOptions":[{"category":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","id":"model","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","currentValue":"auto","description":"Session permission mode","id":"mode","name":"Mode","options":[{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Always ask before making changes","name":"Manual","value":"default"},{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"_meta":{"jetbrains":{"air":{"kind":"plan","version":1}}},"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"_meta":{"jetbrains":{"air":{"kind":"auto_review","version":1}}},"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"_meta":{"jetbrains":{"air":{"kind":"full_access","version":1}}},"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"modes":{"availableModes":[{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Always ask before making changes","id":"default","name":"Manual"},{"_meta":{"jetbrains":{"air":{"kind":"standard","version":1}}},"description":"Automatically accept all file edits","id":"acceptEdits","name":"Accept edits"},{"_meta":{"jetbrains":{"air":{"kind":"plan","version":1}}},"description":"Create a plan before making changes","id":"plan","name":"Plan"},{"_meta":{"jetbrains":{"air":{"kind":"auto_review","version":1}}},"description":"Claude handles permission decisions","id":"auto","name":"Auto"},{"_meta":{"jetbrains":{"air":{"kind":"full_access","version":1}}},"description":"Accepts all permissions","id":"bypassPermissions","name":"Bypass permissions"}],"currentModeId":"auto"},"sessionId":"<session>"}}
|
||||
{"kind":"sessionUpdate","payload":{"sessionId":"<session>","update":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]"},"name":"mcp"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …"},"name":"plugin"}],"sessionUpdate":"available_commands_update"}}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"/goal Ship the feature","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[],"messageId":"00000000-0000-4000-8000-00000000c001","sessionUpdate":"user_message"}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":{"text":"Fix the bug","type":"text"},"messageId":"00000000-0000-4000-8000-00000000c001","sessionUpdate":"user_message_chunk"}}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[],"messageId":"msg_r1","sessionUpdate":"agent_thought"}}}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"initialize","payload":{"_meta":{"sessionRead":{"filters":{"subagents":{}},"subagents":{},"supported":true}},"authMethods":[],"capabilities":{"_meta":{"authStatus":{}},"auth":{"status":{}},"providers":{},"session":{"additionalDirectories":{},"delete":{},"fork":{},"mcp":{"acp":{},"http":{},"stdio":{}},"options":{},"prompt":{"embeddedContext":{},"image":{}},"status":{},"systemPrompt":{"mode":{"override":{}}},"title":{}}},"info":{"name":"@agentclientprotocol/claude-agent-acp","title":"Claude Agent","version":"<version>"},"protocolVersion":2}}
|
||||
{"kind":"response","method":"session/new","payload":{"availableCommands":[{"description":"Show the MCP servers and their status, or reconnect, enable, or disable a server","input":{"hint":"[reconnect|enable|disable [<server>|all]]","type":"text"},"name":"mcp","type":"command"},{"description":"Manage Claude Code plugins and marketplaces","input":{"hint":"[install|uninstall|enable|disable|update|list|marketplace …] …","type":"text"},"name":"plugin","type":"command"}],"configOptions":[{"category":"model","configId":"model","currentValue":"claude-sonnet-4-6","description":"AI model to use","name":"Model","options":[{"description":"Fast","name":"Claude Sonnet 4.6","value":"claude-sonnet-4-6"}],"type":"select"},{"category":"mode","configId":"mode","currentValue":"auto","description":"Session permission mode","name":"Mode","options":[{"description":"Always ask before making changes","name":"Manual","value":"default"},{"description":"Automatically accept all file edits","name":"Accept edits","value":"acceptEdits"},{"description":"Create a plan before making changes","name":"Plan","value":"plan"},{"description":"Claude handles permission decisions","name":"Auto","value":"auto"},{"description":"Accepts all permissions","name":"Bypass permissions","value":"bypassPermissions"}],"type":"select"}],"sessionId":"<session>"}}
|
||||
{"kind":"notification","method":"session/update","payload":{"sessionId":"<session>","update":{"content":[{"text":"prompt 1","type":"text"}],"messageId":"<id-1>","sessionUpdate":"user_message"}}}
|
||||
{"kind":"response","method":"session/prompt","payload":{"messageId":"<id-1>"}}
|
||||
|
||||
@@ -12,6 +12,7 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
import {
|
||||
findTranscript,
|
||||
loadFullSessionHistory,
|
||||
readHistoryAcrossCompactions,
|
||||
readResumedTail,
|
||||
readTranscriptEntries,
|
||||
@@ -409,6 +410,102 @@ describe("readHistoryAcrossCompactions", () => {
|
||||
expect(error).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
describe("a boundary whose logicalParentUuid is not in the transcript", () => {
|
||||
// Claude Code 2.1.332 can name a record that it never wrote. The preserved
|
||||
// messages of the compaction then end at the last message before the
|
||||
// boundary, as in this record of a real transcript.
|
||||
type Kept = { segmentTail?: string; keptTail?: string };
|
||||
const records = (b2: string, { segmentTail, keptTail }: Kept) => [
|
||||
user("u1", "hi"),
|
||||
assistant("a1", "Hello"),
|
||||
boundary("b1", "a1"),
|
||||
summary("s1"),
|
||||
user("u2", "next"),
|
||||
assistant("a2", "Next"),
|
||||
user("u2b", "go on"),
|
||||
boundary(b2, "gone", {
|
||||
...(segmentTail
|
||||
? { preservedSegment: { headUuid: "a2", anchorUuid: "s2", tailUuid: segmentTail } }
|
||||
: {}),
|
||||
...(keptTail
|
||||
? {
|
||||
preservedMessages: {
|
||||
anchorUuid: "s2",
|
||||
uuids: ["a2", keptTail],
|
||||
allUuids: ["a2", keptTail, "gone"],
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
}),
|
||||
summary("s2"),
|
||||
user("u3", "identify yourself"),
|
||||
assistant("a3", "Claude"),
|
||||
];
|
||||
const full = [
|
||||
"hi",
|
||||
"Hello",
|
||||
"Summary s1",
|
||||
"next",
|
||||
"Next",
|
||||
"go on",
|
||||
"Summary s2",
|
||||
"identify yourself",
|
||||
"Claude",
|
||||
];
|
||||
const cut = ["Summary s2", "identify yourself", "Claude"];
|
||||
const logger = () => ({ log: vi.fn(), error: vi.fn(), warn: vi.fn() });
|
||||
type Log = Parameters<typeof readHistoryAcrossCompactions>[2];
|
||||
const read = async (kept: Kept, log: Log, given = false) => {
|
||||
const b2 = crypto.randomUUID();
|
||||
await transcript(records(b2, kept));
|
||||
const chain = await getSessionMessages(sessionId);
|
||||
const snapshot = given ? await loadFullSessionHistory(sessionId) : undefined;
|
||||
return {
|
||||
b2,
|
||||
texts: texts(
|
||||
await readHistoryAcrossCompactions(sessionId, chain, log, undefined, snapshot),
|
||||
),
|
||||
};
|
||||
};
|
||||
|
||||
it.each([false, true])("links it to the preserved tail (records given: %s)", async (given) => {
|
||||
const log = logger();
|
||||
expect((await read({ segmentTail: "u2b", keptTail: "u2b" }, log, given)).texts).toEqual(full);
|
||||
expect(log.warn).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("links it to the last preserved message without a preserved segment", async () => {
|
||||
const log = logger();
|
||||
expect((await read({ keptTail: "u2b" }, log)).texts).toEqual(full);
|
||||
expect(log.warn).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it.each([
|
||||
["without a preserved tail", {}],
|
||||
[
|
||||
"when the preserved tail is not in the transcript either",
|
||||
{ segmentTail: "lost", keptTail: "lost" },
|
||||
],
|
||||
])("starts the history at it and warns once %s", async (_, kept: Kept) => {
|
||||
const log = logger();
|
||||
const { b2, texts } = await read(kept, log);
|
||||
expect(texts).toEqual(cut);
|
||||
expect(log.warn).toHaveBeenCalledOnce();
|
||||
expect(log.warn).toHaveBeenCalledWith(expect.stringContaining(b2));
|
||||
|
||||
const chain = await getSessionMessages(sessionId);
|
||||
await readHistoryAcrossCompactions(sessionId, chain, log);
|
||||
expect(log.warn).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("reports the cut as an error to a logger without warn", async () => {
|
||||
const log = { log: vi.fn(), error: vi.fn() };
|
||||
const { b2, texts } = await read({}, log);
|
||||
expect(texts).toEqual(cut);
|
||||
expect(log.error).toHaveBeenCalledWith(expect.stringContaining(b2));
|
||||
});
|
||||
});
|
||||
|
||||
it("reads the transcript in the project directory it is given", async () => {
|
||||
await transcript(
|
||||
[
|
||||
|
||||
1222
src/tests/session-read-subagents.test.ts
Normal file
1222
src/tests/session-read-subagents.test.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,8 @@ import { writeRewindPoint } from "../session-rewind.js";
|
||||
import {
|
||||
parallelToolCallRecords,
|
||||
transcriptAssistant,
|
||||
transcriptCompactBoundary,
|
||||
transcriptCompactSummary,
|
||||
transcriptUser,
|
||||
writeTranscript,
|
||||
} from "./helpers.js";
|
||||
@@ -175,6 +177,33 @@ describe("session read cursors", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it("warns on the console about a compaction boundary that cuts the history", async () => {
|
||||
const sessionId = randomUUID();
|
||||
const dir = await mkdtemp(path.join(tmpdir(), "claude-acp-read-cut-boundary-"));
|
||||
const project = path.join(dir, "projects", "-project");
|
||||
vi.stubEnv("CLAUDE_CONFIG_DIR", dir);
|
||||
const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||
try {
|
||||
await writeTranscript(project, sessionId, [
|
||||
{ cwd: dir, ...transcriptUser("u1", "One") },
|
||||
{ cwd: dir, ...transcriptAssistant("a1", "Answer one") },
|
||||
{ cwd: dir, ...transcriptCompactBoundary("b1", "a1") },
|
||||
{ cwd: dir, ...transcriptCompactSummary("s1") },
|
||||
{ cwd: dir, ...transcriptUser("u2", "Two") },
|
||||
{ cwd: dir, ...transcriptCompactBoundary("b2", "gone") },
|
||||
{ cwd: dir, ...transcriptCompactSummary("s2") },
|
||||
{ cwd: dir, ...transcriptUser("u3", "Three") },
|
||||
]);
|
||||
const { messages } = await readSessionTranscript(sessionId);
|
||||
expect(messages.map((message) => message.uuid)).toEqual(["s2", "u3"]);
|
||||
expect(warn).toHaveBeenCalledWith(expect.stringContaining("b2"));
|
||||
} finally {
|
||||
warn.mockRestore();
|
||||
vi.unstubAllEnvs();
|
||||
await rm(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it.each(["results", "third call", "streamed call", "skill text"] as const)(
|
||||
"reads each record of parallel tool calls of the root in file order: %s",
|
||||
async (variant) => {
|
||||
|
||||
@@ -745,6 +745,47 @@ describe("a pending rewind point", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("a rewind point before a boundary whose logicalParentUuid is not in the transcript", () => {
|
||||
// Claude Code 2.1.332 can name a record that it never wrote. The preserved
|
||||
// tail of the compaction then carries the chain on.
|
||||
const point = { resumeSessionAt: "a1", droppedPromptUuid: "u2" };
|
||||
|
||||
beforeEach(async () => {
|
||||
await writeTranscript(projectDir(), SESSION_ID, [
|
||||
transcriptUser("u1", "first"),
|
||||
transcriptAssistant("a1", "one"),
|
||||
transcriptUser("u2", "second"),
|
||||
transcriptAssistant("a2", "two"),
|
||||
transcriptCompactBoundary("b1", "gone", {
|
||||
preservedSegment: { headUuid: "u2", anchorUuid: "s1", tailUuid: "a2" },
|
||||
preservedMessages: {
|
||||
anchorUuid: "s1",
|
||||
uuids: ["u2", "a2"],
|
||||
allUuids: ["u2", "a2", "gone"],
|
||||
},
|
||||
}),
|
||||
transcriptCompactSummary("s1"),
|
||||
transcriptUser("u3", "third"),
|
||||
transcriptAssistant("a3", "three"),
|
||||
]);
|
||||
await writeRewindPoint(SESSION_ID, point);
|
||||
});
|
||||
|
||||
it("drops the records after the boundary with the dropped prompt", async () => {
|
||||
const full = await loadFullSessionHistory(SESSION_ID);
|
||||
expect(
|
||||
(await withoutRewoundBranch(SESSION_ID, full)).flatMap((entry) =>
|
||||
typeof entry.uuid === "string" ? [entry.uuid] : [],
|
||||
),
|
||||
).toEqual(["u1", "a1"]);
|
||||
});
|
||||
|
||||
it("keeps the point pending for a resume", async () => {
|
||||
expect(await prepareRewoundResume(SESSION_ID)).toBe("a1");
|
||||
expect(await readRewindPoint(SESSION_ID)).toEqual(point);
|
||||
});
|
||||
});
|
||||
|
||||
describe("rewind read of a resolved transcript", () => {
|
||||
it("reports an unreadable rewind file instead of showing the dropped branch", async () => {
|
||||
const dir = await mkdtemp(path.join(os.tmpdir(), "claude-acp-strict-rewind-"));
|
||||
|
||||
@@ -607,7 +607,7 @@ describe.skipIf(baselineDir)("ACP scenarios", () => {
|
||||
goal: expect.objectContaining({ version: 1 }),
|
||||
},
|
||||
},
|
||||
sessionRead: { supported: true },
|
||||
sessionRead: { supported: true, subagents: {}, filters: { subagents: {} } },
|
||||
steering: { supported: true },
|
||||
});
|
||||
const session = air("session-setup").find((record) => record.kind === "newSession")!
|
||||
|
||||
@@ -1141,7 +1141,11 @@ describe("ACP v2 sessions", () => {
|
||||
|
||||
await client.app.connectWith(stream, async (agent) => {
|
||||
const initialized = await initializeV2(agent);
|
||||
expect(initialized._meta?.sessionRead).toEqual({ supported: true });
|
||||
expect(initialized._meta?.sessionRead).toEqual({
|
||||
supported: true,
|
||||
subagents: {},
|
||||
filters: { subagents: {} },
|
||||
});
|
||||
const { cursorId } = await read(agent, sessionId, { type: "start" });
|
||||
expect(cursorId).toEqual(expect.any(String));
|
||||
expect(client.sessionUpdates.slice(-5)).toMatchObject([
|
||||
@@ -1182,6 +1186,27 @@ describe("ACP v2 sessions", () => {
|
||||
agent.request(v2.methods.agent.session.status, { sessionId: childId }),
|
||||
).rejects.toMatchObject({ code: -32002 });
|
||||
|
||||
// The custom `_subagent_status` variant reaches the client through the v2 SDK.
|
||||
client.sessionUpdates.length = 0;
|
||||
await agent.request("_session/read", {
|
||||
sessionId,
|
||||
replayFrom: { type: "start" },
|
||||
filters: { subagents: "status" },
|
||||
});
|
||||
expect(client.sessionUpdates).toContainEqual({
|
||||
sessionId,
|
||||
update: {
|
||||
sessionUpdate: "_subagent_status",
|
||||
subagents: [
|
||||
expect.objectContaining({
|
||||
sessionId: childId,
|
||||
agentType: "Explore",
|
||||
size: expect.any(Number),
|
||||
}),
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
child.push(
|
||||
transcriptRecord(sessionId, randomUUID(), childReply, {
|
||||
id: "msg_append",
|
||||
|
||||
@@ -234,7 +234,11 @@ import {
|
||||
promptGetsCursor,
|
||||
withRewindCapability,
|
||||
} from "../session-cursors.js";
|
||||
import { SESSION_READ_CAPABILITY, SESSION_READ_METHOD } from "../session-read.js";
|
||||
import {
|
||||
SESSION_READ_CAPABILITY,
|
||||
SESSION_READ_METHOD,
|
||||
SESSION_READ_SUBAGENTS_CAPABILITY,
|
||||
} from "../session-read.js";
|
||||
import {
|
||||
cutAtRewindPoint,
|
||||
loadRewindableHistory,
|
||||
@@ -2029,7 +2033,10 @@ export class ClaudeAcpAgent {
|
||||
// Only AIR gets the AIR capabilities and the goal capability, under
|
||||
// `jetbrains.air`.
|
||||
_meta: {
|
||||
sessionRead: SESSION_READ_CAPABILITY,
|
||||
// The status and child reads need native subagent sessions.
|
||||
sessionRead: subagentForm(this.clientCapabilities)
|
||||
? SESSION_READ_SUBAGENTS_CAPABILITY
|
||||
: SESSION_READ_CAPABILITY,
|
||||
...(this.toolCallCapabilities.air.client
|
||||
? withAirMeta(
|
||||
airSessionFailureCapabilityMeta(
|
||||
@@ -2364,6 +2371,7 @@ export class ClaudeAcpAgent {
|
||||
return this.sessionReads.read(params, {
|
||||
capabilities: this.clientCapabilities,
|
||||
airClient: this.toolCallCapabilities.air.client,
|
||||
subagentForm: subagentForm(this.clientCapabilities),
|
||||
signal,
|
||||
isOpen: (sessionId) => Object.hasOwn(this.sessions, sessionId),
|
||||
assertRoot: (sessionId) => this.assertNoChildSession(sessionId, "read"),
|
||||
@@ -8593,14 +8601,24 @@ export class ClaudeAcpAgent {
|
||||
// no model to the list, and each child's model is its id until the load
|
||||
// response refines it (see `publishCurrentSubagentStates`).
|
||||
const replayModels = pending ? undefined : this.subagentModels(sessionId);
|
||||
const readSubagentHistory = () =>
|
||||
const readSubagentHistory = async () =>
|
||||
detached
|
||||
? subagentHistory(sessionId, { strict: true, transcript: detached.transcript })
|
||||
? (detached.child?.history ??
|
||||
detached.subagentStatus?.history ??
|
||||
subagentHistory(sessionId, { strict: true, transcript: detached.transcript }))
|
||||
: subagentHistory(sessionId);
|
||||
const readChildMessages = (agentId: string, history: SubagentHistory, launchId: string) =>
|
||||
detached
|
||||
? readSubagentMessagesOrFail(sessionId, agentId, history, launchId)
|
||||
: readSubagentMessages(sessionId, agentId, history, this.logger);
|
||||
const readChildMessages = async (
|
||||
agentId: string,
|
||||
history: SubagentHistory,
|
||||
launchId: string,
|
||||
): Promise<SessionMessage[]> => {
|
||||
if (!detached) return readSubagentMessages(sessionId, agentId, history, this.logger);
|
||||
// A child read leaves out the transcripts of the other children.
|
||||
if (detached.child && !detached.child.expand(agentId)) return [];
|
||||
const read = await readSubagentMessagesOrFail(sessionId, agentId, history, launchId);
|
||||
detached.child?.read(agentId, read);
|
||||
return read;
|
||||
};
|
||||
|
||||
// Registers the Agent and Task launches of `list`, and the terminal state
|
||||
// of each launch from its tool_result.
|
||||
@@ -9002,6 +9020,19 @@ export class ClaudeAcpAgent {
|
||||
const agentId = subagents.agents.get(toolUseId)?.agentId;
|
||||
if (!agentId || replayedSubagents.has(agentId)) continue;
|
||||
replayedSubagents.add(agentId);
|
||||
if (detached?.subagentStatus) {
|
||||
// A status read: the child's launches only (see `SubagentStatus.launches`).
|
||||
const launches = detached.subagentStatus.launches(agentId, toolUseId);
|
||||
registerLaunches(launches.messages);
|
||||
for (const notification of launches.notifications) {
|
||||
await restoreTaskNotification(notification);
|
||||
}
|
||||
// The launch calls announce the nested children, as in a child's history.
|
||||
for (const launch of launches.messages) {
|
||||
if (launch.type === "assistant") await replayMessage(launch);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const childMessages = await readChildMessages(agentId, subagents, toolUseId);
|
||||
registerLaunches(childMessages);
|
||||
airReplay?.scan(childMessages, agentId);
|
||||
@@ -9014,9 +9045,14 @@ export class ClaudeAcpAgent {
|
||||
for (const toolUseId of subagentLaunchIds(content)) {
|
||||
const launched = rfdReplay.childOfLaunch(toolUseId);
|
||||
if (!launched || launched.announced) continue;
|
||||
if (detached?.subagentStatus) {
|
||||
await rfdReplay.announceStatus(launched, detached.subagentStatus);
|
||||
continue;
|
||||
}
|
||||
const childMessages = await readChildMessages(launched.sessionId, rfdHistory, toolUseId);
|
||||
await rfdReplay.announce(launched);
|
||||
rfdReplay.scan(childMessages, launched.sessionId);
|
||||
await rfdReplay.childReplaying(launched, childMessages);
|
||||
for (const childMessage of childMessages) await replayMessage(childMessage, launched);
|
||||
await rfdReplay.childReplayed(launched, childMessages);
|
||||
}
|
||||
@@ -9046,7 +9082,13 @@ export class ClaudeAcpAgent {
|
||||
}
|
||||
detached?.endHistory();
|
||||
if (rfdReplay && !pending?.stopped) {
|
||||
await rfdReplay.finish(clientSupportsNotices(this.clientCapabilities), sessionId);
|
||||
detached?.subagentStatus?.report(rfdReplay.statusEntries(detached.subagentStatus, sessionId));
|
||||
// A status read reports the ends in its status update, outside the cursor.
|
||||
await rfdReplay.finish(
|
||||
clientSupportsNotices(this.clientCapabilities),
|
||||
sessionId,
|
||||
!detached?.subagentStatus,
|
||||
);
|
||||
if (!detached) this.replayedSubagents.set(sessionId, rfdReplay);
|
||||
}
|
||||
|
||||
@@ -9058,11 +9100,24 @@ export class ClaudeAcpAgent {
|
||||
}
|
||||
}
|
||||
if (!detached && childModels.size > 0) this.replayedChildModels.set(sessionId, childModels);
|
||||
const status = detached?.subagentStatus;
|
||||
status?.report(
|
||||
[...replayChildren]
|
||||
.filter(([, child]) => child.announced)
|
||||
.map(([launchId, child]) =>
|
||||
status.airEntry(
|
||||
launchId,
|
||||
child,
|
||||
child.parentToolUseId && replayChildren.get(child.parentToolUseId)?.sessionId,
|
||||
),
|
||||
),
|
||||
);
|
||||
// Claude history persists sidechain messages and Agent/Task tool uses,
|
||||
// but not task_started/task_updated lifecycle frames. Recover terminal
|
||||
// state from the launch tool_result. Missing results and malformed or
|
||||
// orphan lineage use the draft protocol's deterministic disconnected state.
|
||||
for (const child of [...replayChildren.values()].reverse()) {
|
||||
// A status read reports the states in its status update, outside the cursor.
|
||||
for (const child of status ? [] : [...replayChildren.values()].reverse()) {
|
||||
if (!child.announced) continue;
|
||||
const parentSessionId = child.parentToolUseId
|
||||
? (replayChildren.get(child.parentToolUseId)?.sessionId ?? sessionId)
|
||||
|
||||
@@ -2,7 +2,13 @@ import type { ClientCapabilities, SessionNotification } from "@agentclientprotoc
|
||||
import type { SessionMessage } from "@anthropic-ai/claude-agent-sdk";
|
||||
import type { AcpClient } from "../acp-client.js";
|
||||
import type { AcpSessionNotification } from "../acp-subagents.js";
|
||||
import { readSessionTranscript, SessionReads, type SessionReadFrame } from "../session-read.js";
|
||||
import {
|
||||
readSessionTranscript,
|
||||
SessionReads,
|
||||
type SessionReadChild,
|
||||
type SessionReadFrame,
|
||||
} from "../session-read.js";
|
||||
import type { SubagentStatus } from "../subagent-status.js";
|
||||
import { ChangedMetaFilter } from "./tool-calls/changed-meta-filter.js";
|
||||
|
||||
/** A render whose updates are held until the read cursor is validated. */
|
||||
@@ -12,6 +18,10 @@ export type DetachedReplay = {
|
||||
publish: AcpClient["sessionUpdate"];
|
||||
endHistory: () => void;
|
||||
signal: AbortSignal;
|
||||
/** A child read: the replay reads only the transcripts that `child` expands. */
|
||||
child?: SessionReadChild;
|
||||
/** A status read: the replay reads no child transcript and reports each child to it. */
|
||||
subagentStatus?: SubagentStatus;
|
||||
};
|
||||
|
||||
export class V1SessionReads {
|
||||
@@ -31,6 +41,8 @@ export class V1SessionReads {
|
||||
options: {
|
||||
capabilities: ClientCapabilities | undefined;
|
||||
airClient: boolean;
|
||||
/** The subagent form of the client, undefined without native subagent sessions. */
|
||||
subagentForm: "air" | "rfd" | undefined;
|
||||
signal?: AbortSignal;
|
||||
isOpen: (sessionId: string) => boolean;
|
||||
assertRoot: (sessionId: string) => void;
|
||||
@@ -45,11 +57,16 @@ export class V1SessionReads {
|
||||
protocol: 1,
|
||||
capabilities: options.capabilities,
|
||||
cursors: options.capabilities?.session?.cursors != null,
|
||||
subagents: options.subagentForm !== undefined,
|
||||
isOpen: options.isOpen,
|
||||
assertRoot: options.assertRoot,
|
||||
signal,
|
||||
replay: async (sessionId, cwd, observeStorage) => {
|
||||
const transcript = await readSessionTranscript(sessionId, cwd, observeStorage);
|
||||
replay: async (sessionId, cwd, observeStorage, scope) => {
|
||||
const transcript = await readSessionTranscript(sessionId, cwd, observeStorage, scope);
|
||||
const { child, subagentStatus } = transcript;
|
||||
const form = options.subagentForm;
|
||||
// `SessionReads` refuses a child read without native subagent sessions.
|
||||
if (child && !form) throw new Error("A subagent read needs native subagent sessions");
|
||||
signal.throwIfAborted();
|
||||
const frames: SessionReadFrame[] = [];
|
||||
let historyEnd: number | undefined;
|
||||
@@ -79,7 +96,11 @@ export class V1SessionReads {
|
||||
return {
|
||||
frames,
|
||||
cwd: transcript.cwd,
|
||||
storage: transcript.storage,
|
||||
storage: child
|
||||
? child.storage(transcript.transcript, transcript.rewound)
|
||||
: transcript.storage,
|
||||
...(child && form ? { stream: child.streamId(form) } : {}),
|
||||
...(subagentStatus ? { status: subagentStatus.frame(sessionId, 1) } : {}),
|
||||
historyEnd,
|
||||
title: transcript.title === undefined ? undefined : options.clientTitle(transcript.title),
|
||||
};
|
||||
|
||||
@@ -66,7 +66,11 @@ import {
|
||||
import { mergeEffortSettings } from "../session-effort.js";
|
||||
import { configuredSettings, resolveThinkingConfig } from "../session-env.js";
|
||||
import { resolveInitialPermissionMode, startModeUnderPolicy } from "../session-mode.js";
|
||||
import { SESSION_READ_CAPABILITY, SESSION_READ_METHOD, SessionReads } from "../session-read.js";
|
||||
import {
|
||||
SESSION_READ_METHOD,
|
||||
SESSION_READ_SUBAGENTS_CAPABILITY,
|
||||
SessionReads,
|
||||
} from "../session-read.js";
|
||||
import { cutAtRewindPoint, prepareRewoundResume } from "../session-rewind.js";
|
||||
import { sanitizeTitle } from "../session-titles.js";
|
||||
import { renameSession } from "../session-index/rename.js";
|
||||
@@ -393,7 +397,7 @@ class V2Agent implements AgentHandle, SessionConnection {
|
||||
const { authMethods, auth, _meta } = this.auth.initialize(request.capabilities);
|
||||
const airMeta = airInitializeMeta(this.air);
|
||||
return {
|
||||
_meta: { ...airMeta, sessionRead: SESSION_READ_CAPABILITY },
|
||||
_meta: { ...airMeta, sessionRead: SESSION_READ_SUBAGENTS_CAPABILITY },
|
||||
protocolVersion: v2.PROTOCOL_VERSION,
|
||||
info: { name: packageJson.name, title: "Claude Agent", version: packageJson.version },
|
||||
capabilities: {
|
||||
@@ -420,8 +424,9 @@ class V2Agent implements AgentHandle, SessionConnection {
|
||||
signal,
|
||||
isOpen: (sessionId) =>
|
||||
this.sessions.has(sessionId) || this.stopped.has(sessionId) || this.starting.has(sessionId),
|
||||
replay: (sessionId, cwd, observeStorage) =>
|
||||
renderSessionRead(sessionId, cwd, this.logger, capabilities, observeStorage),
|
||||
subagents: true,
|
||||
replay: (sessionId, cwd, observeStorage, scope) =>
|
||||
renderSessionRead(sessionId, cwd, this.logger, capabilities, observeStorage, scope),
|
||||
send: (frame) =>
|
||||
this.ctx.notify(v2.methods.client.session.update, frame as v2.UpdateSessionNotification),
|
||||
});
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import type * as v2 from "@agentclientprotocol/sdk/experimental/v2/unstable";
|
||||
import type { Logger } from "../logger.js";
|
||||
import { readSessionTranscript, type SessionReadFrame } from "../session-read.js";
|
||||
import {
|
||||
readSessionTranscript,
|
||||
type SessionReadFrame,
|
||||
type SessionReadScope,
|
||||
} from "../session-read.js";
|
||||
import { replayEndUpdate } from "./setup.js";
|
||||
import { SessionOutput } from "./stream.js";
|
||||
import { replaySessionHistory, SubagentReplay } from "./subagent-replay.js";
|
||||
@@ -13,12 +17,10 @@ export async function renderSessionRead(
|
||||
logger: Logger,
|
||||
capabilities: v2.ClientCapabilities | null | undefined,
|
||||
observeStorage: boolean,
|
||||
scope: SessionReadScope = {},
|
||||
) {
|
||||
const { messages, cwd, transcript, title, storage } = await readSessionTranscript(
|
||||
sessionId,
|
||||
dir,
|
||||
observeStorage,
|
||||
);
|
||||
const { messages, cwd, transcript, title, storage, child, rewound, subagentStatus } =
|
||||
await readSessionTranscript(sessionId, dir, observeStorage, scope);
|
||||
const frames: SessionReadFrame[] = [];
|
||||
const translator = new V2UpdateTranslator();
|
||||
const send = (notification: v2.UpdateSessionNotification): void => {
|
||||
@@ -35,7 +37,7 @@ export async function renderSessionRead(
|
||||
const subagents = await SubagentReplay.load(
|
||||
{ sessionId, cwd, logger, translator, send },
|
||||
messages,
|
||||
{ transcript },
|
||||
{ transcript, child, status: subagentStatus },
|
||||
);
|
||||
let historyEnd = 0;
|
||||
replaySessionHistory(send, output, messages, subagents, {
|
||||
@@ -47,5 +49,18 @@ export async function renderSessionRead(
|
||||
const end = replayEndUpdate(capabilities);
|
||||
if (end) send({ sessionId, update: end });
|
||||
subagents?.reportMissingHistory();
|
||||
if (child) {
|
||||
return {
|
||||
frames,
|
||||
cwd,
|
||||
historyEnd,
|
||||
storage: child.storage(transcript, rewound),
|
||||
stream: child.streamId("rfd"),
|
||||
};
|
||||
}
|
||||
if (subagentStatus) {
|
||||
subagentStatus.report(subagents?.statusEntries() ?? []);
|
||||
return { frames, cwd, historyEnd, title, storage, status: subagentStatus.frame(sessionId, 2) };
|
||||
}
|
||||
return { frames, cwd, historyEnd, title, storage };
|
||||
}
|
||||
|
||||
@@ -70,10 +70,12 @@ import {
|
||||
missingHistoryNotice,
|
||||
ReplayTranscript,
|
||||
replayEndState,
|
||||
startsWithPrompt,
|
||||
textOf,
|
||||
trackResponseModel,
|
||||
type ReplayChild as SharedReplayChild,
|
||||
} from "../subagent-replay.js";
|
||||
import type { SubagentStatus, SubagentStatusEntry } from "../subagent-status.js";
|
||||
import { taskNotificationsOf } from "../task-notifications.js";
|
||||
import type { V2UpdateTranslator } from "./update-translator.js";
|
||||
import { REPLAY_COMPLETE } from "./setup.js";
|
||||
@@ -136,6 +138,8 @@ export class SubagentReplay {
|
||||
private readonly transcripts: Map<string, SessionMessage[]>,
|
||||
private readonly live: LiveChildren,
|
||||
private readonly detached: boolean,
|
||||
/** A status read: the replay reads no child transcript (see `SubagentStatus`). */
|
||||
private readonly status?: SubagentStatus,
|
||||
) {
|
||||
this.transcript = new ReplayTranscript(history);
|
||||
}
|
||||
@@ -143,6 +147,8 @@ export class SubagentReplay {
|
||||
/**
|
||||
* Reads the subagent history that `messages`, the session's transcript,
|
||||
* launched, with every child's transcript. Undefined when it launched none.
|
||||
* A child read (`child`) reads only the transcripts that it expands, and a
|
||||
* status read (`status`) none.
|
||||
*/
|
||||
static async load(
|
||||
host: ReplayHost,
|
||||
@@ -150,28 +156,61 @@ export class SubagentReplay {
|
||||
{
|
||||
live = NO_LIVE_CHILDREN,
|
||||
transcript: transcriptPath,
|
||||
}: { live?: LiveChildren; transcript?: string } = {},
|
||||
child,
|
||||
status,
|
||||
}: {
|
||||
live?: LiveChildren;
|
||||
transcript?: string;
|
||||
child?: {
|
||||
history: SubagentHistory;
|
||||
expand(agentId: string): boolean;
|
||||
read(agentId: string, messages: SessionMessage[]): void;
|
||||
};
|
||||
status?: SubagentStatus;
|
||||
} = {},
|
||||
): Promise<SubagentReplay | undefined> {
|
||||
if (!messages.some((message) => launchIdsOf(message).length > 0)) return undefined;
|
||||
const history = await subagentHistory(
|
||||
host.sessionId,
|
||||
transcriptPath === undefined ? undefined : { strict: true, transcript: transcriptPath },
|
||||
);
|
||||
const history =
|
||||
child?.history ??
|
||||
status?.history ??
|
||||
(await subagentHistory(
|
||||
host.sessionId,
|
||||
transcriptPath === undefined ? undefined : { strict: true, transcript: transcriptPath },
|
||||
));
|
||||
const transcripts = new Map<string, SessionMessage[]>();
|
||||
const queue = messages.flatMap(launchIdsOf);
|
||||
const queue = status ? [] : messages.flatMap(launchIdsOf);
|
||||
while (queue.length > 0) {
|
||||
const launchId = queue.shift()!;
|
||||
const record = history.agents.get(launchId);
|
||||
if (!record || transcripts.has(record.agentId)) continue;
|
||||
if (child && !child.expand(record.agentId)) {
|
||||
transcripts.set(record.agentId, []);
|
||||
continue;
|
||||
}
|
||||
const transcript = (
|
||||
await (transcriptPath === undefined
|
||||
? readSubagentMessages(host.sessionId, record.agentId, history, host.logger)
|
||||
: readSubagentMessagesOrFail(host.sessionId, record.agentId, history, launchId))
|
||||
).map((message) => ({ ...message, parent_tool_use_id: null }));
|
||||
transcripts.set(record.agentId, transcript);
|
||||
child?.read(record.agentId, transcript);
|
||||
queue.push(...transcript.flatMap(launchIdsOf));
|
||||
}
|
||||
return new SubagentReplay(host, history, transcripts, live, transcriptPath !== undefined);
|
||||
return new SubagentReplay(
|
||||
host,
|
||||
history,
|
||||
transcripts,
|
||||
live,
|
||||
transcriptPath !== undefined,
|
||||
status,
|
||||
);
|
||||
}
|
||||
|
||||
/** A status read: the status of each announced child (see `SubagentStatus.transcriptEntries`). */
|
||||
statusEntries(): SubagentStatusEntry[] {
|
||||
return (
|
||||
this.status?.transcriptEntries(this.transcript.children.values(), this.host.sessionId) ?? []
|
||||
);
|
||||
}
|
||||
|
||||
/** The hooks of the replay of the root session's history (`messages`). */
|
||||
@@ -194,7 +233,8 @@ export class SubagentReplay {
|
||||
*/
|
||||
finish(): void {
|
||||
const announced = [...this.transcript.children.values()].filter((child) => child.announced);
|
||||
for (const child of [...announced].reverse()) {
|
||||
// A status read reports the ends in its status update, outside the cursor.
|
||||
for (const child of this.status ? [] : [...announced].reverse()) {
|
||||
this.host.send({
|
||||
sessionId: child.parentSessionId,
|
||||
update: {
|
||||
@@ -378,14 +418,32 @@ export class SubagentReplay {
|
||||
for (const launchId of launchIdsOf(message)) {
|
||||
const child = this.transcript.children.get(launchId);
|
||||
if (!child || child.announced) continue;
|
||||
if (this.status) {
|
||||
this.announceStatus(child, parent, this.status);
|
||||
continue;
|
||||
}
|
||||
const messages = this.transcripts.get(child.sessionId) ?? [];
|
||||
if (messages.length === 0) this.withoutHistory++;
|
||||
this.announce(child);
|
||||
this.transcript.scan(messages, child.sessionId);
|
||||
// A transcript without its prompt at the start gets the launch's prompt first,
|
||||
// so that new records come after it and a cursor of the child's stream continues.
|
||||
if (!startsWithPrompt(messages)) this.sendLaunchPrompt(child, parent);
|
||||
child.output!.replay(messages, this.ownerHooks(child.output!, child));
|
||||
if (!child.promptSent && typeof child.input.prompt === "string") {
|
||||
this.sendPrompt(child, parent, child.input.prompt);
|
||||
}
|
||||
this.sendLaunchPrompt(child, parent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A status read: announces `child` with the prompt of its launch, then the
|
||||
* children that it launched, from `status` without its transcript.
|
||||
*/
|
||||
private announceStatus(child: ReplayChild, parent: SessionOutput, status: SubagentStatus): void {
|
||||
this.announce(child);
|
||||
this.sendLaunchPrompt(child, parent);
|
||||
const launches = status.launches(child.record.agentId, child.launchId);
|
||||
for (const nested of this.transcript.scanLaunches(launches, child.sessionId)) {
|
||||
if (!nested.announced) this.announceStatus(nested, child.output!, status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,6 +536,13 @@ export class SubagentReplay {
|
||||
]);
|
||||
}
|
||||
|
||||
/** The prompt of `child`'s launch, unless its prompt went out. */
|
||||
private sendLaunchPrompt(child: ReplayChild, parent: SessionOutput): void {
|
||||
if (!child.promptSent && typeof child.input.prompt === "string") {
|
||||
this.sendPrompt(child, parent, child.input.prompt);
|
||||
}
|
||||
}
|
||||
|
||||
private sendPrompt(child: ReplayChild, parent: SessionOutput, text: string): void {
|
||||
child.promptSent = true;
|
||||
const [outgoing, incoming] = linkedSessionMessages(
|
||||
|
||||
Reference in New Issue
Block a user