Add Cursor SDK orchestration replay support

- Wire Cursor adapter and provider session handling into orchestration v2
- Add replay fixtures, recording script, and coverage for Cursor turn flows
- Update docs and debug timeline mapping for Cursor events
This commit is contained in:
Julius Marminge committed 2026-08-15 16:49:00 +02:00
1 parent 4fae73ee08
commit ce64e37094
50 files changed
+7163 -201

No files matched your search

+5
View File
@@ -20,12 +20,17 @@
"build:bundle": "tsdown",
"record:codex-replay": "bun scripts/record-codex-app-server-replay-fixture.ts",
"record:claude-replay": "bun scripts/record-claude-agent-sdk-replay-fixture.ts",
"record:cursor-replay": "node --env-file-if-exists=../../.env --experimental-strip-types scripts/record-cursor-agent-sdk-replay-fixture.ts",
"build:bundle": "vp pack",
"start": "node dist/bin.mjs",
"typecheck": "tsgo --noEmit",
"test": "vp test run"
},
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "^0.3.170",
"@connectrpc/connect": "1.7.0",
"@connectrpc/connect-node": "1.7.0",
"@cursor/sdk": "1.0.19",
"@effect/platform-bun": "catalog:",
"@effect/platform-node": "catalog:",
"@effect/platform-node-shared": "catalog:",
@@ -0,0 +1,222 @@
import * as NodeServices from "@effect/platform-node/NodeServices";
import * as Console from "effect/Console";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";
import * as Schema from "effect/Schema";
import { recordCursorAgentSdkReplayTranscript } from "../src/orchestration-v2/Adapters/CursorAdapterV2.testkit.ts";
import { makeCheckpointWorkspace } from "../src/orchestration-v2/testkit/ReplayFixtureWorkspace.ts";
import {
CURSOR_MODEL_SELECTION,
MESSAGE_STEERING_INITIAL_PROMPT,
MESSAGE_STEERING_STEER_PROMPT,
MULTI_TURN_FIRST_PROMPT,
MULTI_TURN_SECOND_PROMPT,
PROVIDER_THREAD_RESUME_FIRST_PROMPT,
PROVIDER_THREAD_RESUME_SECOND_PROMPT,
PROPOSED_PLAN_PROMPT,
SIMPLE_PROMPT,
SUBAGENT_PROMPT,
TODO_LIST_PROMPT,
TOOL_CALL_READ_ONLY_PROMPT,
TOOL_CALL_READ_ONLY_WORKSPACE_ROOT,
TURN_INTERRUPT_MID_TOOL_PROMPT,
} from "../src/orchestration-v2/testkit/fixtures/shared.ts";
const RECORDINGS = {
simple: {
prompts: [SIMPLE_PROMPT],
output: "../src/orchestration-v2/testkit/fixtures/simple/cursor_transcript.ndjson",
},
multi_turn: {
prompts: [MULTI_TURN_FIRST_PROMPT, MULTI_TURN_SECOND_PROMPT],
output: "../src/orchestration-v2/testkit/fixtures/multi_turn/cursor_transcript.ndjson",
},
message_steering: {
prompts: [MESSAGE_STEERING_INITIAL_PROMPT, MESSAGE_STEERING_STEER_PROMPT],
output: "../src/orchestration-v2/testkit/fixtures/message_steering/cursor_transcript.ndjson",
interruptAfterRunStartPromptIndex: 0,
},
provider_thread_resume: {
prompts: [PROVIDER_THREAD_RESUME_FIRST_PROMPT, PROVIDER_THREAD_RESUME_SECOND_PROMPT],
output:
"../src/orchestration-v2/testkit/fixtures/provider_thread_resume/cursor_transcript.ndjson",
restartBeforePromptIndex: 1,
},
queued_turn: {
prompts: [MULTI_TURN_FIRST_PROMPT, MULTI_TURN_SECOND_PROMPT],
output: "../src/orchestration-v2/testkit/fixtures/queued_turn/cursor_transcript.ndjson",
},
proposed_plan: {
prompts: [PROPOSED_PLAN_PROMPT],
output: "../src/orchestration-v2/testkit/fixtures/proposed_plan/cursor_transcript.ndjson",
interactionMode: "plan",
},
todo_list: {
prompts: [TODO_LIST_PROMPT],
output: "../src/orchestration-v2/testkit/fixtures/todo_list/cursor_transcript.ndjson",
},
subagent: {
prompts: [SUBAGENT_PROMPT],
output: "../src/orchestration-v2/testkit/fixtures/subagent/cursor_transcript.ndjson",
},
tool_call_read_only: {
prompts: [TOOL_CALL_READ_ONLY_PROMPT],
output: "../src/orchestration-v2/testkit/fixtures/tool_call_read_only/cursor_transcript.ndjson",
},
turn_interrupt_mid_tool: {
prompts: [TURN_INTERRUPT_MID_TOOL_PROMPT],
output:
"../src/orchestration-v2/testkit/fixtures/turn_interrupt_mid_tool/cursor_transcript.ndjson",
interruptAfterToolStart: true,
},
} as const;
type RecordingName = keyof typeof RECORDINGS;
const encodeUnknownJsonString = Schema.encodeSync(Schema.fromJsonString(Schema.Unknown));
function readArgValue(name: string): string | undefined {
const index = process.argv.indexOf(name);
return index === -1 ? undefined : process.argv[index + 1];
}
function encodeTranscriptNdjson(
transcript: Awaited<ReturnType<typeof recordCursorAgentSdkReplayTranscript>>,
): string {
const { entries, ...metadata } = transcript;
return [
encodeUnknownJsonString({ type: "transcript_start", ...metadata }),
...entries.map((entry) => encodeUnknownJsonString(entry)),
"",
].join("\n");
}
const runFileSystem = <A, E>(
effect: Effect.Effect<A, E, FileSystem.FileSystem | Path.Path>,
): Promise<A> => Effect.runPromise(effect.pipe(Effect.provide(NodeServices.layer)));
async function prepareWorkspace(scenario: RecordingName): Promise<{
readonly cwd: string;
readonly remove: boolean;
}> {
if (process.env.T3_CURSOR_REPLAY_CWD !== undefined) {
return {
cwd: process.env.T3_CURSOR_REPLAY_CWD,
remove: false,
};
}
if (scenario === "tool_call_read_only") {
await runFileSystem(
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
yield* fs.remove(TOOL_CALL_READ_ONLY_WORKSPACE_ROOT, {
recursive: true,
force: true,
});
yield* fs.makeDirectory(TOOL_CALL_READ_ONLY_WORKSPACE_ROOT, {
recursive: true,
});
}),
);
return {
cwd: TOOL_CALL_READ_ONLY_WORKSPACE_ROOT,
remove: true,
};
}
return {
cwd: await makeCheckpointWorkspace(`cursor-agent-sdk-record-${scenario}`),
remove: true,
};
}
async function writeFixtureFiles(cwd: string): Promise<void> {
await runFileSystem(
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
yield* fs.writeFileString(
path.join(cwd, "package.json"),
encodeUnknownJsonString({
name: "cursor-read-only-fixture",
private: true,
scripts: { typecheck: "tsc --noEmit" },
}),
);
yield* fs.writeFileString(
path.join(cwd, "tsconfig.json"),
encodeUnknownJsonString({
compilerOptions: {
module: "ESNext",
strict: true,
target: "ES2022",
},
}),
);
}),
);
}
const scenario = (readArgValue("--scenario") ?? process.env.T3_CURSOR_REPLAY_SCENARIO) as
| RecordingName
| undefined;
if (scenario === undefined || RECORDINGS[scenario] === undefined) {
throw new Error(`Pass --scenario with one of: ${Object.keys(RECORDINGS).join(", ")}`);
}
const apiKey = process.env.CURSOR_API_KEY?.trim();
if (!apiKey) {
throw new Error("CURSOR_API_KEY is required to record Cursor SDK replay fixtures.");
}
const recording = RECORDINGS[scenario];
const workspace = await prepareWorkspace(scenario);
if (scenario === "subagent" || scenario === "tool_call_read_only" || scenario === "todo_list") {
await writeFixtureFiles(workspace.cwd);
}
const outputPath = readArgValue("--out") ?? new URL(recording.output, import.meta.url).pathname;
try {
const transcript = await recordCursorAgentSdkReplayTranscript({
scenario,
prompts: recording.prompts,
modelSelection: {
...CURSOR_MODEL_SELECTION,
model: process.env.T3_CURSOR_REPLAY_MODEL ?? CURSOR_MODEL_SELECTION.model,
},
cwd: workspace.cwd,
apiKey,
...("interactionMode" in recording ? { interactionMode: recording.interactionMode } : {}),
...("interruptAfterToolStart" in recording
? { interruptAfterToolStart: recording.interruptAfterToolStart }
: {}),
...("interruptAfterRunStartPromptIndex" in recording
? { interruptAfterRunStartPromptIndex: recording.interruptAfterRunStartPromptIndex }
: {}),
...("restartBeforePromptIndex" in recording
? { restartBeforePromptIndex: recording.restartBeforePromptIndex }
: {}),
});
await runFileSystem(
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
yield* fs.makeDirectory(path.dirname(outputPath), { recursive: true });
yield* fs.writeFileString(outputPath, encodeTranscriptNdjson(transcript));
}),
);
await Effect.runPromise(
Console.log(`Wrote ${transcript.entries.length} Cursor SDK replay entries to ${outputPath}`),
);
} finally {
if (workspace.remove) {
await runFileSystem(
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
yield* fs.remove(workspace.cwd, { recursive: true, force: true });
}),
);
}
}
@@ -0,0 +1,171 @@
import { assert, describe, it } from "@effect/vitest";
import { EnvironmentId, ProviderInstanceId, ThreadId } from "@t3tools/contracts";
import * as McpProviderSession from "../../mcp/McpProviderSession.ts";
import {
CursorProviderCapabilitiesV2,
cursorMcpServers,
cursorRuntimeAgentPolicy,
cursorSdkModelSelection,
makeCursorAgentOptions,
} from "./CursorAdapterV2.ts";
import { isCursorCancellationError, loggedCursorAgentOptions } from "./CursorAgentSdk.ts";
describe("CursorAdapterV2", () => {
it("maps Cursor auto and model parameters to SDK selections", () => {
assert.deepEqual(
cursorSdkModelSelection({
instanceId: ProviderInstanceId.make("cursor"),
model: "auto",
options: [
{ id: "thinking", value: "high" },
{ id: "contextWindow", value: "1m" },
{ id: "fastMode", value: true },
],
}),
{
id: "default",
params: [
{ id: "thinking", value: "high" },
{ id: "context", value: "1m" },
{ id: "fast", value: "true" },
],
},
);
});
it("maps runtime modes to the SDK sandbox and auto-review controls", () => {
const base = {
interactionMode: "default" as const,
cwd: "/tmp/cursor-adapter",
};
assert.deepEqual(
cursorRuntimeAgentPolicy({
...base,
runtimeMode: "full-access",
}),
{
autoReview: false,
sandboxEnabled: false,
},
);
assert.deepEqual(
cursorRuntimeAgentPolicy({
...base,
runtimeMode: "auto-accept-edits",
}),
{
autoReview: false,
sandboxEnabled: true,
},
);
assert.deepEqual(
cursorRuntimeAgentPolicy({
...base,
runtimeMode: "approval-required",
}),
{
autoReview: true,
sandboxEnabled: true,
},
);
assert.deepEqual(
cursorRuntimeAgentPolicy({
...base,
runtimeMode: "full-access",
approvalPolicy: "never",
sandboxPolicy: { type: "readOnly" },
}),
{
autoReview: false,
sandboxEnabled: true,
},
);
assert.deepEqual(
cursorRuntimeAgentPolicy({
...base,
runtimeMode: "approval-required",
approvalPolicy: "never",
sandboxPolicy: { type: "dangerFullAccess" },
}),
{
autoReview: false,
sandboxEnabled: false,
},
);
});
it("advertises only capabilities exposed by the official SDK adapter", () => {
assert.isTrue(CursorProviderCapabilitiesV2.threads.canReadThreadSnapshot);
assert.isFalse(CursorProviderCapabilitiesV2.threads.canForkThread);
assert.isFalse(CursorProviderCapabilitiesV2.threads.canRollbackThread);
assert.isTrue(CursorProviderCapabilitiesV2.turns.supportsInterrupt);
assert.isFalse(CursorProviderCapabilitiesV2.turns.supportsActiveSteering);
assert.isTrue(CursorProviderCapabilitiesV2.turns.supportsSteeringByInterruptRestart);
assert.isTrue(CursorProviderCapabilitiesV2.tools.supportsMcpTools);
assert.isTrue(CursorProviderCapabilitiesV2.subagents.supportsSubagents);
assert.isFalse(CursorProviderCapabilitiesV2.subagents.exposesSubagentThreadIds);
assert.equal(CursorProviderCapabilitiesV2.identity.nativeItemIds, "weak");
assert.isFalse(CursorProviderCapabilitiesV2.approvals.supportsCommandApproval);
});
it("injects thread-scoped MCP credentials without logging them", () => {
const threadId = ThreadId.make("thread-cursor-mcp");
McpProviderSession.setMcpProviderSession({
environmentId: EnvironmentId.make("environment-cursor-mcp"),
threadId,
providerSessionId: "mcp-session-cursor",
providerInstanceId: ProviderInstanceId.make("cursor"),
endpoint: "http://127.0.0.1:43123/mcp",
authorizationHeader: "Bearer secret-cursor-mcp-token",
});
try {
assert.deepEqual(cursorMcpServers(threadId), {
"t3-code": {
type: "http",
url: "http://127.0.0.1:43123/mcp",
headers: {
Authorization: "Bearer secret-cursor-mcp-token",
},
},
});
const options = makeCursorAgentOptions({
apiKey: "secret-cursor-api-key",
modelSelection: {
instanceId: ProviderInstanceId.make("cursor"),
model: "composer-2.5",
},
runtimePolicy: {
runtimeMode: "full-access",
interactionMode: "default",
cwd: "/workspace",
},
threadId,
});
assert.deepEqual(options.mcpServers, cursorMcpServers(threadId));
const logged = JSON.stringify(loggedCursorAgentOptions(options));
assert.notInclude(logged, "secret-cursor-api-key");
assert.notInclude(logged, "secret-cursor-mcp-token");
} finally {
McpProviderSession.clearMcpProviderSession(threadId);
}
});
it("recognizes direct and SDK-wrapped abort failures as cancellation", () => {
assert.isTrue(isCursorCancellationError({ name: "AbortError" }));
assert.isTrue(
isCursorCancellationError({
name: "ConnectError",
cause: {
name: "ConnectError",
cause: { name: "AbortError" },
},
}),
);
assert.isFalse(isCursorCancellationError(new Error("request failed")));
assert.isFalse(isCursorCancellationError(null));
});
});
@@ -0,0 +1,985 @@
import { Agent, type InteractionUpdate, type RunResult } from "@cursor/sdk";
import * as NodeServices from "@effect/platform-node/NodeServices";
import {
ProviderReplayEntry,
type ModelSelection,
type ProviderReplayTranscript,
type ThreadId,
} from "@t3tools/contracts";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
import * as Path from "effect/Path";
import * as PlatformError from "effect/PlatformError";
import * as Schema from "effect/Schema";
import { ServerConfig, type ServerConfigShape } from "../../config.ts";
import { layer as idAllocatorLayer } from "../IdAllocator.ts";
import { ProviderAdapterDriverCreateError } from "../ProviderAdapterDriver.ts";
import { makeDriverLayer as makeProviderAdapterRegistryDriverLayer } from "../ProviderAdapterRegistry.ts";
import type { OrchestratorV2ProviderReplayHarness } from "../testkit/ProviderReplayHarness.ts";
import {
CURSOR_AGENT_SDK_PROTOCOL,
CURSOR_PROVIDER,
CursorAgentSdkRunner,
CursorAgentSdkRunnerError,
isCursorCancellationError,
loggedCursorAgentOptions,
loggedCursorSendOptions,
type CursorAgentSdkOpenInput,
type CursorAgentSdkProtocolLogEvent,
type CursorAgentSdkRun,
type CursorAgentSdkRunnerShape,
type CursorAgentSdkSendInput,
type CursorAgentSdkSession,
} from "./CursorAgentSdk.ts";
import {
CURSOR_DEFAULT_INSTANCE_ID,
CURSOR_DRIVER_KIND,
CursorAdapterV2Driver,
cursorSdkModelSelection,
makeCursorAgentOptions,
} from "./CursorAdapterV2.ts";
import type { ProviderAdapterV2RuntimePolicy } from "../ProviderAdapter.ts";
const CursorAgentSdkReplayTranscript = Schema.Struct({
provider: Schema.Literal(CURSOR_PROVIDER),
protocol: Schema.Literal(CURSOR_AGENT_SDK_PROTOCOL),
version: Schema.String,
scenario: Schema.String,
metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
entries: Schema.Array(ProviderReplayEntry),
});
export type CursorAgentSdkReplayTranscript = typeof CursorAgentSdkReplayTranscript.Type;
const decodeCursorAgentSdkReplayTranscript = Schema.decodeUnknownEffect(
CursorAgentSdkReplayTranscript,
);
export class CursorReplayTranscriptDecodeError extends Schema.TaggedErrorClass<CursorReplayTranscriptDecodeError>()(
"CursorReplayTranscriptDecodeError",
{
provider: Schema.optional(Schema.String),
protocol: Schema.optional(Schema.String),
scenario: Schema.optional(Schema.String),
cause: Schema.Defect(),
},
) {
override get message(): string {
return `Failed to decode Cursor Agent SDK replay transcript for scenario ${this.scenario ?? "<unknown>"}.`;
}
}
export class CursorReplayExhaustedError extends Schema.TaggedErrorClass<CursorReplayExhaustedError>()(
"CursorReplayExhaustedError",
{
scenario: Schema.String,
cursor: Schema.Number,
actual: Schema.Unknown,
},
) {
override get message(): string {
return `Cursor Agent SDK replay transcript exhausted at cursor ${this.cursor} in scenario ${this.scenario}.`;
}
}
export class CursorReplayFrameMismatchError extends Schema.TaggedErrorClass<CursorReplayFrameMismatchError>()(
"CursorReplayFrameMismatchError",
{
scenario: Schema.String,
cursor: Schema.Number,
expected: Schema.Unknown,
actual: Schema.Unknown,
},
) {
override get message(): string {
return `Cursor Agent SDK replay frame mismatch at cursor ${this.cursor} in scenario ${this.scenario}.`;
}
}
export class CursorReplayIncompleteError extends Schema.TaggedErrorClass<CursorReplayIncompleteError>()(
"CursorReplayIncompleteError",
{
scenario: Schema.String,
cursor: Schema.Number,
remaining: Schema.Number,
},
) {
override get message(): string {
return `Cursor Agent SDK replay ended with ${this.remaining} unconsumed entries in scenario ${this.scenario}.`;
}
}
export class CursorReplayRuntimeError extends Schema.TaggedErrorClass<CursorReplayRuntimeError>()(
"CursorReplayRuntimeError",
{
scenario: Schema.String,
cursor: Schema.Number,
cause: Schema.Defect(),
},
) {
override get message(): string {
return `Cursor Agent SDK replay failed at cursor ${this.cursor} in scenario ${this.scenario}.`;
}
}
export const CursorAgentSdkReplayError = Schema.Union([
CursorReplayTranscriptDecodeError,
CursorReplayExhaustedError,
CursorReplayFrameMismatchError,
CursorReplayIncompleteError,
CursorReplayRuntimeError,
]);
export type CursorAgentSdkReplayError = typeof CursorAgentSdkReplayError.Type;
const isCursorAgentSdkReplayError = Schema.is(CursorAgentSdkReplayError);
const isCursorAgentSdkRunnerError = Schema.is(CursorAgentSdkRunnerError);
export const CursorOrchestratorReplayHarnessError = Schema.Union([
CursorAgentSdkReplayError,
ProviderAdapterDriverCreateError,
]);
export type CursorOrchestratorReplayHarnessError = typeof CursorOrchestratorReplayHarnessError.Type;
type CursorProtocolPayload = CursorAgentSdkProtocolLogEvent["payload"];
type CursorOutgoingFrame = Extract<
CursorAgentSdkProtocolLogEvent,
{ readonly direction: "outgoing" }
>["payload"];
function stableStringify(value: unknown): string {
if (Array.isArray(value)) {
return `[${value.map(stableStringify).join(",")}]`;
}
if (typeof value === "object" && value !== null) {
const record = value as Record<string, unknown>;
return `{${Object.keys(record)
.toSorted()
.map((key) => `${JSON.stringify(key)}:${stableStringify(record[key])}`)
.join(",")}}`;
}
return JSON.stringify(value);
}
function normalizeContextHandoffText(value: string): string {
if (!value.startsWith("Context handoff (")) {
return value;
}
const marker = "\n\nUser message:\n";
const markerIndex = value.indexOf(marker);
const headerEnd = value.indexOf(":\n");
if (markerIndex === -1 || headerEnd === -1 || headerEnd >= markerIndex) {
return value;
}
return `${value.slice(0, headerEnd + 2)}<dynamic-summary>${value.slice(markerIndex)}`;
}
function normalizeFrame(value: unknown): unknown {
if (typeof value === "string") {
return normalizeContextHandoffText(value);
}
if (Array.isArray(value)) {
return value.map(normalizeFrame);
}
if (typeof value !== "object" || value === null) {
return value;
}
return Object.fromEntries(
Object.entries(value).map(([key, entry]) => [key, normalizeFrame(entry)]),
);
}
function sameFrame(left: unknown, right: unknown): boolean {
return stableStringify(normalizeFrame(left)) === stableStringify(normalizeFrame(right));
}
function makeSignal(): {
readonly promise: Promise<void>;
readonly resolve: () => void;
} {
let resolve = () => {};
const promise = new Promise<void>((onResolve) => {
resolve = onResolve;
});
return { promise, resolve };
}
function replayRunnerError(
transcript: CursorAgentSdkReplayTranscript,
cause: unknown,
method: string,
): CursorAgentSdkRunnerError {
if (isCursorAgentSdkRunnerError(cause)) {
return cause;
}
return new CursorAgentSdkRunnerError({
method,
cause: isCursorAgentSdkReplayError(cause)
? cause
: new CursorReplayRuntimeError({
scenario: transcript.scenario,
cursor: 0,
cause,
}),
});
}
export function makeCursorAgentSdkReplayRunner(
transcript: CursorAgentSdkReplayTranscript,
): CursorAgentSdkRunnerShape {
let cursor = 0;
let failure: CursorAgentSdkReplayError | null = null;
let cursorAdvanced = makeSignal();
const recordFailure = <Error extends CursorAgentSdkReplayError>(error: Error): Error => {
failure = error;
return error;
};
const fail = (error: CursorAgentSdkReplayError): never => {
throw recordFailure(error);
};
const advance = () => {
cursor += 1;
const signal = cursorAdvanced;
cursorAdvanced = makeSignal();
signal.resolve();
};
const assertOutbound = (actual: CursorOutgoingFrame) => {
if (failure !== null) {
throw failure;
}
const entry = transcript.entries[cursor];
if (entry === undefined) {
return fail(
new CursorReplayExhaustedError({
scenario: transcript.scenario,
cursor,
actual,
}),
);
}
if (entry.type !== "expect_outbound" || !sameFrame(entry.frame, actual)) {
return fail(
new CursorReplayFrameMismatchError({
scenario: transcript.scenario,
cursor,
expected: entry.type === "expect_outbound" ? entry.frame : entry,
actual,
}),
);
}
advance();
};
const consumeInbound = <Type extends CursorProtocolPayload["type"]>(
type: Type,
): Extract<CursorProtocolPayload, { readonly type: Type }> => {
const entry = transcript.entries[cursor];
if (
entry === undefined ||
entry.type !== "emit_inbound" ||
typeof entry.frame !== "object" ||
entry.frame === null ||
Reflect.get(entry.frame, "type") !== type
) {
return fail(
new CursorReplayFrameMismatchError({
scenario: transcript.scenario,
cursor,
expected: { type },
actual: entry,
}),
);
}
const frame = entry.frame as Extract<CursorProtocolPayload, { readonly type: Type }>;
advance();
return frame;
};
const waitForRun = <Error>(
runId: string,
sendInput: CursorAgentSdkSendInput<Error>,
): Effect.Effect<RunResult, CursorAgentSdkReplayError> =>
Effect.gen(function* () {
while (true) {
if (failure !== null) {
return yield* failure;
}
const entry = transcript.entries[cursor];
if (entry === undefined) {
return yield* recordFailure(
new CursorReplayExhaustedError({
scenario: transcript.scenario,
cursor,
actual: { type: "run.completed", runId },
}),
);
}
if (entry.type === "expect_outbound") {
const signal = cursorAdvanced;
yield* Effect.promise(() => signal.promise);
continue;
}
if (entry.type === "runtime_exit") {
advance();
if (entry.status === "success") {
continue;
}
return yield* recordFailure(
new CursorReplayRuntimeError({
scenario: transcript.scenario,
cursor: cursor - 1,
cause: entry.error ?? entry.status,
}),
);
}
if (
typeof entry.frame !== "object" ||
entry.frame === null ||
typeof Reflect.get(entry.frame, "type") !== "string"
) {
return yield* recordFailure(
new CursorReplayFrameMismatchError({
scenario: transcript.scenario,
cursor,
expected: { type: "interaction.update | run.completed" },
actual: entry.frame,
}),
);
}
const frame = entry.frame as CursorProtocolPayload;
if (frame.type === "interaction.update") {
if (frame.runId !== runId) {
return yield* recordFailure(
new CursorReplayFrameMismatchError({
scenario: transcript.scenario,
cursor,
expected: { runId },
actual: frame,
}),
);
}
advance();
yield* (sendInput.onDelta?.(frame.update) ?? Effect.void).pipe(
Effect.mapError((cause) =>
recordFailure(
new CursorReplayRuntimeError({
scenario: transcript.scenario,
cursor: cursor - 1,
cause,
}),
),
),
);
yield* Effect.yieldNow;
continue;
}
if (frame.type === "run.completed") {
if (frame.result.id !== runId) {
return yield* recordFailure(
new CursorReplayFrameMismatchError({
scenario: transcript.scenario,
cursor,
expected: { runId },
actual: frame.result,
}),
);
}
advance();
return frame.result;
}
return yield* recordFailure(
new CursorReplayFrameMismatchError({
scenario: transcript.scenario,
cursor,
expected: { type: "interaction.update | run.completed" },
actual: frame,
}),
);
}
});
return {
open: (input: CursorAgentSdkOpenInput) =>
Effect.try({
try: () => {
assertOutbound({
type: "agent.open",
operation: input.operation,
...(input.agentId === undefined ? {} : { agentId: input.agentId }),
options: loggedCursorAgentOptions(input.options),
});
const opened = consumeInbound("agent.opened");
const session: CursorAgentSdkSession = {
agentId: opened.agentId,
send: (sendInput) =>
Effect.try({
try: () => {
assertOutbound({
type: "run.start",
message: sendInput.message,
options: loggedCursorSendOptions(sendInput.options),
});
const started = consumeInbound("run.started");
const run: CursorAgentSdkRun = {
runId: started.runId,
agentId: started.agentId,
wait: waitForRun(started.runId, sendInput).pipe(
Effect.mapError((cause) =>
replayRunnerError(transcript, cause, "replay.run.wait"),
),
),
cancel: Effect.try({
try: () =>
assertOutbound({
type: "run.cancel",
runId: started.runId,
}),
catch: (cause) => replayRunnerError(transcript, cause, "replay.run.cancel"),
}),
};
return run;
},
catch: (cause) => replayRunnerError(transcript, cause, "replay.session.send"),
}),
listMessages: Effect.try({
try: () => {
assertOutbound({
type: "agent.messages.list",
agentId: opened.agentId,
});
return consumeInbound("agent.messages").messages;
},
catch: (cause) => replayRunnerError(transcript, cause, "replay.agent.messages.list"),
}),
close: Effect.try({
try: () =>
assertOutbound({
type: "agent.close",
agentId: opened.agentId,
}),
catch: (cause) => replayRunnerError(transcript, cause, "replay.agent.close"),
}),
};
return session;
},
catch: (cause) => replayRunnerError(transcript, cause, "replay.agent.open"),
}),
assertComplete: Effect.try({
try: () => {
if (failure !== null) {
throw failure;
}
if (cursor !== transcript.entries.length) {
throw new CursorReplayIncompleteError({
scenario: transcript.scenario,
cursor,
remaining: transcript.entries.length - cursor,
});
}
},
catch: (cause) => replayRunnerError(transcript, cause, "replay.assertComplete"),
}),
};
}
export function makeCursorAgentSdkReplayLayer(
transcript: CursorAgentSdkReplayTranscript,
options?: {
readonly runner?: CursorAgentSdkRunnerShape;
readonly assertCompleteOnFinalize?: boolean;
},
): Layer.Layer<CursorAgentSdkRunner> {
const runner = options?.runner ?? makeCursorAgentSdkReplayRunner(transcript);
return Layer.effect(
CursorAgentSdkRunner,
Effect.gen(function* () {
yield* Effect.addFinalizer(() =>
options?.assertCompleteOnFinalize === false
? Effect.void
: runner.assertComplete.pipe(Effect.orDie),
);
return CursorAgentSdkRunner.of(runner);
}),
);
}
function makeReplayServerConfig(
scenario: string,
): Effect.Effect<
ServerConfigShape,
PlatformError.PlatformError,
FileSystem.FileSystem | Path.Path
> {
return Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const baseDir = yield* fs.makeTempDirectory({
prefix: `t3-orchestration-v2-cursor-${scenario}-`,
});
const stateDir = path.join(baseDir, "userdata");
const logsDir = path.join(stateDir, "logs");
const providerLogsDir = path.join(logsDir, "provider");
const terminalLogsDir = path.join(logsDir, "terminals");
const attachmentsDir = path.join(stateDir, "attachments");
const worktreesDir = path.join(baseDir, "worktrees");
const providerStatusCacheDir = path.join(baseDir, "caches");
for (const directory of [
stateDir,
logsDir,
providerLogsDir,
terminalLogsDir,
attachmentsDir,
worktreesDir,
providerStatusCacheDir,
]) {
yield* fs.makeDirectory(directory, { recursive: true });
}
return {
logLevel: "Error",
traceMinLevel: "Info",
traceTimingEnabled: true,
traceBatchWindowMs: 200,
traceMaxBytes: 10 * 1024 * 1024,
traceMaxFiles: 10,
otlpTracesUrl: undefined,
otlpMetricsUrl: undefined,
otlpExportIntervalMs: 10_000,
otlpServiceName: "t3-server",
mode: "web",
port: 0,
host: undefined,
cwd: process.cwd(),
baseDir,
staticDir: undefined,
devUrl: undefined,
noBrowser: false,
startupPresentation: "browser",
tailscaleServeEnabled: false,
tailscaleServePort: 443,
desktopBootstrapToken: undefined,
autoBootstrapProjectFromCwd: false,
logWebSocketEvents: false,
stateDir,
dbPath: path.join(stateDir, "state.sqlite"),
keybindingsConfigPath: path.join(stateDir, "keybindings.json"),
settingsPath: path.join(stateDir, "settings.json"),
providerStatusCacheDir,
worktreesDir,
attachmentsDir,
logsDir,
serverLogPath: path.join(logsDir, "server.log"),
serverTracePath: path.join(logsDir, "server.trace.ndjson"),
providerLogsDir,
providerEventLogPath: path.join(providerLogsDir, "events.log"),
terminalLogsDir,
anonymousIdPath: path.join(stateDir, "anonymous-id"),
environmentIdPath: path.join(stateDir, "environment-id"),
serverRuntimeStatePath: path.join(stateDir, "server-runtime.json"),
secretsDir: path.join(stateDir, "secrets"),
};
});
}
export function makeCursorProviderAdapterRegistryReplayLayer(
transcript: CursorAgentSdkReplayTranscript,
options?: {
readonly runner?: CursorAgentSdkRunnerShape;
readonly assertCompleteOnFinalize?: boolean;
},
) {
const serverConfigLayer = Layer.effect(
ServerConfig,
makeReplayServerConfig(transcript.scenario).pipe(Effect.orDie),
).pipe(Layer.provide(NodeServices.layer));
return makeProviderAdapterRegistryDriverLayer({
drivers: [CursorAdapterV2Driver],
configMap: {
[CURSOR_DEFAULT_INSTANCE_ID]: {
driver: CURSOR_DRIVER_KIND,
},
},
}).pipe(
Layer.provide(
Layer.mergeAll(
makeCursorAgentSdkReplayLayer(transcript, options),
serverConfigLayer,
NodeServices.layer,
idAllocatorLayer,
),
),
);
}
function metadataFromTranscript(transcript: ProviderReplayTranscript): {
readonly provider?: string;
readonly protocol?: string;
readonly scenario?: string;
} {
return {
provider: transcript.provider,
protocol: transcript.protocol,
scenario: transcript.scenario,
};
}
export const CursorOrchestratorReplayHarness: OrchestratorV2ProviderReplayHarness<
CursorAgentSdkReplayTranscript,
CursorOrchestratorReplayHarnessError
> = {
provider: CURSOR_PROVIDER,
decodeTranscript: (transcript) =>
decodeCursorAgentSdkReplayTranscript(transcript).pipe(
Effect.mapError(
(cause) =>
new CursorReplayTranscriptDecodeError({
...metadataFromTranscript(transcript),
cause,
}),
),
),
makeProviderAdapterRegistryLayer: (transcript) =>
makeCursorProviderAdapterRegistryReplayLayer(transcript),
};
function sanitizeReplayValue(
value: unknown,
replacements: ReadonlyArray<readonly [string, string]>,
): unknown {
if (typeof value === "string") {
return replacements.reduce(
(text, [from, to]) => (from.length === 0 ? text : text.replaceAll(from, to)),
value,
);
}
if (Array.isArray(value)) {
return value.map((entry) => sanitizeReplayValue(entry, replacements));
}
if (typeof value !== "object" || value === null) {
return value;
}
return Object.fromEntries(
Object.entries(value).map(([key, entry]) => [key, sanitizeReplayValue(entry, replacements)]),
);
}
function serializeCursorRecordingError(cause: unknown): unknown {
if (typeof cause !== "object" || cause === null) {
return cause;
}
return {
name: typeof Reflect.get(cause, "name") === "string" ? Reflect.get(cause, "name") : "Error",
message:
typeof Reflect.get(cause, "message") === "string"
? Reflect.get(cause, "message")
: String(cause),
};
}
function makeRecordingSignal(): {
readonly promise: Promise<void>;
readonly resolve: () => void;
} {
let resolve = () => {};
const promise = new Promise<void>((onResolve) => {
resolve = onResolve;
});
return { promise, resolve };
}
async function waitForRecordingSignal(signal: Promise<void>, description: string): Promise<void> {
const controller = new AbortController();
const timeout = Effect.runPromise(
Effect.sleep("30 seconds").pipe(
Effect.andThen(Effect.die(`Timed out waiting for ${description}.`)),
),
{ signal: controller.signal },
);
try {
await Promise.race([signal, timeout]);
} finally {
controller.abort();
}
}
function recordingRuntimePolicy(input: {
readonly cwd: string;
readonly interactionMode: "default" | "plan";
}): ProviderAdapterV2RuntimePolicy {
return {
runtimeMode: "full-access",
interactionMode: input.interactionMode,
cwd: input.cwd,
approvalPolicy: "never",
sandboxPolicy: {
type: "dangerFullAccess",
networkAccess: true,
},
};
}
export async function recordCursorAgentSdkReplayTranscript(input: {
readonly scenario: string;
readonly prompts: ReadonlyArray<string>;
readonly modelSelection: ModelSelection;
readonly cwd: string;
readonly interactionMode?: "default" | "plan";
readonly apiKey?: string;
readonly interruptAfterToolStart?: boolean;
readonly interruptAfterRunStartPromptIndex?: number;
readonly restartBeforePromptIndex?: number;
}): Promise<CursorAgentSdkReplayTranscript> {
if (input.interruptAfterToolStart === true && input.prompts.length !== 1) {
throw new Error("Cursor interrupt recordings require exactly one prompt.");
}
if (
input.interruptAfterToolStart === true &&
input.interruptAfterRunStartPromptIndex !== undefined
) {
throw new Error("Cursor recordings cannot use both interrupt triggers.");
}
if (
input.interruptAfterRunStartPromptIndex !== undefined &&
(input.interruptAfterRunStartPromptIndex < 0 ||
input.interruptAfterRunStartPromptIndex >= input.prompts.length)
) {
throw new Error("Cursor interrupt prompt index is outside the prompt list.");
}
const entries: Array<ProviderReplayEntry> = [];
const interactionMode = input.interactionMode ?? "default";
const runtimePolicy = recordingRuntimePolicy({
cwd: input.cwd,
interactionMode,
});
const options = makeCursorAgentOptions({
...(input.apiKey === undefined ? {} : { apiKey: input.apiKey }),
modelSelection: input.modelSelection,
runtimePolicy,
threadId: "thread:cursor-replay" as ThreadId,
});
entries.push({
type: "expect_outbound",
label: "agent.open",
frame: {
type: "agent.open",
operation: "create",
options: loggedCursorAgentOptions(options),
},
});
let agent = await Agent.create(options);
const nativeAgentId = agent.agentId;
entries.push({
type: "emit_inbound",
label: "agent.opened",
frame: {
type: "agent.opened",
agentId: agent.agentId,
},
});
const replacements: ReadonlyArray<readonly [string, string]> = [
[input.cwd, `/tmp/cursor-replay-${input.scenario}`],
];
try {
for (const [index, prompt] of input.prompts.entries()) {
if (input.restartBeforePromptIndex === index) {
entries.push({
type: "expect_outbound",
label: `agent.close:before-prompt-${index + 1}`,
frame: {
type: "agent.close",
agentId: nativeAgentId,
},
});
agent.close();
entries.push({
type: "expect_outbound",
label: `agent.resume:before-prompt-${index + 1}`,
frame: {
type: "agent.open",
operation: "resume",
agentId: nativeAgentId,
options: loggedCursorAgentOptions(options),
},
});
agent = await Agent.resume(nativeAgentId, options);
entries.push({
type: "emit_inbound",
label: `agent.resumed:before-prompt-${index + 1}`,
frame: {
type: "agent.opened",
agentId: agent.agentId,
},
});
}
const sendOptions = {
model: cursorSdkModelSelection(input.modelSelection),
mode: interactionMode === "plan" ? "plan" : "agent",
} as const;
entries.push({
type: "expect_outbound",
label: `run.start:${index + 1}`,
frame: {
type: "run.start",
message: prompt,
options: loggedCursorSendOptions(sendOptions),
},
});
const pendingUpdates: Array<InteractionUpdate> = [];
let runReady = false;
let runId = "";
let updatesPaused = false;
const toolStarted = makeRecordingSignal();
const runActivityStarted = makeRecordingSignal();
const resumeUpdates = makeRecordingSignal();
let interruptTriggerObserved = false;
let callbackChain = Promise.resolve();
const recordUpdate = async (update: InteractionUpdate) => {
if (updatesPaused) {
await resumeUpdates.promise;
}
entries.push({
type: "emit_inbound",
label: update.type,
frame: {
type: "interaction.update",
runId,
update: sanitizeReplayValue(update, replacements) as InteractionUpdate,
},
});
if (
input.interruptAfterToolStart === true &&
!interruptTriggerObserved &&
update.type === "tool-call-started"
) {
interruptTriggerObserved = true;
updatesPaused = true;
toolStarted.resolve();
}
};
const scheduleUpdate = (update: InteractionUpdate): Promise<void> => {
callbackChain = callbackChain.then(() => recordUpdate(update));
return callbackChain;
};
const run = await agent.send(prompt, {
...sendOptions,
onDelta: async ({ update }) => {
runActivityStarted.resolve();
if (!runReady) {
pendingUpdates.push(update);
return;
}
await scheduleUpdate(update);
},
});
runId = run.id;
entries.push({
type: "emit_inbound",
label: `run.started:${index + 1}`,
frame: {
type: "run.started",
runId: run.id,
agentId: run.agentId,
},
});
runReady = true;
for (const update of pendingUpdates) {
void scheduleUpdate(update);
}
const resultPromise = run.wait().then(
(result) => ({ type: "success" as const, result }),
(cause: unknown) => ({ type: "failure" as const, cause }),
);
if (input.interruptAfterRunStartPromptIndex === index) {
await waitForRecordingSignal(
runActivityStarted.promise,
"Cursor SDK run activity before interrupt",
);
entries.push({
type: "expect_outbound",
label: `run.cancel:${index + 1}`,
frame: {
type: "run.cancel",
runId: run.id,
},
});
await run.cancel().catch((cause: unknown) => {
if (!isCursorCancellationError(cause)) {
throw cause;
}
});
}
if (input.interruptAfterToolStart === true) {
await waitForRecordingSignal(
toolStarted.promise,
"Cursor SDK tool-call-started before interrupt",
);
entries.push({
type: "expect_outbound",
label: `run.cancel:${index + 1}`,
frame: {
type: "run.cancel",
runId: run.id,
},
});
const cancelPromise = run.cancel().catch((cause: unknown) => {
if (!isCursorCancellationError(cause)) {
throw cause;
}
});
updatesPaused = false;
resumeUpdates.resolve();
await cancelPromise;
}
const outcome = await resultPromise;
await callbackChain;
if (outcome.type === "success") {
entries.push({
type: "emit_inbound",
label: `run.completed:${index + 1}`,
frame: {
type: "run.completed",
result: sanitizeReplayValue(outcome.result, replacements) as RunResult,
},
});
} else if (
(input.interruptAfterToolStart === true ||
input.interruptAfterRunStartPromptIndex === index) &&
isCursorCancellationError(outcome.cause)
) {
entries.push({
type: "runtime_exit",
status: "cancelled",
error: serializeCursorRecordingError(outcome.cause),
});
} else {
throw outcome.cause;
}
}
} finally {
entries.push({
type: "expect_outbound",
label: "agent.close",
frame: {
type: "agent.close",
agentId: nativeAgentId,
},
});
agent.close();
}
return {
provider: CURSOR_PROVIDER,
protocol: CURSOR_AGENT_SDK_PROTOCOL,
version: "1",
scenario: input.scenario,
metadata: {
generatedBy: "recordCursorAgentSdkReplayTranscript",
nativeAgentId,
},
entries,
};
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,513 @@
import {
Agent,
type AgentMessage,
type AgentOptions,
type InteractionUpdate,
type RunResult,
type SDKUserMessage,
type SendOptions,
} from "@cursor/sdk";
import type { OrchestrationV2ProviderSession, ThreadId } from "@t3tools/contracts";
import * as Context from "effect/Context";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Schema from "effect/Schema";
import { ServerConfig } from "../../config.ts";
import {
type EventNdjsonLogger,
makeEventNdjsonLogger,
} from "../../provider/Layers/EventNdjsonLogger.ts";
export const CURSOR_AGENT_SDK_PROTOCOL = "cursor-agent-sdk.local" as const;
export const CURSOR_PROVIDER = "cursor" as const;
export class CursorAgentSdkRunnerError extends Schema.TaggedErrorClass<CursorAgentSdkRunnerError>()(
"CursorAgentSdkRunnerError",
{
method: Schema.String,
cause: Schema.Defect(),
},
) {
override get message(): string {
return `Cursor Agent SDK ${this.method} failed.`;
}
}
const isCursorAgentSdkRunnerError = Schema.is(CursorAgentSdkRunnerError);
export interface CursorAgentSdkOpenInput {
readonly operation: "create" | "resume";
readonly agentId?: string;
readonly options: AgentOptions;
readonly threadId: ThreadId;
readonly providerSessionId: OrchestrationV2ProviderSession["id"];
}
export interface CursorAgentSdkSendInput<Error> {
readonly message: string | SDKUserMessage;
readonly options?: Omit<SendOptions, "onDelta">;
readonly onDelta?: (update: InteractionUpdate) => Effect.Effect<void, Error>;
}
export interface CursorAgentSdkRun {
readonly runId: string;
readonly agentId: string;
readonly wait: Effect.Effect<RunResult, CursorAgentSdkRunnerError>;
readonly cancel: Effect.Effect<void, CursorAgentSdkRunnerError>;
}
export interface CursorAgentSdkSession {
readonly agentId: string;
readonly send: <Error>(
input: CursorAgentSdkSendInput<Error>,
) => Effect.Effect<CursorAgentSdkRun, CursorAgentSdkRunnerError>;
readonly listMessages: Effect.Effect<ReadonlyArray<AgentMessage>, CursorAgentSdkRunnerError>;
readonly close: Effect.Effect<void, CursorAgentSdkRunnerError>;
}
export interface CursorAgentSdkRunnerShape {
readonly open: (
input: CursorAgentSdkOpenInput,
) => Effect.Effect<CursorAgentSdkSession, CursorAgentSdkRunnerError>;
readonly assertComplete: Effect.Effect<void, CursorAgentSdkRunnerError>;
}
export class CursorAgentSdkRunner extends Context.Service<
CursorAgentSdkRunner,
CursorAgentSdkRunnerShape
>()("t3/orchestration-v2/Adapters/CursorAgentSdk/CursorAgentSdkRunner") {}
export interface CursorAgentSdkLoggedAgentOptions {
readonly model?: AgentOptions["model"];
readonly hasName?: boolean;
readonly mode?: AgentOptions["mode"];
readonly local?: {
readonly hasCwd?: boolean;
readonly autoReview?: boolean;
readonly settingSources?: AgentOptions["local"] extends infer Local
? Local extends { readonly settingSources?: infer Sources }
? Sources
: never
: never;
readonly sandboxEnabled?: boolean;
readonly enableAgentRetries?: boolean;
readonly hasCustomTools?: boolean;
};
readonly agents?: ReadonlyArray<string>;
}
export interface CursorAgentSdkLoggedSendOptions {
readonly model?: SendOptions["model"];
readonly mode?: SendOptions["mode"];
readonly local?: {
readonly force?: boolean;
readonly hasCustomTools?: boolean;
};
readonly idempotencyKey?: string;
}
export type CursorAgentSdkProtocolLogEvent =
| {
readonly direction: "outgoing";
readonly stage: "decoded";
readonly payload: {
readonly type: "agent.open";
readonly operation: CursorAgentSdkOpenInput["operation"];
readonly agentId?: string;
readonly options: CursorAgentSdkLoggedAgentOptions;
};
}
| {
readonly direction: "incoming";
readonly stage: "decoded";
readonly payload: {
readonly type: "agent.opened";
readonly agentId: string;
};
}
| {
readonly direction: "outgoing";
readonly stage: "decoded";
readonly payload: {
readonly type: "run.start";
readonly message: string | SDKUserMessage;
readonly options: CursorAgentSdkLoggedSendOptions;
};
}
| {
readonly direction: "incoming";
readonly stage: "decoded";
readonly payload: {
readonly type: "run.started";
readonly runId: string;
readonly agentId: string;
};
}
| {
readonly direction: "incoming";
readonly stage: "decoded";
readonly payload: {
readonly type: "interaction.update";
readonly runId: string;
readonly update: InteractionUpdate;
};
}
| {
readonly direction: "incoming";
readonly stage: "decoded";
readonly payload: {
readonly type: "run.completed";
readonly result: RunResult;
};
}
| {
readonly direction: "outgoing";
readonly stage: "decoded";
readonly payload: {
readonly type: "run.cancel";
readonly runId: string;
};
}
| {
readonly direction: "outgoing";
readonly stage: "decoded";
readonly payload: {
readonly type: "agent.messages.list";
readonly agentId: string;
};
}
| {
readonly direction: "incoming";
readonly stage: "decoded";
readonly payload: {
readonly type: "agent.messages";
readonly agentId: string;
readonly messages: ReadonlyArray<AgentMessage>;
};
}
| {
readonly direction: "outgoing";
readonly stage: "decoded";
readonly payload: {
readonly type: "agent.close";
readonly agentId: string;
};
};
export type CursorAgentSdkProtocolLogger = (
event: CursorAgentSdkProtocolLogEvent,
) => Effect.Effect<void>;
function runnerError(cause: unknown, method: string): CursorAgentSdkRunnerError {
return isCursorAgentSdkRunnerError(cause)
? cause
: new CursorAgentSdkRunnerError({ method, cause });
}
export function isCursorCancellationError(cause: unknown): boolean {
let current = cause;
const seen = new Set<object>();
while (typeof current === "object" && current !== null && !seen.has(current)) {
if (Reflect.get(current, "name") === "AbortError") {
return true;
}
seen.add(current);
current = Reflect.get(current, "cause");
}
return false;
}
export function loggedCursorAgentOptions(options: AgentOptions): CursorAgentSdkLoggedAgentOptions {
return {
...(options.model === undefined ? {} : { model: options.model }),
...(options.name === undefined ? {} : { hasName: true }),
...(options.mode === undefined ? {} : { mode: options.mode }),
...(options.local === undefined
? {}
: {
local: {
...(options.local.cwd === undefined ? {} : { hasCwd: true }),
...(options.local.autoReview === undefined
? {}
: { autoReview: options.local.autoReview }),
...(options.local.settingSources === undefined
? {}
: { settingSources: options.local.settingSources }),
...(options.local.sandboxOptions === undefined
? {}
: { sandboxEnabled: options.local.sandboxOptions.enabled }),
...(options.local.enableAgentRetries === undefined
? {}
: { enableAgentRetries: options.local.enableAgentRetries }),
...(options.local.customTools === undefined ? {} : { hasCustomTools: true }),
},
}),
...(options.agents === undefined ? {} : { agents: Object.keys(options.agents).toSorted() }),
};
}
export function loggedCursorSendOptions(
options: Omit<SendOptions, "onDelta"> | undefined,
): CursorAgentSdkLoggedSendOptions {
if (options === undefined) {
return {};
}
return {
...(options.model === undefined ? {} : { model: options.model }),
...(options.mode === undefined ? {} : { mode: options.mode }),
...(options.local === undefined
? {}
: {
local: {
...(options.local.force === undefined ? {} : { force: options.local.force }),
...(options.local.customTools === undefined ? {} : { hasCustomTools: true }),
},
}),
...(options.idempotencyKey === undefined ? {} : { idempotencyKey: options.idempotencyKey }),
};
}
export function makeCursorAgentSdkProtocolLogger(input: {
readonly nativeEventLogger: EventNdjsonLogger | undefined;
readonly threadId: ThreadId;
readonly providerSessionId: OrchestrationV2ProviderSession["id"];
}): CursorAgentSdkProtocolLogger | undefined {
if (input.nativeEventLogger === undefined) {
return undefined;
}
const nativeEventLogger = input.nativeEventLogger;
return (event) =>
nativeEventLogger
.write(
{
provider: CURSOR_PROVIDER,
protocol: CURSOR_AGENT_SDK_PROTOCOL,
kind: "protocol",
providerSessionId: input.providerSessionId,
event,
},
input.threadId,
)
.pipe(Effect.ignore);
}
export const cursorAgentSdkRunnerLiveLayer: Layer.Layer<CursorAgentSdkRunner, never, ServerConfig> =
Layer.effect(
CursorAgentSdkRunner,
Effect.gen(function* () {
const { providerEventLogPath } = yield* ServerConfig;
const nativeEventLogger = yield* makeEventNdjsonLogger(providerEventLogPath, {
stream: "native",
});
return CursorAgentSdkRunner.of({
open: Effect.fn("CursorAgentSdkRunner.open")(function* (input) {
const protocolLogger = makeCursorAgentSdkProtocolLogger({
nativeEventLogger,
threadId: input.threadId,
providerSessionId: input.providerSessionId,
});
const log = (event: CursorAgentSdkProtocolLogEvent) =>
protocolLogger === undefined ? Effect.void : protocolLogger(event);
yield* log({
direction: "outgoing",
stage: "decoded",
payload: {
type: "agent.open",
operation: input.operation,
...(input.agentId === undefined ? {} : { agentId: input.agentId }),
options: loggedCursorAgentOptions(input.options),
},
});
const agent = yield* Effect.tryPromise({
try: () =>
input.operation === "create"
? Agent.create(input.options)
: Agent.resume(input.agentId!, input.options),
catch: (cause) => runnerError(cause, `agent.${input.operation}`),
});
yield* log({
direction: "incoming",
stage: "decoded",
payload: {
type: "agent.opened",
agentId: agent.agentId,
},
});
const cwd =
typeof input.options.local?.cwd === "string"
? input.options.local.cwd
: input.options.local?.cwd?.[0];
return {
agentId: agent.agentId,
send: Effect.fn("CursorAgentSdkSession.send")(function* (sendInput) {
const context = yield* Effect.context();
yield* log({
direction: "outgoing",
stage: "decoded",
payload: {
type: "run.start",
message: sendInput.message,
options: loggedCursorSendOptions(sendInput.options),
},
});
let callbacksReady = false;
const pendingUpdates: Array<InteractionUpdate> = [];
let callbackChain = Promise.resolve();
let runId = "";
const dispatchUpdate = (update: InteractionUpdate): Promise<void> => {
callbackChain = callbackChain.then(() =>
Effect.runPromiseWith(context)(
log({
direction: "incoming",
stage: "decoded",
payload: {
type: "interaction.update",
runId,
update,
},
}).pipe(Effect.andThen(sendInput.onDelta?.(update) ?? Effect.void)),
),
);
return callbackChain;
};
const run = yield* Effect.tryPromise({
try: () =>
agent.send(sendInput.message, {
...sendInput.options,
onDelta: async ({ update }) => {
if (!callbacksReady) {
pendingUpdates.push(update);
return;
}
await dispatchUpdate(update);
},
}),
catch: (cause) => runnerError(cause, "run.start"),
});
runId = run.id;
yield* log({
direction: "incoming",
stage: "decoded",
payload: {
type: "run.started",
runId: run.id,
agentId: run.agentId,
},
});
callbacksReady = true;
for (const update of pendingUpdates) {
yield* Effect.tryPromise({
try: () => dispatchUpdate(update),
catch: (cause) => runnerError(cause, "run.onDelta"),
});
}
return {
runId: run.id,
agentId: run.agentId,
wait: Effect.tryPromise({
try: async () => {
const result = await run.wait();
await callbackChain;
return result;
},
catch: (cause) => runnerError(cause, "run.wait"),
}).pipe(
Effect.tap((result) =>
log({
direction: "incoming",
stage: "decoded",
payload: {
type: "run.completed",
result,
},
}),
),
),
cancel: log({
direction: "outgoing",
stage: "decoded",
payload: {
type: "run.cancel",
runId: run.id,
},
}).pipe(
Effect.andThen(
Effect.tryPromise({
try: async () => {
try {
await run.cancel();
} catch (cause) {
if (!isCursorCancellationError(cause)) {
throw cause;
}
}
},
catch: (cause) => runnerError(cause, "run.cancel"),
}),
),
),
} satisfies CursorAgentSdkRun;
}),
listMessages: log({
direction: "outgoing",
stage: "decoded",
payload: {
type: "agent.messages.list",
agentId: agent.agentId,
},
}).pipe(
Effect.andThen(
Effect.tryPromise({
try: () =>
Agent.messages.list(agent.agentId, {
runtime: "local",
...(cwd === undefined ? {} : { cwd }),
}),
catch: (cause) => runnerError(cause, "agent.messages.list"),
}),
),
Effect.tap((messages) =>
log({
direction: "incoming",
stage: "decoded",
payload: {
type: "agent.messages",
agentId: agent.agentId,
messages,
},
}),
),
),
close: Effect.try({
try: () => agent.close(),
catch: (cause) => runnerError(cause, "agent.close"),
}).pipe(
Effect.tap(() =>
log({
direction: "outgoing",
stage: "decoded",
payload: {
type: "agent.close",
agentId: agent.agentId,
},
}),
),
),
} satisfies CursorAgentSdkSession;
}),
assertComplete: Effect.void,
});
}),
);
@@ -3,6 +3,7 @@ import { CommandId, type OrchestrationV2ProviderCapabilities, ThreadId } from "@
import * as Effect from "effect/Effect";
import { CodexProviderCapabilitiesV2 } from "./Adapters/CodexAdapterV2.ts";
import { CursorProviderCapabilitiesV2 } from "./Adapters/CursorAdapterV2.ts";
import {
CommandPolicyCapabilityUnsupportedError,
CommandPolicyV2,
@@ -61,6 +62,22 @@ layer("CommandPolicyV2", (it) => {
}),
);
it.effect("honors an explicit interrupt-and-restart request", () =>
Effect.gen(function* () {
const policy = yield* CommandPolicyV2;
const result = yield* policy.decideSteeringExecution({
commandId,
threadId,
provider: "codex",
capabilities: CodexProviderCapabilitiesV2,
forceRestart: true,
});
assert.equal(result, "interrupt_restart");
}),
);
it.effect("returns typed capability errors for unsupported active steering", () =>
Effect.gen(function* () {
const policy = yield* CommandPolicyV2;
@@ -112,6 +129,73 @@ layer("CommandPolicyV2", (it) => {
}),
);
it.effect("uses a native fork when the provider supports the requested source point", () =>
Effect.gen(function* () {
const policy = yield* CommandPolicyV2;
const result = yield* policy.decideForkExecution({
commandId,
threadId,
provider: "codex",
capabilities: CodexProviderCapabilitiesV2,
sameProvider: true,
hasStrongNativeSource: true,
fromSpecificTurn: true,
});
assert.equal(result, "native_fork");
}),
);
it.effect("falls back to portable context when Cursor cannot fork natively", () =>
Effect.gen(function* () {
const policy = yield* CommandPolicyV2;
const result = yield* policy.decideForkExecution({
commandId,
threadId,
provider: "cursor",
capabilities: CursorProviderCapabilitiesV2,
sameProvider: true,
hasStrongNativeSource: true,
fromSpecificTurn: true,
});
assert.equal(result, "portable_context");
}),
);
it.effect("returns a typed error when neither native nor portable fork is available", () =>
Effect.gen(function* () {
const policy = yield* CommandPolicyV2;
const error = yield* policy
.decideForkExecution({
commandId,
threadId,
provider: "cursor",
capabilities: capabilities((current) => ({
...current,
threads: {
...current.threads,
canForkThread: false,
},
context: {
...current.context,
canConsumeHandoffSummaries: false,
},
})),
sameProvider: true,
hasStrongNativeSource: true,
fromSpecificTurn: true,
})
.pipe(Effect.flip);
assert.instanceOf(error, CommandPolicyCapabilityUnsupportedError);
assert.equal(error.capability, "context_handoff");
}),
);
it.effect("guards rollback behind provider rollback snapshot support", () =>
Effect.gen(function* () {
const policy = yield* CommandPolicyV2;
@@ -43,6 +43,9 @@ export type MessageDispatchDecisionV2 = typeof MessageDispatchDecisionV2.Type;
export const SteeringExecutionPolicyV2 = Schema.Literals(["active_steering", "interrupt_restart"]);
export type SteeringExecutionPolicyV2 = typeof SteeringExecutionPolicyV2.Type;
export const ForkExecutionPolicyV2 = Schema.Literals(["native_fork", "portable_context"]);
export type ForkExecutionPolicyV2 = typeof ForkExecutionPolicyV2.Type;
export const CommandPolicyCapability = Schema.Literals([
"queued_messages",
"active_steering",
@@ -129,7 +132,9 @@ export interface CommandPolicyV2Shape {
input: CapabilityCheckInput,
) => Effect.Effect<void, CommandPolicyV2Error>;
readonly decideSteeringExecution: (
input: CapabilityCheckInput,
input: CapabilityCheckInput & {
readonly forceRestart?: boolean;
},
) => Effect.Effect<SteeringExecutionPolicyV2, CommandPolicyV2Error>;
readonly ensureInterrupt: (
input: CapabilityCheckInput,
@@ -139,6 +144,13 @@ export interface CommandPolicyV2Shape {
readonly fromSpecificTurn: boolean;
},
) => Effect.Effect<void, CommandPolicyV2Error>;
readonly decideForkExecution: (
input: CapabilityCheckInput & {
readonly sameProvider: boolean;
readonly hasStrongNativeSource: boolean;
readonly fromSpecificTurn: boolean;
},
) => Effect.Effect<ForkExecutionPolicyV2, CommandPolicyV2Error>;
readonly ensureRollback: (
input: CapabilityCheckInput,
) => Effect.Effect<void, CommandPolicyV2Error>;
@@ -175,7 +187,7 @@ const ensureQueuedMessages: CommandPolicyV2Shape["ensureQueuedMessages"] = (inpu
);
const decideSteeringExecution: CommandPolicyV2Shape["decideSteeringExecution"] = (input) => {
if (input.capabilities.turns.supportsActiveSteering) {
if (!input.forceRestart && input.capabilities.turns.supportsActiveSteering) {
return Effect.succeed("active_steering");
}
if (
@@ -264,6 +276,27 @@ const ensureContextHandoff: CommandPolicyV2Shape["ensureContextHandoff"] = (inpu
return Effect.void;
};
const decideForkExecution: CommandPolicyV2Shape["decideForkExecution"] = (input) => {
const canForkNatively =
input.sameProvider &&
input.hasStrongNativeSource &&
input.capabilities.threads.canForkThread &&
(!input.fromSpecificTurn || input.capabilities.threads.canForkFromTurn) &&
input.capabilities.identity.nativeThreadIds === "strong";
if (canForkNatively) {
return Effect.succeed("native_fork");
}
return ensureContextHandoff({
commandId: input.commandId,
threadId: input.threadId,
provider: input.provider,
capabilities: input.capabilities,
strategy: "full_thread_summary",
}).pipe(Effect.as("portable_context"));
};
const decideMessageDispatch: CommandPolicyV2Shape["decideMessageDispatch"] = (input) => {
const activeRun = input.projection.runs.find(
(run) => run.status === "starting" || run.status === "running" || run.status === "waiting",
@@ -359,6 +392,7 @@ export const layer: Layer.Layer<CommandPolicyV2> = Layer.succeed(CommandPolicyV2
decideSteeringExecution,
ensureInterrupt,
ensureNativeFork,
decideForkExecution,
ensureRollback,
ensureContextHandoff,
});
@@ -0,0 +1,161 @@
import * as NodeServices from "@effect/platform-node/NodeServices";
import { assert, it } from "@effect/vitest";
import {
CommandId,
MessageId,
ProjectId,
ThreadId,
type OrchestrationV2ThreadProjection,
} from "@t3tools/contracts";
import * as Console from "effect/Console";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import { describe } from "vite-plus/test";
import { CheckpointStoreLive } from "../checkpointing/Layers/CheckpointStore.ts";
import { ServerConfig } from "../config.ts";
import { SqlitePersistenceMemory } from "../persistence/Layers/Sqlite.ts";
import { ServerSettingsService } from "../serverSettings.ts";
import * as VcsDriverRegistry from "../vcs/VcsDriverRegistry.ts";
import * as VcsProcess from "../vcs/VcsProcess.ts";
import { OrchestratorV2 } from "./Orchestrator.ts";
import { OrchestrationV2LayerLive } from "./runtimeLayer.ts";
import { CURSOR_MODEL_SELECTION } from "./testkit/fixtures/shared.ts";
const serverConfigLayer = ServerConfig.layerTest(process.cwd(), {
prefix: "t3-cursor-v2-live-",
});
const vcsDriverRegistryLayer = VcsDriverRegistry.layer.pipe(
Layer.provide(VcsProcess.layer),
Layer.provide(serverConfigLayer),
Layer.provide(NodeServices.layer),
);
const checkpointStoreLayer = CheckpointStoreLive.pipe(Layer.provide(vcsDriverRegistryLayer));
const liveLayer = OrchestrationV2LayerLive.pipe(
Layer.provide(SqlitePersistenceMemory),
Layer.provide(checkpointStoreLayer),
Layer.provide(serverConfigLayer),
Layer.provide(
ServerSettingsService.layerTest({
providers: {
cursor: { enabled: true },
},
}),
),
Layer.provide(NodeServices.layer),
);
const waitForIdle = Effect.fn("CursorOrchestratorV2Live.waitForIdle")(function* (
threadId: ThreadId,
) {
const orchestrator = yield* OrchestratorV2;
for (let attempt = 0; attempt < 600; attempt += 1) {
const projection = yield* orchestrator.getThreadProjection(threadId);
if (
projection.runs.length > 0 &&
projection.runs.every(
(run) => !["queued", "starting", "running", "waiting"].includes(run.status),
)
) {
return projection;
}
yield* Effect.sleep("500 millis");
}
return yield* Effect.die(new Error(`Timed out waiting for Cursor thread ${threadId}.`));
});
describe.runIf(process.env.T3_CURSOR_LIVE_ORCHESTRATOR === "1")(
"Cursor V2 live orchestrator",
() => {
it.live(
"forks through portable context using real Cursor agents",
() =>
Effect.gen(function* () {
const orchestrator = yield* OrchestratorV2;
const projectId = ProjectId.make("project:cursor-live-portable-fork");
const sourceThreadId = ThreadId.make("thread:cursor-live-portable-fork:source");
const targetThreadId = ThreadId.make("thread:cursor-live-portable-fork:target");
const marker = "CURSOR_LIVE_PORTABLE_FORK_7H3Q";
yield* orchestrator.dispatch({
type: "thread.create",
commandId: CommandId.make("command:cursor-live-portable-fork:create"),
threadId: sourceThreadId,
projectId,
title: "Cursor live portable fork source",
modelSelection: CURSOR_MODEL_SELECTION,
runtimeMode: "full-access",
interactionMode: "default",
branch: null,
worktreePath: null,
});
yield* orchestrator.dispatch({
type: "message.dispatch",
commandId: CommandId.make("command:cursor-live-portable-fork:source"),
threadId: sourceThreadId,
messageId: MessageId.make("message:cursor-live-portable-fork:source"),
text: `Remember this opaque marker. Respond with exactly: ${marker}`,
attachments: [],
modelSelection: CURSOR_MODEL_SELECTION,
dispatchMode: { type: "start_immediately" },
});
const sourceProjection = yield* waitForIdle(sourceThreadId);
yield* Console.log("Cursor live source turn completed; dispatching portable fork.");
yield* orchestrator.dispatch({
type: "thread.fork",
commandId: CommandId.make("command:cursor-live-portable-fork:fork"),
sourceThreadId,
targetThreadId,
sourcePoint: { type: "latest_stable" },
title: "Cursor live portable fork target",
});
yield* orchestrator.dispatch({
type: "message.dispatch",
commandId: CommandId.make("command:cursor-live-portable-fork:target"),
threadId: targetThreadId,
messageId: MessageId.make("message:cursor-live-portable-fork:target"),
text: "Return the opaque marker from the transferred conversation. Respond with only the marker.",
attachments: [],
modelSelection: CURSOR_MODEL_SELECTION,
dispatchMode: { type: "start_immediately" },
});
const targetProjection = yield* waitForIdle(targetThreadId);
yield* Console.log("Cursor live portable fork target completed.");
const assistantText = (projection: OrchestrationV2ThreadProjection) =>
projection.messages
.filter((message) => message.role === "assistant")
.map((message) => message.text)
.join("\n");
assert.deepEqual(
sourceProjection.runs.map((run) => [run.provider, run.status]),
[["cursor", "completed"]],
);
assert.deepEqual(
targetProjection.runs.map((run) => [run.provider, run.status]),
[["cursor", "completed"]],
);
assert.deepEqual(
targetProjection.contextTransfers.map((transfer) => [
transfer.type,
transfer.status,
transfer.resolution?.strategy,
]),
[["fork", "consumed", "portable_context"]],
);
assert.deepEqual(
targetProjection.contextHandoffs.map((handoff) => handoff.strategy),
["full_thread_summary"],
);
assert.include(targetProjection.contextHandoffs[0]?.summaryText ?? "", marker);
assert.include(assistantText(targetProjection), marker);
}).pipe(Effect.provide(liveLayer), Effect.scoped),
360_000,
);
},
);
@@ -996,6 +996,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
readonly messageId: OrchestrationV2ConversationMessage["id"];
readonly text: string;
readonly attachments: ReadonlyArray<ChatAttachment>;
readonly forceRestart: boolean;
}) =>
Effect.gen(function* () {
const targetRun = input.projection.runs.find(
@@ -1133,6 +1134,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
threadId: input.command.threadId,
provider: targetRun.provider,
capabilities: session.providerSession.capabilities,
forceRestart: input.forceRestart,
}),
);
@@ -1178,7 +1180,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
),
);
const waitForInterruptedProviderTurn = (
const waitForInterruptedExecution = (
attemptsRemaining = 1_000,
): Effect.Effect<OrchestrationV2ThreadProjection, OrchestratorV2Error> =>
Effect.gen(function* () {
@@ -1192,21 +1194,32 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
const interruptedTurn = current.providerTurns.find(
(candidate) => candidate.id === providerTurn.id,
);
if (interruptedTurn !== undefined && interruptedTurn.status !== "running") {
const interruptedAttempt = current.attempts.find(
(candidate) => candidate.id === targetRun.activeAttemptId,
);
const interruptedRun = current.runs.find((candidate) => candidate.id === targetRun.id);
if (
interruptedTurn !== undefined &&
interruptedTurn.status !== "running" &&
interruptedAttempt !== undefined &&
interruptedAttempt.status !== "running" &&
interruptedRun !== undefined &&
!["queued", "starting", "running", "waiting"].includes(interruptedRun.status)
) {
return current;
}
if (attemptsRemaining <= 0) {
return yield* new OrchestratorDispatchError({
commandId: input.command.commandId,
commandType: input.command.type,
cause: `Provider turn ${providerTurn.id} did not terminalize before steering restart.`,
cause: `Provider turn ${providerTurn.id} and attempt ${targetRun.activeAttemptId} did not terminalize before steering restart.`,
});
}
yield* Effect.yieldNow;
return yield* waitForInterruptedProviderTurn(attemptsRemaining - 1);
return yield* waitForInterruptedExecution(attemptsRemaining - 1);
});
const postInterruptProjection = yield* waitForInterruptedProviderTurn();
const postInterruptProjection = yield* waitForInterruptedExecution();
const currentAttempt = postInterruptProjection.attempts.find(
(candidate) => candidate.id === targetRun.activeAttemptId,
@@ -1432,7 +1445,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
const modelSelection = command.modelSelection ?? projection.thread.modelSelection;
const dispatchMode = command.dispatchMode;
if (dispatchMode.type === "steer_active") {
if (dispatchMode.type === "steer_active" || dispatchMode.type === "restart_active") {
yield* dispatchSteerIntoRun({
command,
events,
@@ -1442,6 +1455,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
messageId: command.messageId,
text: command.text,
attachments: command.attachments,
forceRestart: dispatchMode.type === "restart_active",
});
return;
}
@@ -1745,12 +1759,6 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
(candidate) => candidate.id === sourceRun.activeAttemptId,
)?.providerTurnId ??
undefined);
const canResolveForkNatively =
pendingForkTransfer !== undefined &&
pendingForkTransfer.sourceProvider === modelSelection.instanceId &&
sourceProviderThread?.nativeThreadRef?.strength === "strong";
const requiresPortableFork = pendingForkTransfer !== undefined && !canResolveForkNatively;
if (pendingForkTransfer !== undefined) {
if (sourceRun === null || sourceProviderThread === undefined) {
return yield* new OrchestratorDispatchError({
@@ -1825,6 +1833,23 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
}),
),
);
const forkExecution =
pendingForkTransfer === undefined
? null
: yield* enforceCommandPolicy(command)(
commandPolicy.decideForkExecution({
commandId: command.commandId,
threadId: command.threadId,
provider: modelSelection.instanceId,
capabilities: session.providerSession.capabilities,
sameProvider: pendingForkTransfer.sourceProvider === modelSelection.instanceId,
hasStrongNativeSource: sourceProviderThread?.nativeThreadRef?.strength === "strong",
fromSpecificTurn: sourceRun !== null,
}),
);
const canResolveForkNatively = forkExecution === "native_fork";
const requiresPortableFork = forkExecution === "portable_context";
if (canResolveForkNatively) {
yield* enforceCommandPolicy(command)(
commandPolicy.ensureNativeFork({
@@ -1906,17 +1931,6 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
);
return itemRun !== undefined && itemRun.ordinal <= sourceRun.ordinal;
});
if (requiresPortableFork) {
yield* enforceCommandPolicy(command)(
commandPolicy.ensureContextHandoff({
commandId: command.commandId,
threadId: command.threadId,
provider: modelSelection.instanceId,
capabilities: session.providerSession.capabilities,
strategy: "full_thread_summary",
}),
);
}
const portableForkHandoff =
!requiresPortableFork ||
pendingForkTransfer === undefined ||
@@ -3095,6 +3109,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
messageId: queuedMessage.id,
text: queuedMessage.text,
attachments: queuedMessage.attachments,
forceRestart: false,
});
});
@@ -403,6 +403,48 @@ function makePendingRuntimeRequestEvents(input: {
});
}
it.effect("ProviderSessionManagerV2 releases live sessions when its layer shuts down", () =>
Effect.gen(function* () {
const state = yield* Ref.make(emptyState);
const effect = Effect.gen(function* () {
const eventSink = yield* EventSinkV2;
const idAllocator = yield* IdAllocatorV2;
const manager = yield* ProviderSessionManagerV2;
const now = yield* DateTime.now;
const threadId = ThreadId.make("thread-provider-session-manager-shutdown");
const providerSessionId = yield* idAllocator.allocate.providerSession({
provider: "codex",
threadId,
});
yield* eventSink.write({
events: [yield* makeThreadCreatedEvent({ idAllocator, threadId, now })],
});
yield* manager.open({
threadId,
providerSessionId,
modelSelection,
runtimePolicy,
});
const liveState = yield* Ref.get(state);
assert.equal(liveState.openCount, 1);
assert.equal(liveState.closeCount, 0);
});
yield* effect.pipe(
Effect.provide(
makeTestLayer({
state,
idleTimeoutMs: 60_000,
}),
),
);
assert.equal((yield* Ref.get(state)).closeCount, 1);
}),
);
it.effect(
"ProviderSessionManagerV2 issues MCP credentials before opening and revokes them on close",
() =>
@@ -650,6 +650,28 @@ export const layerWithOptions = (
};
};
yield* Effect.addFinalizer(() =>
Effect.gen(function* () {
const activeSessions = [...(yield* Ref.get(sessions)).values()];
yield* Effect.forEach(
activeSessions,
(entry) =>
releaseEntry({
providerSessionId: entry.runtime.providerSessionId,
reason: "server_shutdown",
}).pipe(
Effect.catchCause((cause) =>
Effect.logWarning("orchestration-v2.provider-session.shutdown-release-failed", {
providerSessionId: entry.runtime.providerSessionId,
cause,
}),
),
),
{ discard: true },
);
}),
);
return ProviderSessionManagerV2.of({
open: (input) =>
Effect.gen(function* () {
@@ -5,13 +5,20 @@ import {
type ClaudeAdapterV2DriverEnv,
} from "./Adapters/ClaudeAdapterV2.ts";
import { CodexAdapterV2Driver, type CodexAdapterV2DriverEnv } from "./Adapters/CodexAdapterV2.ts";
import {
CursorAdapterV2Driver,
type CursorAdapterV2DriverEnv,
} from "./Adapters/CursorAdapterV2.ts";
import type { AnyProviderAdapterDriver } from "./ProviderAdapterDriver.ts";
export type BuiltInProviderAdapterDriversV2Env = ClaudeAdapterV2DriverEnv | CodexAdapterV2DriverEnv;
export type BuiltInProviderAdapterDriversV2Env =
| ClaudeAdapterV2DriverEnv
| CodexAdapterV2DriverEnv
| CursorAdapterV2DriverEnv;
export const BUILT_IN_PROVIDER_ADAPTER_DRIVERS_V2: ReadonlyArray<
AnyProviderAdapterDriver<BuiltInProviderAdapterDriversV2Env>
> = [CodexAdapterV2Driver, ClaudeAdapterV2Driver];
> = [CodexAdapterV2Driver, ClaudeAdapterV2Driver, CursorAdapterV2Driver];
export const BUILT_IN_PROVIDER_ADAPTER_DRIVER_KINDS_V2: ReadonlySet<ProviderDriverKind> = new Set(
BUILT_IN_PROVIDER_ADAPTER_DRIVERS_V2.map((driver) => driver.driverKind),
@@ -6,6 +6,8 @@ import {
} from "./Adapters/ClaudeAdapterV2.ts";
import { layer as codexAdapterLayer } from "./Adapters/CodexAdapterV2.ts";
import { codexAppServerClientFactoryFromSettingsLayer } from "./Adapters/CodexAdapterV2.ts";
import { cursorAgentSdkRunnerLiveLayer } from "./Adapters/CursorAgentSdk.ts";
import { BUILT_IN_PROVIDER_ADAPTER_DRIVERS_V2 } from "./builtInProviderAdapterDrivers.ts";
import { layer as checkpointServiceLayer } from "./CheckpointService.ts";
import { layer as commandPolicyLayer } from "./CommandPolicy.ts";
import { layer as commandReceiptStoreLayer } from "./CommandReceiptStore.ts";
@@ -44,6 +46,7 @@ const codexAdapterProvided = codexAdapterLayer.pipe(
const claudeAdapterProvided = claudeAdapterLayer.pipe(
Layer.provide(claudeAgentSdkQueryRunnerLiveLayer),
Layer.provide(cursorAgentSdkRunnerLiveLayer),
Layer.provide(idAllocatorLayer),
);
@@ -6,9 +6,11 @@ import * as FileSystem from "effect/FileSystem";
import { ClaudeOrchestratorReplayHarness } from "../Adapters/ClaudeAdapterV2.testkit.ts";
import { CodexOrchestratorReplayHarness } from "../Adapters/CodexAdapterV2.testkit.ts";
import { CursorOrchestratorReplayHarness } from "../Adapters/CursorAdapterV2.testkit.ts";
import { layer as idAllocatorLayer } from "../IdAllocator.ts";
import { provideDeterministicTestRuntime } from "./DeterministicRuntime.ts";
import { ORCHESTRATOR_REPLAY_FIXTURES } from "./fixtures/index.ts";
import { messageRestartInput } from "./fixtures/message_steering/input.ts";
import {
materializeFixtureInput,
type OrchestratorFixtureInput,
@@ -89,6 +91,11 @@ function runFixtureProviderWithRegisteredHarness(input: {
...input,
harness: ClaudeOrchestratorReplayHarness,
}).pipe(Effect.mapError(normalizeTestError), Effect.scoped);
case "cursor":
return runFixtureProvider({
...input,
harness: CursorOrchestratorReplayHarness,
}).pipe(Effect.mapError(normalizeTestError), Effect.scoped);
default:
return Effect.die(
new Error(`No replay harness registered for provider ${input.provider.provider}.`),
@@ -110,4 +117,20 @@ describe("orchestrator replay fixtures", () => {
);
}
}
const steeringFixture = ORCHESTRATOR_REPLAY_FIXTURES.find(
(fixture) => fixture.name === "message_steering",
);
const cursorSteeringProvider = steeringFixture?.providers.find(
(provider) => provider.provider === "cursor",
);
if (cursorSteeringProvider !== undefined) {
it.effect("executes explicit Cursor restart_active through the recorded SDK boundary", () =>
runFixtureProviderWithRegisteredHarness({
fixtureName: "message_steering",
buildInput: messageRestartInput,
provider: cursorSteeringProvider,
}),
);
}
});
@@ -11,12 +11,22 @@ import {
CodexOrchestratorReplayHarness,
makeCodexProviderAdapterRegistryReplayLayer,
} from "../Adapters/CodexAdapterV2.testkit.ts";
import {
type CursorAgentSdkReplayTranscript,
CursorOrchestratorReplayHarness,
makeCursorAgentSdkReplayRunner,
makeCursorProviderAdapterRegistryReplayLayer,
} from "../Adapters/CursorAdapterV2.testkit.ts";
import { layer as idAllocatorLayer } from "../IdAllocator.ts";
import { makeSqlitePersistenceLive } from "../../persistence/Layers/Sqlite.ts";
import { provideDeterministicTestRuntime } from "./DeterministicRuntime.ts";
import {
CODEX_MODEL_SELECTION,
CURSOR_MODEL_SELECTION,
materializeFixtureInput,
type MaterializedOrchestratorFixtureInput,
PROVIDER_THREAD_RESUME_FIRST_PROMPT,
PROVIDER_THREAD_RESUME_SECOND_PROMPT,
} from "./fixtures/shared.ts";
import {
assertAssistantTextIncludes,
@@ -31,25 +41,29 @@ import {
import { runOrchestratorV2ProviderReplayScenario } from "./ProviderReplayHarness.ts";
import { decodeProviderReplayNdjson } from "./ReplayTranscriptNdjson.ts";
const FIRST_PROMPT = "Respond with exactly: provider thread resume fixture first turn complete";
const SECOND_PROMPT =
"Using the conversation history available in this resumed thread, first repeat the exact final answer you gave in the previous turn. Then on a new line write exactly: provider thread resume fixture second turn complete";
const FIRST_FINAL = "provider thread resume fixture first turn complete";
const SECOND_FINAL = "provider thread resume fixture second turn complete";
const decodeCodexTranscript = Schema.decodeUnknownEffect(
CodexReplay.CodexAppServerReplayTranscript,
);
const readCodexTranscript = Effect.fn("readCodexRecoveryTranscript")(function* () {
const file = new URL(
"./fixtures/provider_thread_resume/codex_transcript.ndjson",
import.meta.url,
);
const readRawTranscript = Effect.fn("readRecoveryTranscript")(function* (file: URL) {
const fs = yield* FileSystem.FileSystem;
const text = yield* fs.readFileString(decodeURIComponent(file.pathname));
const transcript = yield* decodeProviderReplayNdjson(text);
return yield* decodeProviderReplayNdjson(text);
});
const readCodexTranscript = Effect.fn("readCodexRecoveryTranscript")(function* () {
const transcript = yield* readRawTranscript(
new URL("./fixtures/provider_thread_resume/codex_transcript.ndjson", import.meta.url),
);
return yield* decodeCodexTranscript(transcript);
});
const readCursorTranscript = Effect.fn("readCursorRecoveryTranscript")(function* () {
const transcript = yield* readRawTranscript(
new URL("./fixtures/provider_thread_resume/cursor_transcript.ndjson", import.meta.url),
);
return yield* CursorOrchestratorReplayHarness.decodeTranscript(transcript);
});
function splitAfterFirstIdle(materialized: MaterializedOrchestratorFixtureInput) {
const splitIndex = materialized.steps.findIndex((step) => step.type === "await_thread_idle");
@@ -67,6 +81,94 @@ function splitAfterFirstIdle(materialized: MaterializedOrchestratorFixtureInput)
};
}
const runCursorRecovery = Effect.fn("runCursorRecovery")(function* (input: {
readonly transcript: CursorAgentSdkReplayTranscript;
readonly runner: ReturnType<typeof makeCursorAgentSdkReplayRunner>;
}) {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const tempDir = yield* Effect.acquireRelease(
fs.makeTempDirectory({
prefix: "t3-orchestration-v2-cursor-recovery-",
}),
(directory) => fs.remove(directory, { recursive: true, force: true }).pipe(Effect.orDie),
);
yield* fs.makeDirectory(tempDir, { recursive: true });
const dbPath = path.join(tempDir, "state.sqlite");
const materialized = yield* materializeFixtureInput({
scenario: "provider_thread_resume",
fixtureInput: {
steps: [
{ type: "message", text: PROVIDER_THREAD_RESUME_FIRST_PROMPT },
{ type: "message", text: PROVIDER_THREAD_RESUME_SECOND_PROMPT },
],
},
modelSelection: CURSOR_MODEL_SELECTION,
});
const { phase1Commands, phase1Steps, phase2Commands, phase2Steps } =
splitAfterFirstIdle(materialized);
const options = {
databaseLayer: makeSqlitePersistenceLive(dbPath).pipe(Layer.provide(NodeServices.layer)),
};
const harness = {
...CursorOrchestratorReplayHarness,
makeProviderAdapterRegistryLayer: () =>
makeCursorProviderAdapterRegistryReplayLayer(input.transcript, {
runner: input.runner,
assertCompleteOnFinalize: false,
}),
};
yield* Effect.scoped(
runOrchestratorV2ProviderReplayScenario(
{
name: "provider_thread_resume/cursor:first-runtime",
transcript: input.transcript,
commands: phase1Commands,
steps: phase1Steps,
projectionThreadIds: materialized.projectionThreadIds,
runtimePolicyOverride: { cwd: tempDir },
},
harness,
options,
),
);
const result = yield* Effect.scoped(
runOrchestratorV2ProviderReplayScenario(
{
name: "provider_thread_resume/cursor:second-runtime",
transcript: input.transcript,
commands: phase2Commands,
steps: phase2Steps,
projectionThreadIds: materialized.projectionThreadIds,
runtimePolicyOverride: { cwd: tempDir },
},
harness,
options,
),
);
assertBaseProjection({
result,
transcript: input.transcript,
runCount: 2,
runStatuses: ["completed", "completed"],
});
const projection = projectionFor(result, input.transcript.scenario);
assertSemanticProjectionIntegrity(projection);
assertRunOrdinals(projection, [1, 2]);
assertConversationMessageRoles(projection, ["user", "assistant", "user", "assistant"]);
assertTurnItemTypes(projection, ["user_message", "assistant_message"]);
assertUserMessagesInclude(projection, [
PROVIDER_THREAD_RESUME_FIRST_PROMPT,
PROVIDER_THREAD_RESUME_SECOND_PROMPT,
]);
assertAssistantTextIncludes(projection, FIRST_FINAL);
assertAssistantTextIncludes(projection, SECOND_FINAL);
assert.lengthOf(projection.providerThreads, 1);
});
describe("orchestrator replay recovery", () => {
it.effect(
"resumes a provider-native Codex thread after recreating the orchestrator runtime",
@@ -90,8 +192,8 @@ describe("orchestrator replay recovery", () => {
scenario: "provider_thread_resume",
fixtureInput: {
steps: [
{ type: "message", text: FIRST_PROMPT },
{ type: "message", text: SECOND_PROMPT },
{ type: "message", text: PROVIDER_THREAD_RESUME_FIRST_PROMPT },
{ type: "message", text: PROVIDER_THREAD_RESUME_SECOND_PROMPT },
],
},
modelSelection: CODEX_MODEL_SELECTION,
@@ -145,7 +247,10 @@ describe("orchestrator replay recovery", () => {
assertRunOrdinals(projection, [1, 2]);
assertConversationMessageRoles(projection, ["user", "assistant", "user", "assistant"]);
assertTurnItemTypes(projection, ["user_message", "assistant_message"]);
assertUserMessagesInclude(projection, [FIRST_PROMPT, SECOND_PROMPT]);
assertUserMessagesInclude(projection, [
PROVIDER_THREAD_RESUME_FIRST_PROMPT,
PROVIDER_THREAD_RESUME_SECOND_PROMPT,
]);
assertAssistantTextIncludes(projection, FIRST_FINAL);
assertAssistantTextIncludes(projection, SECOND_FINAL);
assert.lengthOf(projection.providerThreads, 1);
@@ -155,4 +260,20 @@ describe("orchestrator replay recovery", () => {
),
),
);
it.effect(
"resumes a provider-native Cursor thread after recreating the orchestrator runtime",
() =>
Effect.scoped(
Effect.gen(function* () {
const transcript = yield* readCursorTranscript();
const runner = makeCursorAgentSdkReplayRunner(transcript);
yield* runCursorRecovery({ transcript, runner });
yield* runner.assertComplete;
}).pipe(
provideDeterministicTestRuntime,
Effect.provide(Layer.merge(idAllocatorLayer, NodeServices.layer)),
),
),
);
});
@@ -133,6 +133,19 @@ const findPendingRuntimeRequest = (projection: OrchestrationV2ThreadProjection)
const hasActiveRun = (projection: OrchestrationV2ThreadProjection) =>
projection.runs.some((run) => ["queued", "starting", "running", "waiting"].includes(run.status));
const SCENARIO_WAIT_ATTEMPTS = 10_000;
const yieldToRuntime = Effect.yieldNow.pipe(
Effect.andThen(
Effect.promise(
() =>
new Promise<void>((resolve) => {
setImmediate(resolve);
}),
),
),
);
function collectProjectionThreadIds(scenario: OrchestratorV2Scenario): ReadonlyArray<ThreadId> {
if (scenario.projectionThreadIds) {
return scenario.projectionThreadIds;
@@ -187,7 +200,7 @@ export function runOrchestratorV2Scenario(
const waitForPendingRuntimeRequest = (
threadId: ThreadId,
attemptsRemaining = 1_000,
attemptsRemaining = SCENARIO_WAIT_ATTEMPTS,
): Effect.Effect<
OrchestrationV2RuntimeRequest,
OrchestratorV2Error | OrchestratorV2ScenarioStepError,
@@ -205,13 +218,13 @@ export function runOrchestratorV2Scenario(
step: `respond_to_next_runtime_request:${threadId}`,
});
}
yield* Effect.yieldNow;
yield* yieldToRuntime;
return yield* waitForPendingRuntimeRequest(threadId, attemptsRemaining - 1);
});
const waitForThreadIdle = (
threadId: ThreadId,
attemptsRemaining = 1_000,
attemptsRemaining = SCENARIO_WAIT_ATTEMPTS,
): Effect.Effect<void, OrchestratorV2Error | OrchestratorV2ScenarioStepError, never> =>
Effect.gen(function* () {
const projection = yield* orchestrator.getThreadProjection(threadId);
@@ -224,14 +237,14 @@ export function runOrchestratorV2Scenario(
step: `await_thread_idle:${threadId}`,
});
}
yield* Effect.yieldNow;
yield* yieldToRuntime;
return yield* waitForThreadIdle(threadId, attemptsRemaining - 1);
});
const waitForRunSteerable = (
threadId: ThreadId,
runId: OrchestrationV2Run["id"],
attemptsRemaining = 1_000,
attemptsRemaining = SCENARIO_WAIT_ATTEMPTS,
): Effect.Effect<void, OrchestratorV2Error | OrchestratorV2ScenarioStepError, never> =>
Effect.gen(function* () {
const projection = yield* orchestrator.getThreadProjection(threadId);
@@ -251,7 +264,7 @@ export function runOrchestratorV2Scenario(
step: `await_run_steerable:${runId}`,
});
}
yield* Effect.yieldNow;
yield* yieldToRuntime;
return yield* waitForRunSteerable(threadId, runId, attemptsRemaining - 1);
});
@@ -259,7 +272,7 @@ export function runOrchestratorV2Scenario(
threadId: ThreadId,
runId: OrchestrationV2Run["id"],
itemType: OrchestrationV2TurnItem["type"],
attemptsRemaining = 1_000,
attemptsRemaining = SCENARIO_WAIT_ATTEMPTS,
): Effect.Effect<void, OrchestratorV2Error | OrchestratorV2ScenarioStepError, never> =>
Effect.gen(function* () {
const projection = yield* orchestrator.getThreadProjection(threadId);
@@ -275,7 +288,7 @@ export function runOrchestratorV2Scenario(
step: `await_run_turn_item:${runId}:${itemType}`,
});
}
yield* Effect.yieldNow;
yield* yieldToRuntime;
return yield* waitForRunTurnItem(threadId, runId, itemType, attemptsRemaining - 1);
});
@@ -23,6 +23,7 @@ import * as Stream from "effect/Stream";
import { ClaudeProviderCapabilitiesV2 } from "../Adapters/ClaudeAdapterV2.ts";
import { CodexProviderCapabilitiesV2 } from "../Adapters/CodexAdapterV2.ts";
import { CursorProviderCapabilitiesV2 } from "../Adapters/CursorAdapterV2.ts";
import { OrchestratorV2 } from "../Orchestrator.ts";
import {
type ProviderAdapterV2Event,
@@ -30,7 +31,11 @@ import {
type ProviderAdapterV2Shape,
} from "../ProviderAdapter.ts";
import { makeLayer as makeProviderAdapterRegistryLayer } from "../ProviderAdapterRegistry.ts";
import { CLAUDE_MODEL_SELECTION, CODEX_MODEL_SELECTION } from "./fixtures/shared.ts";
import {
CLAUDE_MODEL_SELECTION,
CODEX_MODEL_SELECTION,
CURSOR_MODEL_SELECTION,
} from "./fixtures/shared.ts";
import { makeOrchestratorV2ReplayLayerWithRegistry } from "./ProviderReplayHarness.ts";
import { checkpointWorkspace } from "./ReplayFixtureWorkspace.ts";
@@ -513,6 +518,130 @@ describe("orchestration v2 provider switching", () => {
),
);
it.live("resolves a same-provider Cursor fork with portable context", () =>
Effect.scoped(
Effect.gen(function* () {
const sourceThreadId = ThreadId.make("thread:cursor-portable-fork:source");
const targetThreadId = ThreadId.make("thread:cursor-portable-fork:target");
const sourcePrompt = "Remember that the deployment marker is indigo.";
const sourceResponse = "I will remember indigo.";
const targetPrompt = "What deployment marker did we choose?";
const cwd = yield* checkpointWorkspace("cursor-portable-fork");
const capturedTurns = yield* Ref.make<ReadonlyArray<CapturedTurn>>([]);
const registryLayer = makeProviderAdapterRegistryLayer([
makeTestAdapter({
instanceId: ProviderInstanceId.make("cursor"),
provider: "cursor",
capabilities: CursorProviderCapabilitiesV2,
modelSelection: CURSOR_MODEL_SELECTION,
responseByRunOrdinal: {},
responseByThreadId: {
[sourceThreadId]: { 1: sourceResponse },
[targetThreadId]: { 1: "The deployment marker is indigo." },
},
capturedTurns,
}),
]);
const commands = [
{
type: "thread.create",
commandId: CommandId.make("command:cursor-portable-fork:create"),
threadId: sourceThreadId,
projectId,
title: "Cursor portable fork source",
modelSelection: CURSOR_MODEL_SELECTION,
runtimeMode: "full-access",
interactionMode: "default",
branch: null,
worktreePath: null,
},
{
type: "message.dispatch",
commandId: CommandId.make("command:cursor-portable-fork:source"),
threadId: sourceThreadId,
messageId: MessageId.make("message:cursor-portable-fork:source"),
text: sourcePrompt,
attachments: [],
modelSelection: CURSOR_MODEL_SELECTION,
dispatchMode: { type: "start_immediately" },
},
{
type: "thread.fork",
commandId: CommandId.make("command:cursor-portable-fork:fork"),
sourceThreadId,
targetThreadId,
sourcePoint: { type: "latest_stable" },
title: "Cursor portable fork target",
},
{
type: "message.dispatch",
commandId: CommandId.make("command:cursor-portable-fork:target"),
threadId: targetThreadId,
messageId: MessageId.make("message:cursor-portable-fork:target"),
text: targetPrompt,
attachments: [],
modelSelection: CURSOR_MODEL_SELECTION,
dispatchMode: { type: "start_immediately" },
},
] satisfies ReadonlyArray<OrchestrationV2Command>;
const targetProjection = yield* Effect.gen(function* () {
const orchestrator = yield* OrchestratorV2;
yield* orchestrator.dispatch(commands[0]!);
yield* orchestrator.dispatch(commands[1]!);
yield* waitForIdle(sourceThreadId);
yield* orchestrator.dispatch(commands[2]!);
yield* orchestrator.dispatch(commands[3]!);
return yield* waitForIdle(targetThreadId);
}).pipe(
Effect.provide(
makeOrchestratorV2ReplayLayerWithRegistry(
{
name: "cursor-portable-fork",
runtimePolicyOverride: {
cwd,
approvalPolicy: "never",
sandboxPolicy: {
type: "readOnly",
access: { type: "fullAccess" },
networkAccess: false,
},
},
},
registryLayer,
),
),
);
const turns = yield* Ref.get(capturedTurns);
const targetTurn = turns.find((turn) => turn.threadId === targetThreadId);
assert.deepEqual(
targetProjection.runs.map((run) => [run.provider, run.status]),
[["cursor", "completed"]],
);
assert.lengthOf(targetProjection.providerThreads, 1);
assert.equal(targetProjection.providerThreads[0]?.provider, "cursor");
assert.isNull(targetProjection.providerThreads[0]?.forkedFrom);
assert.deepEqual(
targetProjection.contextTransfers.map((transfer) => [
transfer.type,
transfer.status,
transfer.resolution?.strategy,
]),
[["fork", "consumed", "portable_context"]],
);
assert.deepEqual(
targetProjection.contextHandoffs.map((handoff) => handoff.strategy),
["full_thread_summary"],
);
assert.include(targetTurn?.text ?? "", "Context handoff (full_thread_summary):");
assert.include(targetTurn?.text ?? "", sourcePrompt);
assert.include(targetTurn?.text ?? "", sourceResponse);
assert.include(targetTurn?.text ?? "", targetPrompt);
}),
),
);
it.live("switches providers while consuming a pending cross-provider merge-back", () =>
Effect.scoped(
Effect.gen(function* () {
@@ -1,5 +1,6 @@
import { assertClaudeMessageSteeringOutput } from "./message_steering/claude_output.ts";
import { assertMessageSteeringOutput } from "./message_steering/codex_output.ts";
import { assertCursorMessageSteeringOutput } from "./message_steering/cursor_output.ts";
import { messageSteeringInput } from "./message_steering/input.ts";
import { assertMultiTurnClaudeOutput } from "./multi_turn/claude_output.ts";
import { assertMultiTurnOutput } from "./multi_turn/codex_output.ts";
@@ -7,6 +8,7 @@ import { multiTurnInput } from "./multi_turn/input.ts";
import { assertPlanQuestionsOutput } from "./plan_questions/codex_output.ts";
import { planQuestionsInput } from "./plan_questions/input.ts";
import { assertProposedPlanOutput } from "./proposed_plan/codex_output.ts";
import { assertProposedPlanCursorOutput } from "./proposed_plan/cursor_output.ts";
import { proposedPlanInput } from "./proposed_plan/input.ts";
import { assertQueuedTurnOutput } from "./queued_turn/codex_output.ts";
import { queuedTurnInput } from "./queued_turn/input.ts";
@@ -16,14 +18,17 @@ import { simpleInput } from "./simple/input.ts";
import { assertSubagentOutput } from "./subagent/codex_output.ts";
import { assertClaudeSubagentOutput } from "./subagent/claude_output.ts";
import { subagentInput } from "./subagent/input.ts";
import { assertCursorSubagentOutput } from "./subagent/cursor_output.ts";
import { assertSubagentContinueOutput } from "./subagent_continue/codex_output.ts";
import { subagentContinueInput } from "./subagent_continue/input.ts";
import { assertClaudeThreadRollbackOutput } from "./thread_rollback/claude_output.ts";
import { assertThreadRollbackOutput } from "./thread_rollback/codex_output.ts";
import { threadRollbackInput } from "./thread_rollback/input.ts";
import { assertTodoListOutput } from "./todo_list/codex_output.ts";
import { assertTodoListCursorOutput } from "./todo_list/cursor_output.ts";
import { todoListInput } from "./todo_list/input.ts";
import { assertToolCallReadOnlyClaudeOutput } from "./tool_call_read_only/claude_output.ts";
import { assertToolCallReadOnlyCursorOutput } from "./tool_call_read_only/cursor_output.ts";
import { toolCallReadOnlyInput } from "./tool_call_read_only/input.ts";
import { assertToolCallReadOnlyOnRequestClaudeOutput } from "./tool_call_read_only_on_request/claude_output.ts";
import { assertToolCallReadOnlyOnRequestOutput } from "./tool_call_read_only_on_request/codex_output.ts";
@@ -39,6 +44,7 @@ import { assertTurnInterruptOutput } from "./turn_interrupt/codex_output.ts";
import { turnInterruptInput } from "./turn_interrupt/input.ts";
import { assertTurnInterruptMidToolClaudeOutput } from "./turn_interrupt_mid_tool/claude_output.ts";
import { assertTurnInterruptMidToolCodexOutput } from "./turn_interrupt_mid_tool/codex_output.ts";
import { assertTurnInterruptMidToolCursorOutput } from "./turn_interrupt_mid_tool/cursor_output.ts";
import { turnInterruptMidToolInput } from "./turn_interrupt_mid_tool/input.ts";
import { assertTurnInterruptRestartClaudeOutput } from "./turn_interrupt_restart/claude_output.ts";
import { turnInterruptRestartInput } from "./turn_interrupt_restart/input.ts";
@@ -48,6 +54,7 @@ import { webSearchInput } from "./web_search/input.ts";
import {
CLAUDE_MODEL_SELECTION,
CODEX_MODEL_SELECTION,
CURSOR_MODEL_SELECTION,
READ_ONLY_NEVER_POLICY,
READ_ONLY_ON_REQUEST_POLICY,
RESTRICTED_GRANULAR_POLICY,
@@ -72,6 +79,12 @@ export const ORCHESTRATOR_REPLAY_FIXTURES = [
modelSelection: CLAUDE_MODEL_SELECTION,
assertOutput: assertSimpleClaudeOutput,
},
{
provider: "cursor",
transcriptFile: new URL("./simple/cursor_transcript.ndjson", import.meta.url),
modelSelection: CURSOR_MODEL_SELECTION,
assertOutput: assertSimpleOutput,
},
],
},
{
@@ -85,6 +98,13 @@ export const ORCHESTRATOR_REPLAY_FIXTURES = [
runtimePolicyOverride: READ_ONLY_NEVER_POLICY,
assertOutput: assertToolCallReadOnlyClaudeOutput,
},
{
provider: "cursor",
transcriptFile: new URL("./tool_call_read_only/cursor_transcript.ndjson", import.meta.url),
modelSelection: CURSOR_MODEL_SELECTION,
runtimePolicyOverride: READ_ONLY_NEVER_POLICY,
assertOutput: assertToolCallReadOnlyCursorOutput,
},
],
},
{
@@ -182,6 +202,13 @@ export const ORCHESTRATOR_REPLAY_FIXTURES = [
modelSelection: CLAUDE_MODEL_SELECTION,
assertOutput: assertClaudeSubagentOutput,
},
{
provider: "cursor",
transcriptFile: new URL("./subagent/cursor_transcript.ndjson", import.meta.url),
modelSelection: CURSOR_MODEL_SELECTION,
runtimePolicyOverride: READ_ONLY_NEVER_POLICY,
assertOutput: assertCursorSubagentOutput,
},
],
},
{
@@ -212,6 +239,12 @@ export const ORCHESTRATOR_REPLAY_FIXTURES = [
modelSelection: CLAUDE_MODEL_SELECTION,
assertOutput: assertMultiTurnClaudeOutput,
},
{
provider: "cursor",
transcriptFile: new URL("./multi_turn/cursor_transcript.ndjson", import.meta.url),
modelSelection: CURSOR_MODEL_SELECTION,
assertOutput: assertMultiTurnOutput,
},
],
},
{
@@ -242,6 +275,12 @@ export const ORCHESTRATOR_REPLAY_FIXTURES = [
modelSelection: CLAUDE_MODEL_SELECTION,
assertOutput: assertQueuedTurnOutput,
},
{
provider: "cursor",
transcriptFile: new URL("./queued_turn/cursor_transcript.ndjson", import.meta.url),
modelSelection: CURSOR_MODEL_SELECTION,
assertOutput: assertQueuedTurnOutput,
},
],
},
{
@@ -255,6 +294,13 @@ export const ORCHESTRATOR_REPLAY_FIXTURES = [
runtimePolicyOverride: READ_ONLY_NEVER_POLICY,
assertOutput: assertTodoListOutput,
},
{
provider: "cursor",
transcriptFile: new URL("./todo_list/cursor_transcript.ndjson", import.meta.url),
modelSelection: CURSOR_MODEL_SELECTION,
runtimePolicyOverride: READ_ONLY_NEVER_POLICY,
assertOutput: assertTodoListCursorOutput,
},
],
},
{
@@ -299,6 +345,13 @@ export const ORCHESTRATOR_REPLAY_FIXTURES = [
runtimePolicyOverride: READ_ONLY_NEVER_POLICY,
assertOutput: assertProposedPlanOutput,
},
{
provider: "cursor",
transcriptFile: new URL("./proposed_plan/cursor_transcript.ndjson", import.meta.url),
modelSelection: CURSOR_MODEL_SELECTION,
runtimePolicyOverride: READ_ONLY_NEVER_POLICY,
assertOutput: assertProposedPlanCursorOutput,
},
],
},
{
@@ -317,6 +370,12 @@ export const ORCHESTRATOR_REPLAY_FIXTURES = [
modelSelection: CLAUDE_MODEL_SELECTION,
assertOutput: assertClaudeMessageSteeringOutput,
},
{
provider: "cursor",
transcriptFile: new URL("./message_steering/cursor_transcript.ndjson", import.meta.url),
modelSelection: CURSOR_MODEL_SELECTION,
assertOutput: assertCursorMessageSteeringOutput,
},
],
},
{
@@ -363,6 +422,16 @@ export const ORCHESTRATOR_REPLAY_FIXTURES = [
runtimePolicyOverride: WORKSPACE_NEVER_POLICY,
assertOutput: assertTurnInterruptMidToolClaudeOutput,
},
{
provider: "cursor",
transcriptFile: new URL(
"./turn_interrupt_mid_tool/cursor_transcript.ndjson",
import.meta.url,
),
modelSelection: CURSOR_MODEL_SELECTION,
runtimePolicyOverride: WORKSPACE_NEVER_POLICY,
assertOutput: assertTurnInterruptMidToolCursorOutput,
},
],
},
{
@@ -0,0 +1,52 @@
import { assert } from "@effect/vitest";
import type { ProviderReplayTranscript } from "@t3tools/contracts";
import type { OrchestratorV2ScenarioResult } from "../../OrchestratorScenario.ts";
import {
assertAssistantTextIncludes,
assertBaseProjection,
assertRuntimeRequestCounts,
assertSemanticProjectionIntegrity,
assertTurnItemTypes,
assertUserMessageInputIntents,
assertUserMessagesInclude,
assertVisibleTurnItemsMirrorLocalTurnItems,
MESSAGE_STEERING_INITIAL_PROMPT,
MESSAGE_STEERING_STEER_PROMPT,
projectionFor,
} from "../shared.ts";
export function assertCursorMessageSteeringOutput(
result: OrchestratorV2ScenarioResult,
transcript: ProviderReplayTranscript,
) {
assert.equal(transcript.provider, "cursor");
assertBaseProjection({ result, transcript, runCount: 1, runStatuses: ["completed"] });
const projection = projectionFor(result, transcript.scenario);
assertSemanticProjectionIntegrity(projection);
assertVisibleTurnItemsMirrorLocalTurnItems(projection);
assertTurnItemTypes(projection, ["user_message", "assistant_message"]);
assertRuntimeRequestCounts(projection, { total: 0 });
assertUserMessagesInclude(projection, [
MESSAGE_STEERING_INITIAL_PROMPT,
MESSAGE_STEERING_STEER_PROMPT,
]);
assertUserMessageInputIntents(projection, ["turn_start", "steer"]);
assertAssistantTextIncludes(projection, "steering fixture observed");
assert.lengthOf(projection.runs, 1, "steering must preserve the app run");
assert.deepEqual(
projection.attempts.map((attempt) => [attempt.reason, attempt.status]),
[
["initial", "superseded"],
["steering_restart", "completed"],
],
);
assert.deepEqual(
projection.providerTurns.map((turn) => turn.status),
["interrupted", "completed"],
);
assert.equal(projection.runs[0]?.activeAttemptId, projection.attempts[1]?.id);
assert.equal(projection.runs[0]?.rootNodeId, projection.attempts[1]?.rootNodeId);
}
@@ -0,0 +1,21 @@
{"type":"transcript_start","provider":"cursor","protocol":"cursor-agent-sdk.local","version":"1","scenario":"message_steering","metadata":{"generatedBy":"recordCursorAgentSdkReplayTranscript","nativeAgentId":"agent-95a210ed-ddf9-4b36-b265-9a2b02e46050"}}
{"type":"expect_outbound","label":"agent.open","frame":{"type":"agent.open","operation":"create","options":{"model":{"id":"composer-2.5"},"hasName":true,"mode":"agent","local":{"hasCwd":true,"autoReview":false,"sandboxEnabled":false,"enableAgentRetries":true}}}}
{"type":"emit_inbound","label":"agent.opened","frame":{"type":"agent.opened","agentId":"agent-95a210ed-ddf9-4b36-b265-9a2b02e46050"}}
{"type":"expect_outbound","label":"run.start:1","frame":{"type":"run.start","message":"Respond with exactly: steering fixture initial response","options":{"model":{"id":"composer-2.5"},"mode":"agent"}}}
{"type":"emit_inbound","label":"run.started:1","frame":{"type":"run.started","runId":"run-c794f71d-f53a-47ba-b127-b9f26cf64ce1","agentId":"agent-95a210ed-ddf9-4b36-b265-9a2b02e46050"}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-c794f71d-f53a-47ba-b127-b9f26cf64ce1","update":{"type":"text-delta","text":"ste"}}}
{"type":"expect_outbound","label":"run.cancel:1","frame":{"type":"run.cancel","runId":"run-c794f71d-f53a-47ba-b127-b9f26cf64ce1"}}
{"type":"emit_inbound","label":"run.completed:1","frame":{"type":"run.completed","result":{"id":"run-c794f71d-f53a-47ba-b127-b9f26cf64ce1","requestId":"60f12d12-3cd5-47f1-a4dc-bda43dc5a136","status":"cancelled","model":{"id":"composer-2.5"},"durationMs":4219}}}
{"type":"expect_outbound","label":"run.start:2","frame":{"type":"run.start","message":"Actually, respond with exactly: steering fixture observed","options":{"model":{"id":"composer-2.5"},"mode":"agent"}}}
{"type":"emit_inbound","label":"run.started:2","frame":{"type":"run.started","runId":"run-c93ec26d-f38b-4a58-9005-1ed91ad98b9c","agentId":"agent-95a210ed-ddf9-4b36-b265-9a2b02e46050"}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-c93ec26d-f38b-4a58-9005-1ed91ad98b9c","update":{"type":"text-delta","text":"ste"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-c93ec26d-f38b-4a58-9005-1ed91ad98b9c","update":{"type":"text-delta","text":"ering"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-c93ec26d-f38b-4a58-9005-1ed91ad98b9c","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-c93ec26d-f38b-4a58-9005-1ed91ad98b9c","update":{"type":"text-delta","text":" fixture"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-c93ec26d-f38b-4a58-9005-1ed91ad98b9c","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-c93ec26d-f38b-4a58-9005-1ed91ad98b9c","update":{"type":"text-delta","text":" observed"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-c93ec26d-f38b-4a58-9005-1ed91ad98b9c","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"step-completed","frame":{"type":"interaction.update","runId":"run-c93ec26d-f38b-4a58-9005-1ed91ad98b9c","update":{"type":"step-completed","stepId":1,"stepDurationMs":1055}}}
{"type":"emit_inbound","label":"turn-ended","frame":{"type":"interaction.update","runId":"run-c93ec26d-f38b-4a58-9005-1ed91ad98b9c","update":{"type":"turn-ended","usage":{"inputTokens":10270,"outputTokens":42,"cacheReadTokens":7441,"cacheWriteTokens":0}}}}
{"type":"emit_inbound","label":"run.completed:2","frame":{"type":"run.completed","result":{"id":"run-c93ec26d-f38b-4a58-9005-1ed91ad98b9c","requestId":"21e1995e-2649-4e30-aec6-d967e9bce64c","status":"finished","result":"steering fixture observed","model":{"id":"composer-2.5"},"durationMs":1465}}}
{"type":"expect_outbound","label":"agent.close","frame":{"type":"agent.close","agentId":"agent-95a210ed-ddf9-4b36-b265-9a2b02e46050"}}
@@ -16,3 +16,16 @@ export function messageSteeringInput(): OrchestratorFixtureInput {
],
};
}
export function messageRestartInput(): OrchestratorFixtureInput {
return {
steps: [
{ type: "message", text: MESSAGE_STEERING_INITIAL_PROMPT },
{
type: "restart",
text: MESSAGE_STEERING_STEER_PROMPT,
targetRunIndex: 1,
},
],
};
}
@@ -0,0 +1,30 @@
{"type":"transcript_start","provider":"cursor","protocol":"cursor-agent-sdk.local","version":"1","scenario":"multi_turn","metadata":{"generatedBy":"recordCursorAgentSdkReplayTranscript","nativeAgentId":"agent-93ba82d8-7489-48f7-9b93-b9f65f425666"}}
{"type":"expect_outbound","label":"agent.open","frame":{"type":"agent.open","operation":"create","options":{"model":{"id":"composer-2.5"},"hasName":true,"mode":"agent","local":{"hasCwd":true,"autoReview":false,"sandboxEnabled":false,"enableAgentRetries":true}}}}
{"type":"emit_inbound","label":"agent.opened","frame":{"type":"agent.opened","agentId":"agent-93ba82d8-7489-48f7-9b93-b9f65f425666"}}
{"type":"expect_outbound","label":"run.start:1","frame":{"type":"run.start","message":"Respond with exactly: first fixture turn complete","options":{"model":{"id":"composer-2.5"},"mode":"agent"}}}
{"type":"emit_inbound","label":"run.started:1","frame":{"type":"run.started","runId":"run-e94938bb-f461-4834-b729-c4562b715945","agentId":"agent-93ba82d8-7489-48f7-9b93-b9f65f425666"}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-e94938bb-f461-4834-b729-c4562b715945","update":{"type":"text-delta","text":"first"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-e94938bb-f461-4834-b729-c4562b715945","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-e94938bb-f461-4834-b729-c4562b715945","update":{"type":"text-delta","text":" fixture"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-e94938bb-f461-4834-b729-c4562b715945","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-e94938bb-f461-4834-b729-c4562b715945","update":{"type":"text-delta","text":" turn"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-e94938bb-f461-4834-b729-c4562b715945","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-e94938bb-f461-4834-b729-c4562b715945","update":{"type":"text-delta","text":" complete"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-e94938bb-f461-4834-b729-c4562b715945","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"step-completed","frame":{"type":"interaction.update","runId":"run-e94938bb-f461-4834-b729-c4562b715945","update":{"type":"step-completed","stepId":1,"stepDurationMs":969}}}
{"type":"emit_inbound","label":"turn-ended","frame":{"type":"interaction.update","runId":"run-e94938bb-f461-4834-b729-c4562b715945","update":{"type":"turn-ended","usage":{"inputTokens":10403,"outputTokens":38,"cacheReadTokens":7392,"cacheWriteTokens":0}}}}
{"type":"emit_inbound","label":"run.completed:1","frame":{"type":"run.completed","result":{"id":"run-e94938bb-f461-4834-b729-c4562b715945","requestId":"ef58f76f-ef8f-475e-bff1-568e8aed367c","status":"finished","result":"first fixture turn complete","model":{"id":"composer-2.5"},"durationMs":3891}}}
{"type":"expect_outbound","label":"run.start:2","frame":{"type":"run.start","message":"Respond with exactly: second fixture turn complete","options":{"model":{"id":"composer-2.5"},"mode":"agent"}}}
{"type":"emit_inbound","label":"run.started:2","frame":{"type":"run.started","runId":"run-2fefd1d7-40f3-4ffc-bbd3-30e709a85935","agentId":"agent-93ba82d8-7489-48f7-9b93-b9f65f425666"}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-2fefd1d7-40f3-4ffc-bbd3-30e709a85935","update":{"type":"text-delta","text":"second"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-2fefd1d7-40f3-4ffc-bbd3-30e709a85935","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-2fefd1d7-40f3-4ffc-bbd3-30e709a85935","update":{"type":"text-delta","text":" fixture"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-2fefd1d7-40f3-4ffc-bbd3-30e709a85935","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-2fefd1d7-40f3-4ffc-bbd3-30e709a85935","update":{"type":"text-delta","text":" turn"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-2fefd1d7-40f3-4ffc-bbd3-30e709a85935","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-2fefd1d7-40f3-4ffc-bbd3-30e709a85935","update":{"type":"text-delta","text":" complete"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-2fefd1d7-40f3-4ffc-bbd3-30e709a85935","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"step-completed","frame":{"type":"interaction.update","runId":"run-2fefd1d7-40f3-4ffc-bbd3-30e709a85935","update":{"type":"step-completed","stepId":1,"stepDurationMs":816}}}
{"type":"emit_inbound","label":"turn-ended","frame":{"type":"interaction.update","runId":"run-2fefd1d7-40f3-4ffc-bbd3-30e709a85935","update":{"type":"turn-ended","usage":{"inputTokens":10461,"outputTokens":28,"cacheReadTokens":10402,"cacheWriteTokens":0}}}}
{"type":"emit_inbound","label":"run.completed:2","frame":{"type":"run.completed","result":{"id":"run-2fefd1d7-40f3-4ffc-bbd3-30e709a85935","requestId":"94d9bed1-7b67-4093-ac41-64a43014290e","status":"finished","result":"second fixture turn complete","model":{"id":"composer-2.5"},"durationMs":1727}}}
{"type":"expect_outbound","label":"agent.close","frame":{"type":"agent.close","agentId":"agent-93ba82d8-7489-48f7-9b93-b9f65f425666"}}
@@ -0,0 +1,39 @@
import { assert } from "@effect/vitest";
import type { ProviderReplayTranscript } from "@t3tools/contracts";
import type { OrchestratorV2ScenarioResult } from "../../OrchestratorScenario.ts";
import {
assertBaseProjection,
assertExecutionNodeKinds,
assertRunOrdinals,
assertSemanticProjectionIntegrity,
assertTurnItemTypes,
assertUserMessagesInclude,
assertVisibleTurnItemsMirrorLocalTurnItems,
projectionFor,
PROPOSED_PLAN_PROMPT,
} from "../shared.ts";
export function assertProposedPlanCursorOutput(
result: OrchestratorV2ScenarioResult,
transcript: ProviderReplayTranscript,
) {
assertBaseProjection({ result, transcript, runCount: 1, runStatuses: ["completed"] });
const projection = projectionFor(result, transcript.scenario);
assertSemanticProjectionIntegrity(projection);
assertVisibleTurnItemsMirrorLocalTurnItems(projection);
assertRunOrdinals(projection, [1]);
assertExecutionNodeKinds(projection, ["root_turn", "plan", "subagent", "tool_call"]);
assertTurnItemTypes(projection, ["user_message", "subagent", "file_search", "proposed_plan"]);
assertUserMessagesInclude(projection, [PROPOSED_PLAN_PROMPT]);
const proposedPlans = projection.plans.filter((plan) => plan.kind === "proposed_plan");
assert.isAtLeast(proposedPlans.length, 1);
assert.include(proposedPlans.at(-1)?.markdown, "Deterministic Replay Fixtures");
const proposedPlanItems = projection.turnItems.filter((item) => item.type === "proposed_plan");
assert.isAtLeast(proposedPlanItems.length, 1);
assert.equal(proposedPlanItems.at(-1)?.streaming, false);
assert.isAtLeast(projection.subagents.length, 1);
}
@@ -0,0 +1,132 @@
{"type":"transcript_start","provider":"cursor","protocol":"cursor-agent-sdk.local","version":"1","scenario":"proposed_plan","metadata":{"generatedBy":"recordCursorAgentSdkReplayTranscript","nativeAgentId":"agent-bc5d59e0-bc8b-441a-9292-b49dfff962d3"}}
{"type":"expect_outbound","label":"agent.open","frame":{"type":"agent.open","operation":"create","options":{"model":{"id":"composer-2.5"},"hasName":true,"mode":"plan","local":{"hasCwd":true,"autoReview":false,"sandboxEnabled":true,"enableAgentRetries":true}}}}
{"type":"emit_inbound","label":"agent.opened","frame":{"type":"agent.opened","agentId":"agent-bc5d59e0-bc8b-441a-9292-b49dfff962d3"}}
{"type":"expect_outbound","label":"run.start:1","frame":{"type":"run.start","message":"Create a short implementation plan for adding deterministic replay fixtures. Do not ask questions. Present the final plan in a proposed plan block.","options":{"model":{"id":"composer-2.5"},"mode":"plan"}}}
{"type":"emit_inbound","label":"run.started:1","frame":{"type":"run.started","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","agentId":"agent-bc5d59e0-bc8b-441a-9292-b49dfff962d3"}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":"Exploring the"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" codebase for replay"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":", fixtures, and"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" related"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" patterns"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" to"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" draft a concrete"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" plan"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":".\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":8}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":183}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"partial-tool-call","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"partial-tool-call","callId":"tool_c651551c-9935-48e7-b5c4-28bd5ce2909","toolCall":{"type":"task","args":{"description":"Explore replay/fixture patterns","prompt":"Explore this codebase thoroughly to understand:\n1. What is this project (orchestrator, cursor agent SDK, etc.)?\n2. Any existing replay, recording, or fixture infrastructure\n3. Test patterns, mock patterns, deterministic testing approaches\n4. Any references to \"proposed_plan\", \"record\", \"replay\", \"fixture\"\n\nSearch for keywords: replay, fixture, record, deterministic, snapshot, mock, proposed_plan\n\nReturn:\n- Project structure overview\n- Relevant file paths and their roles\n- Current gaps for deterministic replay fixtures\n- Any existing types/interfaces that would need extension\n- Suggested integration points based on actual code\n\nBe specific with file paths and code snippets. Read-only exploration only.","subagentType":{"kind":"explore"},"model":"composer-2.5-fast","agentId":"95b8b4ba-cc91-4455-9389-9729e569f76b","mode":"unspecified"}},"modelCallId":"12792358-9978-4430-839d-d1aa84ab7471-0-yjwv"}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"tool-call-started","callId":"tool_c651551c-9935-48e7-b5c4-28bd5ce2909","toolCall":{"type":"task","args":{"description":"Explore replay/fixture patterns","prompt":"Explore this codebase thoroughly to understand:\n1. What is this project (orchestrator, cursor agent SDK, etc.)?\n2. Any existing replay, recording, or fixture infrastructure\n3. Test patterns, mock patterns, deterministic testing approaches\n4. Any references to \"proposed_plan\", \"record\", \"replay\", \"fixture\"\n\nSearch for keywords: replay, fixture, record, deterministic, snapshot, mock, proposed_plan\n\nReturn:\n- Project structure overview\n- Relevant file paths and their roles\n- Current gaps for deterministic replay fixtures\n- Any existing types/interfaces that would need extension\n- Suggested integration points based on actual code\n\nBe specific with file paths and code snippets. Read-only exploration only.","subagentType":{"kind":"explore"},"model":"composer-2.5-fast","agentId":"95b8b4ba-cc91-4455-9389-9729e569f76b","mode":"unspecified"}},"modelCallId":"12792358-9978-4430-839d-d1aa84ab7471-0-yjwv"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"tool-call-started","callId":"tool_acdbbf78-c550-4f16-9311-7e10a3c2d03","toolCall":{"type":"glob","args":{"globPattern":"**/*"}},"modelCallId":"12792358-9978-4430-839d-d1aa84ab7471-0-yjwv"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":11}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"tool-call-started","callId":"tool_e7511f26-8602-4658-81d3-139a335230c","toolCall":{"type":"grep","args":{"pattern":"replay|fixture|proposed_plan|deterministic","caseInsensitive":true,"offset":0}},"modelCallId":"12792358-9978-4430-839d-d1aa84ab7471-0-yjwv"}}}
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"tool-call-completed","callId":"tool_e7511f26-8602-4658-81d3-139a335230c","toolCall":{"type":"grep","args":{"pattern":"replay|fixture|proposed_plan|deterministic","caseInsensitive":true,"offset":0},"result":{"status":"success","value":{"workspaceResults":{"/var/folders/b3/b51_pdxj7dl0t981zpqkxxhr0000gn/T/t3-orchestrator-v2-cursor-agent-sdk-record-proposed_plan-ggwFWW":{"type":"content","output":{"matches":[{"file":"./README.md"}],"totalMatches":0}}}}}},"modelCallId":"12792358-9978-4430-839d-d1aa84ab7471-0-yjwv"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":56}}}
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"tool-call-completed","callId":"tool_acdbbf78-c550-4f16-9311-7e10a3c2d03","toolCall":{"type":"glob","args":{"globPattern":"**/*"},"result":{"status":"success","value":{"files":["./.git/logs/refs/heads/main","./.git/logs/HEAD","./.git/refs/heads/main","./.git/objects/fc/daa658b54f15c125d37542fbc5c39063cc8ae5","./.git/COMMIT_EDITMSG","./README.md","./.git/config","./.git/HEAD","./.git/hooks/push-to-checkout.sample","./.git/hooks/update.sample","./.git/hooks/pre-push.sample","./.git/hooks/pre-applypatch.sample","./.git/hooks/pre-merge-commit.sample","./.git/hooks/post-update.sample","./.git/hooks/prepare-commit-msg.sample","./.git/hooks/pre-receive.sample","./.git/hooks/fsmonitor-watchman.sample","./.git/hooks/applypatch-msg.sample","./.git/hooks/pre-commit.sample","./.git/hooks/sendemail-validate.sample","./.git/hooks/pre-rebase.sample","./.git/hooks/commit-msg.sample","./.git/description","./.git/info/exclude"],"totalFiles":24,"clientTruncated":false,"ripgrepTruncated":false}}},"modelCallId":"12792358-9978-4430-839d-d1aa84ab7471-0-yjwv"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":197}}}
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"tool-call-completed","callId":"tool_c651551c-9935-48e7-b5c4-28bd5ce2909","toolCall":{"type":"task","args":{"description":"Explore replay/fixture patterns","prompt":"Explore this codebase thoroughly to understand:\n1. What is this project (orchestrator, cursor agent SDK, etc.)?\n2. Any existing replay, recording, or fixture infrastructure\n3. Test patterns, mock patterns, deterministic testing approaches\n4. Any references to \"proposed_plan\", \"record\", \"replay\", \"fixture\"\n\nSearch for keywords: replay, fixture, record, deterministic, snapshot, mock, proposed_plan\n\nReturn:\n- Project structure overview\n- Relevant file paths and their roles\n- Current gaps for deterministic replay fixtures\n- Any existing types/interfaces that would need extension\n- Suggested integration points based on actual code\n\nBe specific with file paths and code snippets. Read-only exploration only.","subagentType":{"kind":"explore"},"model":"composer-2.5-fast","agentId":"95b8b4ba-cc91-4455-9389-9729e569f76b","mode":"unspecified"},"result":{"status":"success","value":{"conversationSteps":[{"assistantMessage":{"text":"I'll explore the codebase structure and search for replay, recording, fixture, and related patterns.\n"}},{"toolCall":{"readToolCall":{"args":{"path":"/tmp/cursor-replay-proposed_plan/README.md"},"result":{"success":{"content":"# cursor-agent-sdk-record-proposed_plan\n","totalLines":2,"fileSize":40,"path":"/tmp/cursor-replay-proposed_plan/README.md","readRange":{"startLine":1,"endLine":2}}}},"toolCallId":"tool_6b944780-b235-43eb-87b1-f1b31ec1df5"}},{"toolCall":{"grepToolCall":{"args":{"pattern":"proposed_plan|replay|fixture|record|deterministic|snapshot|mock","outputMode":"content","caseInsensitive":true,"multiline":false,"toolCallId":"tool_9703f1e1-6268-4d6f-b68f-3832af37dbe","offset":0},"result":{"success":{"pattern":"proposed_plan|replay|fixture|record|deterministic|snapshot|mock","outputMode":"content","workspaceResults":{"/var/folders/b3/b51_pdxj7dl0t981zpqkxxhr0000gn/T/t3-orchestrator-v2-cursor-agent-sdk-record-proposed_plan-ggwFWW":{"content":{"matches":[{"file":"./README.md","matches":[{"lineNumber":1,"content":"# cursor-agent-sdk-record-proposed_plan"}]}],"totalLines":1,"totalMatchedLines":1}}}}}},"toolCallId":"tool_9703f1e1-6268-4d6f-b68f-3832af37dbe"}},{"toolCall":{"globToolCall":{"args":{"globPattern":"**/*"},"result":{"success":{"files":["./.git/logs/refs/heads/main","./.git/logs/HEAD","./.git/refs/heads/main","./.git/objects/fc/daa658b54f15c125d37542fbc5c39063cc8ae5","./.git/COMMIT_EDITMSG","./README.md","./.git/config","./.git/HEAD","./.git/hooks/push-to-checkout.sample","./.git/hooks/update.sample","./.git/hooks/pre-push.sample","./.git/hooks/pre-applypatch.sample","./.git/hooks/pre-merge-commit.sample","./.git/hooks/post-update.sample","./.git/hooks/prepare-commit-msg.sample","./.git/hooks/pre-receive.sample","./.git/hooks/fsmonitor-watchman.sample","./.git/hooks/applypatch-msg.sample","./.git/hooks/pre-commit.sample","./.git/hooks/sendemail-validate.sample","./.git/hooks/pre-rebase.sample","./.git/hooks/commit-msg.sample","./.git/description","./.git/info/exclude"],"totalFiles":24}}},"toolCallId":"tool_2258753f-1e24-4b68-8f55-f5cc37d0df7"}},{"assistantMessage":{"text":"The repo looks minimal; I'll dig into git history and any hidden files for more context.\n"}},{"toolCall":{"readToolCall":{"args":{"path":"/tmp/cursor-replay-proposed_plan/.git/COMMIT_EDITMSG"},"result":{"success":{"content":"initial\n","totalLines":2,"fileSize":8,"path":"/tmp/cursor-replay-proposed_plan/.git/COMMIT_EDITMSG","readRange":{"startLine":1,"endLine":2}}}},"toolCallId":"tool_d7b3c0a2-3478-4188-b075-473d62608b5"}},{"toolCall":{"shellToolCall":{"result":{"permissionDenied":{"command":"git -C \"/tmp/cursor-replay-proposed_plan\" log --oneline -5 && echo \"---\" && git -C \"/tmp/cursor-replay-proposed_plan\" show --stat HEAD","error":"This operation is not allowed in readonly mode. The subagent was launched with readonly: true, which restricts write operations.","isReadonly":true}}},"toolCallId":"tool_1a463236-a1f4-46c9-9858-40ecb97beef"}},{"toolCall":{"globToolCall":{"args":{"targetDirectory":"/tmp/cursor-replay-proposed_plan","globPattern":"**/*.*"},"result":{"success":{"path":"/tmp/cursor-replay-proposed_plan","files":["README.md",".git/hooks/push-to-checkout.sample",".git/hooks/update.sample",".git/hooks/pre-push.sample",".git/hooks/pre-applypatch.sample",".git/hooks/pre-merge-commit.sample",".git/hooks/post-update.sample",".git/hooks/prepare-commit-msg.sample",".git/hooks/pre-receive.sample",".git/hooks/fsmonitor-watchman.sample",".git/hooks/applypatch-msg.sample",".git/hooks/pre-commit.sample",".git/hooks/sendemail-validate.sample",".git/hooks/pre-rebase.sample",".git/hooks/commit-msg.sample"],"totalFiles":15}}},"toolCallId":"tool_8b855f7c-7d59-4558-bbcc-33Line truncated
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":1912}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"thinking-delta","text":"The codebase is empty"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"thinking-delta","text":" aside from a README."}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"thinking-delta","text":" I will draft a proposed"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":6}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"thinking-delta","text":" plan for deterministic"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":6}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"thinking-delta","text":" replay fixtures."}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"thinking-completed","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"thinking-completed","thinkingDurationMs":562}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":"Checking agent"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" transcripts for"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" prior context on this"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" task"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":".\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":41}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"tool-call-started","callId":"tool_2fcd3afc-c41d-42ca-9978-6944952eba2","toolCall":{"type":"glob","args":{"globPattern":"**/*","targetDirectory":"/Users/julius/.cursor/projects/var-folders-b3-b51-pdxj7dl0t981zpqkxxhr0000gn-T-t3-orchestrator-v2-cursor-agent-sdk-record-proposed-plan-ggwFWW/agent-transcripts"}},"modelCallId":"12792358-9978-4430-839d-d1aa84ab7471-1-e5et"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":31}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"tool-call-started","callId":"tool_240db1e2-13d0-4012-9b2a-90ad32b0ec5","toolCall":{"type":"read","args":{"path":"/tmp/cursor-replay-proposed_plan/README.md"}},"modelCallId":"12792358-9978-4430-839d-d1aa84ab7471-1-e5et"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":107}}}
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"tool-call-completed","callId":"tool_240db1e2-13d0-4012-9b2a-90ad32b0ec5","toolCall":{"type":"read","args":{"path":"/tmp/cursor-replay-proposed_plan/README.md"},"result":{"status":"success","value":{"content":"# cursor-agent-sdk-record-proposed_plan\n","totalLines":2,"fileSize":40}}},"modelCallId":"12792358-9978-4430-839d-d1aa84ab7471-1-e5et"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":10}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"thinking-delta","text":"The workspace is empty."}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"thinking-delta","text":" I am drafting a short"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":6}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"thinking-delta","text":" implementation plan"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"thinking-delta","text":" for deterministic replay"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":6}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"thinking-delta","text":" fixtures based on typical"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":7}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"thinking-delta","text":" Cursor Agent SDK and"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"thinking-delta","text":" orchestrator patterns."}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":6}}}
{"type":"emit_inbound","label":"thinking-completed","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"thinking-completed","thinkingDurationMs":1027}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":"The"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" repo is a"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" greenfield scaffold;"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" drafting"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" a concise"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" plan"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" from the project"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" name and standard"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" Cursor Agent SDK replay"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":6}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":" patterns"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"text-delta","text":".\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"partial-tool-call","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"partial-tool-call","callId":"tool_27b151a5-1a11-410a-a412-5325c4f7d2c","toolCall":{"type":"createPlan","args":{"plan":""}},"modelCallId":"12792358-9978-4430-839d-d1aa84ab7471-2-z9b0"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":8}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":49}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"partial-tool-call","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"partial-tool-call","callId":"tool_27b151a5-1a11-410a-a412-5325c4f7d2c","toolCall":{"type":"createPlan","args":{"plan":"# Deterministic Replay Fixtures for `proposed_plan`\n\n## Context\n\nThe workspace is a greenfield scaffold ([README.md](README.md)). This plan introduces the minimum structure to **record** plan-mode SDK streams and **replay** them as fixtures for deterministic tests.\n\n## Architecture\n\n```mermaid\nflowchart LR\n subgraph live [Live mode]\n Prompt --> LiveTransport\n LiveTransport --> SDK[\"Cursor Agent SDK\"]\n SDK --> Recorder\n Recorder --> Consumer\n Recorder --> FixtureFile\n end\n\n subgraph replay [Replay mode]\n FixtureFile2[Fixture file] --> ReplayTransport\n ReplayTransport --> Consumer2[Same consumer code]\n end\n```\n\n**Key idea:** Orchestrator code consumes `AsyncIterable<SDKMessage>` from a transport interface; production uses live SDK, tests use fixture replay.\n\n## 1. Define core types\n\nAdd [`src/replay/types.ts`](src/replay/types.ts):\n\n- `ProposedPlanFixture` — `{ name, input: { prompt, mode: \"plan\" }, events: SDKMessage[], plan?: unknown, meta: { model?, cwd? } }`\n- `AgentTransport` — `{ create(opts), stream(handle): AsyncIterable<SDKMessage> }`\n- `RecordOptions` / `ReplayOptions` — fixture path, normalize flag\n\nReuse SDK message shapes from `@cursor/agent-sdk` (or a thin local mirror) so fixtures stay aligned with `run.stream()` output.\n\n## 2. Fixture format and layout\n\n```\nfixtures/proposed_plan/\n <case-name>/\n meta.json # input prompt, mode, model, cwd\n events.ndjson # one SDKMessage per line (post-normalization)\n plan.json # extracted proposed plan artifact (optional convenience)\n expected.json # optional assertions (status, plan hash, key fields)\n```\n\n- NDJSON keeps diffs readable and supports streaming replay.\n- Commit normalized fixtures only (no secrets, no absolute paths).\n\n## 3. Normalization for determinism\n\nAdd [`src/replay/normalize.ts`](src/replay/normalize.ts) to strip or replace volatile fields before write/compare:\n\n- Timestamps, run/agent IDs, token counts, latency fields\n- Sort parallel sub-events by stable key (`type` + `sequence` or `label`)\n- Replace cwd/home with placeholders (e.g. `$WORKSPACE`)\n\nApply normalization in both **recorder** (on write) and **test assertions** (on compare).\n\n## 4. Implement recorder\n\nAdd [`src/replay/recorder.ts`](src/replay/recorder.ts):\n\n- Wrap live `AgentTransport.stream()` and tee events to consumer + buffer\n- On stream end, extract `proposed_plan` payload from terminal plan message(s)\n- Write fixture directory via `writeFixture(name, data)`\n\nCLI entrypoint [`src/cli/record-fixture.ts`](src/cli/record-fixture.ts):\n\n```bash\npnpm record-fixture --name simple-refactor --prompt \"...\" --mode plan\n```\n\n## 5. Implement replay transport\n\nAdd [`src/replay/replay-transport.ts`](src/replay/replay-transport.ts):\n\n- Load fixture by name/path\n- Yield `events.ndjson` lines as `SDKMessage` with configurable tick delay (default 0)\n- Implement `AgentTransport` so orchestrator plan flow is unchanged\n\nWire via env or factory in [`src/transport/index.ts`](src/transport/index.ts):\n\n```typescript\nexport function createTransport(): AgentTransport {\n return process.env.REPLAY_FIXTURE\n ? new ReplayTransport(process.env.REPLAY_FIXTURE)\n : new LiveSdkTransport();\n}\n```\n\n## 6. Orchestrator hook: `proposed_plan`\n\nAdd [`src/orchestrator/propose-plan.ts`](src/orchestrator/propose-plan.ts):\n\n1. `createTransport()` → `create({ mode: \"plan\", prompt })`\n2. Consume stream until plan-complete message\n3. Return parsed plan + raw events (for optional inline recording in dev)\n\nThis is the single integration point both live and replay modes share.\n\n## 7. Deterministic tests\n\nAdd [`tests/replay/proposed-plan.test.ts`](tests/replay/proposed-plan.test.ts):\n\n- Set `REPLAY_FIXTURE=fixtures/proposed_plan/simple-refactor`\n- Run `proposePlan(prompt)` and assert:\n - Stable plan hash or snapshot of normalized `plan.json`\n - Expected status from `expected.json`\n- Add one golden fixture recorded from a real run, then lock behavior\n\nUse Vitest (or project-standard runner) with `fixtures/` as test data.\n\n## 8. Deliverables (minimal scope)\n\n| File | Purpose |\n|------|---------|\n| `src/replay/types.ts` | Shared fixture + transport types |\n| `src/replay/normalize.ts` | Deterministic field stripping |\n| `src/replay/recorder.ts` | Live capture → fixture |\n| `src/replay/replay-transport.ts` | Fixture → stream |\n| `src/transport/live-sdk-transport.ts` | Thin SDK wrapper |\n| `src/orchestrator/propose-plan.ts` | Plan-mode orchestration |\n| `src/cli/record-fixture.ts` | One-shot recording CLI |\n| `fixtures/proposed_plan/simple-refactor/` | Seed fixtuLine truncated
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":1261}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":155}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"tool-call-started","callId":"tool_27b151a5-1a11-410a-a412-5325c4f7d2c","toolCall":{"type":"createPlan","args":{"plan":"# Deterministic Replay Fixtures for `proposed_plan`\n\n## Context\n\nThe workspace is a greenfield scaffold ([README.md](README.md)). This plan introduces the minimum structure to **record** plan-mode SDK streams and **replay** them as fixtures for deterministic tests.\n\n## Architecture\n\n```mermaid\nflowchart LR\n subgraph live [Live mode]\n Prompt --> LiveTransport\n LiveTransport --> SDK[\"Cursor Agent SDK\"]\n SDK --> Recorder\n Recorder --> Consumer\n Recorder --> FixtureFile\n end\n\n subgraph replay [Replay mode]\n FixtureFile2[Fixture file] --> ReplayTransport\n ReplayTransport --> Consumer2[Same consumer code]\n end\n```\n\n**Key idea:** Orchestrator code consumes `AsyncIterable<SDKMessage>` from a transport interface; production uses live SDK, tests use fixture replay.\n\n## 1. Define core types\n\nAdd [`src/replay/types.ts`](src/replay/types.ts):\n\n- `ProposedPlanFixture` — `{ name, input: { prompt, mode: \"plan\" }, events: SDKMessage[], plan?: unknown, meta: { model?, cwd? } }`\n- `AgentTransport` — `{ create(opts), stream(handle): AsyncIterable<SDKMessage> }`\n- `RecordOptions` / `ReplayOptions` — fixture path, normalize flag\n\nReuse SDK message shapes from `@cursor/agent-sdk` (or a thin local mirror) so fixtures stay aligned with `run.stream()` output.\n\n## 2. Fixture format and layout\n\n```\nfixtures/proposed_plan/\n <case-name>/\n meta.json # input prompt, mode, model, cwd\n events.ndjson # one SDKMessage per line (post-normalization)\n plan.json # extracted proposed plan artifact (optional convenience)\n expected.json # optional assertions (status, plan hash, key fields)\n```\n\n- NDJSON keeps diffs readable and supports streaming replay.\n- Commit normalized fixtures only (no secrets, no absolute paths).\n\n## 3. Normalization for determinism\n\nAdd [`src/replay/normalize.ts`](src/replay/normalize.ts) to strip or replace volatile fields before write/compare:\n\n- Timestamps, run/agent IDs, token counts, latency fields\n- Sort parallel sub-events by stable key (`type` + `sequence` or `label`)\n- Replace cwd/home with placeholders (e.g. `$WORKSPACE`)\n\nApply normalization in both **recorder** (on write) and **test assertions** (on compare).\n\n## 4. Implement recorder\n\nAdd [`src/replay/recorder.ts`](src/replay/recorder.ts):\n\n- Wrap live `AgentTransport.stream()` and tee events to consumer + buffer\n- On stream end, extract `proposed_plan` payload from terminal plan message(s)\n- Write fixture directory via `writeFixture(name, data)`\n\nCLI entrypoint [`src/cli/record-fixture.ts`](src/cli/record-fixture.ts):\n\n```bash\npnpm record-fixture --name simple-refactor --prompt \"...\" --mode plan\n```\n\n## 5. Implement replay transport\n\nAdd [`src/replay/replay-transport.ts`](src/replay/replay-transport.ts):\n\n- Load fixture by name/path\n- Yield `events.ndjson` lines as `SDKMessage` with configurable tick delay (default 0)\n- Implement `AgentTransport` so orchestrator plan flow is unchanged\n\nWire via env or factory in [`src/transport/index.ts`](src/transport/index.ts):\n\n```typescript\nexport function createTransport(): AgentTransport {\n return process.env.REPLAY_FIXTURE\n ? new ReplayTransport(process.env.REPLAY_FIXTURE)\n : new LiveSdkTransport();\n}\n```\n\n## 6. Orchestrator hook: `proposed_plan`\n\nAdd [`src/orchestrator/propose-plan.ts`](src/orchestrator/propose-plan.ts):\n\n1. `createTransport()` → `create({ mode: \"plan\", prompt })`\n2. Consume stream until plan-complete message\n3. Return parsed plan + raw events (for optional inline recording in dev)\n\nThis is the single integration point both live and replay modes share.\n\n## 7. Deterministic tests\n\nAdd [`tests/replay/proposed-plan.test.ts`](tests/replay/proposed-plan.test.ts):\n\n- Set `REPLAY_FIXTURE=fixtures/proposed_plan/simple-refactor`\n- Run `proposePlan(prompt)` and assert:\n - Stable plan hash or snapshot of normalized `plan.json`\n - Expected status from `expected.json`\n- Add one golden fixture recorded from a real run, then lock behavior\n\nUse Vitest (or project-standard runner) with `fixtures/` as test data.\n\n## 8. Deliverables (minimal scope)\n\n| File | Purpose |\n|------|---------|\n| `src/replay/types.ts` | Shared fixture + transport types |\n| `src/replay/normalize.ts` | Deterministic field stripping |\n| `src/replay/recorder.ts` | Live capture → fixture |\n| `src/replay/replay-transport.ts` | Fixture → stream |\n| `src/transport/live-sdk-transport.ts` | Thin SDK wrapper |\n| `src/orchestrator/propose-plan.ts` | Plan-mode orchestration |\n| `src/cli/record-fixture.ts` | One-shot recording CLI |\n| `fixtures/proposed_plan/simple-refactor/` | Seed fixtuLine truncated
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"tool-call-completed","callId":"tool_27b151a5-1a11-410a-a412-5325c4f7d2c","toolCall":{"type":"createPlan","args":{"plan":"# Deterministic Replay Fixtures for `proposed_plan`\n\n## Context\n\nThe workspace is a greenfield scaffold ([README.md](README.md)). This plan introduces the minimum structure to **record** plan-mode SDK streams and **replay** them as fixtures for deterministic tests.\n\n## Architecture\n\n```mermaid\nflowchart LR\n subgraph live [Live mode]\n Prompt --> LiveTransport\n LiveTransport --> SDK[\"Cursor Agent SDK\"]\n SDK --> Recorder\n Recorder --> Consumer\n Recorder --> FixtureFile\n end\n\n subgraph replay [Replay mode]\n FixtureFile2[Fixture file] --> ReplayTransport\n ReplayTransport --> Consumer2[Same consumer code]\n end\n```\n\n**Key idea:** Orchestrator code consumes `AsyncIterable<SDKMessage>` from a transport interface; production uses live SDK, tests use fixture replay.\n\n## 1. Define core types\n\nAdd [`src/replay/types.ts`](src/replay/types.ts):\n\n- `ProposedPlanFixture` — `{ name, input: { prompt, mode: \"plan\" }, events: SDKMessage[], plan?: unknown, meta: { model?, cwd? } }`\n- `AgentTransport` — `{ create(opts), stream(handle): AsyncIterable<SDKMessage> }`\n- `RecordOptions` / `ReplayOptions` — fixture path, normalize flag\n\nReuse SDK message shapes from `@cursor/agent-sdk` (or a thin local mirror) so fixtures stay aligned with `run.stream()` output.\n\n## 2. Fixture format and layout\n\n```\nfixtures/proposed_plan/\n <case-name>/\n meta.json # input prompt, mode, model, cwd\n events.ndjson # one SDKMessage per line (post-normalization)\n plan.json # extracted proposed plan artifact (optional convenience)\n expected.json # optional assertions (status, plan hash, key fields)\n```\n\n- NDJSON keeps diffs readable and supports streaming replay.\n- Commit normalized fixtures only (no secrets, no absolute paths).\n\n## 3. Normalization for determinism\n\nAdd [`src/replay/normalize.ts`](src/replay/normalize.ts) to strip or replace volatile fields before write/compare:\n\n- Timestamps, run/agent IDs, token counts, latency fields\n- Sort parallel sub-events by stable key (`type` + `sequence` or `label`)\n- Replace cwd/home with placeholders (e.g. `$WORKSPACE`)\n\nApply normalization in both **recorder** (on write) and **test assertions** (on compare).\n\n## 4. Implement recorder\n\nAdd [`src/replay/recorder.ts`](src/replay/recorder.ts):\n\n- Wrap live `AgentTransport.stream()` and tee events to consumer + buffer\n- On stream end, extract `proposed_plan` payload from terminal plan message(s)\n- Write fixture directory via `writeFixture(name, data)`\n\nCLI entrypoint [`src/cli/record-fixture.ts`](src/cli/record-fixture.ts):\n\n```bash\npnpm record-fixture --name simple-refactor --prompt \"...\" --mode plan\n```\n\n## 5. Implement replay transport\n\nAdd [`src/replay/replay-transport.ts`](src/replay/replay-transport.ts):\n\n- Load fixture by name/path\n- Yield `events.ndjson` lines as `SDKMessage` with configurable tick delay (default 0)\n- Implement `AgentTransport` so orchestrator plan flow is unchanged\n\nWire via env or factory in [`src/transport/index.ts`](src/transport/index.ts):\n\n```typescript\nexport function createTransport(): AgentTransport {\n return process.env.REPLAY_FIXTURE\n ? new ReplayTransport(process.env.REPLAY_FIXTURE)\n : new LiveSdkTransport();\n}\n```\n\n## 6. Orchestrator hook: `proposed_plan`\n\nAdd [`src/orchestrator/propose-plan.ts`](src/orchestrator/propose-plan.ts):\n\n1. `createTransport()` → `create({ mode: \"plan\", prompt })`\n2. Consume stream until plan-complete message\n3. Return parsed plan + raw events (for optional inline recording in dev)\n\nThis is the single integration point both live and replay modes share.\n\n## 7. Deterministic tests\n\nAdd [`tests/replay/proposed-plan.test.ts`](tests/replay/proposed-plan.test.ts):\n\n- Set `REPLAY_FIXTURE=fixtures/proposed_plan/simple-refactor`\n- Run `proposePlan(prompt)` and assert:\n - Stable plan hash or snapshot of normalized `plan.json`\n - Expected status from `expected.json`\n- Add one golden fixture recorded from a real run, then lock behavior\n\nUse Vitest (or project-standard runner) with `fixtures/` as test data.\n\n## 8. Deliverables (minimal scope)\n\n| File | Purpose |\n|------|---------|\n| `src/replay/types.ts` | Shared fixture + transport types |\n| `src/replay/normalize.ts` | Deterministic field stripping |\n| `src/replay/recorder.ts` | Live capture → fixture |\n| `src/replay/replay-transport.ts` | Fixture → stream |\n| `src/transport/live-sdk-transport.ts` | Thin SDK wrapper |\n| `src/orchestrator/propose-plan.ts` | Plan-mode orchestration |\n| `src/cli/record-fixture.ts` | One-shot recording CLI |\n| `fixtures/proposed_plan/simple-refactor/` | Seed fLine truncated
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"token-delta","tokens":7}}}
{"type":"emit_inbound","label":"step-completed","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"step-completed","stepId":11,"stepDurationMs":54858}}}
{"type":"emit_inbound","label":"turn-ended","frame":{"type":"interaction.update","runId":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","update":{"type":"turn-ended","usage":{"inputTokens":41151,"outputTokens":2171,"cacheReadTokens":30336,"cacheWriteTokens":0}}}}
{"type":"emit_inbound","label":"run.completed:1","frame":{"type":"run.completed","result":{"id":"run-6fc6c9f5-f2b7-4f6e-8922-d479f68e7710","requestId":"12792358-9978-4430-839d-d1aa84ab7471","status":"finished","result":"The repo is a greenfield scaffold; drafting a concise plan from the project name and standard Cursor Agent SDK replay patterns.\n","model":{"id":"composer-2.5"},"durationMs":57537}}}
{"type":"expect_outbound","label":"agent.close","frame":{"type":"agent.close","agentId":"agent-bc5d59e0-bc8b-441a-9292-b49dfff962d3"}}
@@ -0,0 +1,60 @@
{"type":"transcript_start","provider":"cursor","protocol":"cursor-agent-sdk.local","version":"1","scenario":"provider_thread_resume","metadata":{"generatedBy":"recordCursorAgentSdkReplayTranscript","nativeAgentId":"agent-06c9d7f0-c6a5-4194-b204-8aa8ddb04d10"}}
{"type":"expect_outbound","label":"agent.open","frame":{"type":"agent.open","operation":"create","options":{"model":{"id":"composer-2.5"},"hasName":true,"mode":"agent","local":{"hasCwd":true,"autoReview":false,"sandboxEnabled":false,"enableAgentRetries":true}}}}
{"type":"emit_inbound","label":"agent.opened","frame":{"type":"agent.opened","agentId":"agent-06c9d7f0-c6a5-4194-b204-8aa8ddb04d10"}}
{"type":"expect_outbound","label":"run.start:1","frame":{"type":"run.start","message":"Respond with exactly: provider thread resume fixture first turn complete","options":{"model":{"id":"composer-2.5"},"mode":"agent"}}}
{"type":"emit_inbound","label":"run.started:1","frame":{"type":"run.started","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","agentId":"agent-06c9d7f0-c6a5-4194-b204-8aa8ddb04d10"}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"text-delta","text":"provider"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"text-delta","text":" thread"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"text-delta","text":" resume"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"text-delta","text":" fixture"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"text-delta","text":" first"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"text-delta","text":" turn"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"text-delta","text":" complete"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"step-completed","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"step-completed","stepId":1,"stepDurationMs":766}}}
{"type":"emit_inbound","label":"turn-ended","frame":{"type":"interaction.update","runId":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","update":{"type":"turn-ended","usage":{"inputTokens":10274,"outputTokens":45,"cacheReadTokens":1856,"cacheWriteTokens":0}}}}
{"type":"emit_inbound","label":"run.completed:1","frame":{"type":"run.completed","result":{"id":"run-2aa4fc7d-3102-4d95-b449-2fb5e8703b5b","requestId":"ff15a3d5-de92-4d4c-ae3d-2b627b3d4839","status":"finished","result":"provider thread resume fixture first turn complete","model":{"id":"composer-2.5"},"durationMs":5298}}}
{"type":"expect_outbound","label":"agent.close:before-prompt-2","frame":{"type":"agent.close","agentId":"agent-06c9d7f0-c6a5-4194-b204-8aa8ddb04d10"}}
{"type":"expect_outbound","label":"agent.resume:before-prompt-2","frame":{"type":"agent.open","operation":"resume","agentId":"agent-06c9d7f0-c6a5-4194-b204-8aa8ddb04d10","options":{"model":{"id":"composer-2.5"},"hasName":true,"mode":"agent","local":{"hasCwd":true,"autoReview":false,"sandboxEnabled":false,"enableAgentRetries":true}}}}
{"type":"emit_inbound","label":"agent.resumed:before-prompt-2","frame":{"type":"agent.opened","agentId":"agent-06c9d7f0-c6a5-4194-b204-8aa8ddb04d10"}}
{"type":"expect_outbound","label":"run.start:2","frame":{"type":"run.start","message":"Using the conversation history available in this resumed thread, first repeat the exact final answer you gave in the previous turn. Then on a new line write exactly: provider thread resume fixture second turn complete","options":{"model":{"id":"composer-2.5"},"mode":"agent"}}}
{"type":"emit_inbound","label":"run.started:2","frame":{"type":"run.started","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","agentId":"agent-06c9d7f0-c6a5-4194-b204-8aa8ddb04d10"}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":"provider"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":" thread"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":" resume"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":" fixture"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":" first"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":" turn"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":" complete"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":"\n"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":"provider"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":" thread"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":" resume"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":" fixture"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":" second"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":" turn"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"text-delta","text":" complete"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"step-completed","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"step-completed","stepId":1,"stepDurationMs":773}}}
{"type":"emit_inbound","label":"turn-ended","frame":{"type":"interaction.update","runId":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","update":{"type":"turn-ended","usage":{"inputTokens":10369,"outputTokens":101,"cacheReadTokens":10304,"cacheWriteTokens":0}}}}
{"type":"emit_inbound","label":"run.completed:2","frame":{"type":"run.completed","result":{"id":"run-57e0a96b-f734-4919-b59a-8fbdfa9a8880","requestId":"3822e867-4c17-44fb-81b9-e0f3d76b0c87","status":"finished","result":"provider thread resume fixture first turn complete\nprovider thread resume fixture second turn complete","model":{"id":"composer-2.5"},"durationMs":4461}}}
{"type":"expect_outbound","label":"agent.close","frame":{"type":"agent.close","agentId":"agent-06c9d7f0-c6a5-4194-b204-8aa8ddb04d10"}}
@@ -0,0 +1,30 @@
{"type":"transcript_start","provider":"cursor","protocol":"cursor-agent-sdk.local","version":"1","scenario":"queued_turn","metadata":{"generatedBy":"recordCursorAgentSdkReplayTranscript","nativeAgentId":"agent-2c1578fc-9bfb-4db9-91c2-8d6744a8cb4c"}}
{"type":"expect_outbound","label":"agent.open","frame":{"type":"agent.open","operation":"create","options":{"model":{"id":"composer-2.5"},"hasName":true,"mode":"agent","local":{"hasCwd":true,"autoReview":false,"sandboxEnabled":false,"enableAgentRetries":true}}}}
{"type":"emit_inbound","label":"agent.opened","frame":{"type":"agent.opened","agentId":"agent-2c1578fc-9bfb-4db9-91c2-8d6744a8cb4c"}}
{"type":"expect_outbound","label":"run.start:1","frame":{"type":"run.start","message":"Respond with exactly: first fixture turn complete","options":{"model":{"id":"composer-2.5"},"mode":"agent"}}}
{"type":"emit_inbound","label":"run.started:1","frame":{"type":"run.started","runId":"run-e8e94512-2578-458e-8fcd-3d2c232ed00a","agentId":"agent-2c1578fc-9bfb-4db9-91c2-8d6744a8cb4c"}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-e8e94512-2578-458e-8fcd-3d2c232ed00a","update":{"type":"text-delta","text":"first"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-e8e94512-2578-458e-8fcd-3d2c232ed00a","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-e8e94512-2578-458e-8fcd-3d2c232ed00a","update":{"type":"text-delta","text":" fixture"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-e8e94512-2578-458e-8fcd-3d2c232ed00a","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-e8e94512-2578-458e-8fcd-3d2c232ed00a","update":{"type":"text-delta","text":" turn"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-e8e94512-2578-458e-8fcd-3d2c232ed00a","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-e8e94512-2578-458e-8fcd-3d2c232ed00a","update":{"type":"text-delta","text":" complete"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-e8e94512-2578-458e-8fcd-3d2c232ed00a","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"step-completed","frame":{"type":"interaction.update","runId":"run-e8e94512-2578-458e-8fcd-3d2c232ed00a","update":{"type":"step-completed","stepId":1,"stepDurationMs":884}}}
{"type":"emit_inbound","label":"turn-ended","frame":{"type":"interaction.update","runId":"run-e8e94512-2578-458e-8fcd-3d2c232ed00a","update":{"type":"turn-ended","usage":{"inputTokens":10397,"outputTokens":41,"cacheReadTokens":448,"cacheWriteTokens":0}}}}
{"type":"emit_inbound","label":"run.completed:1","frame":{"type":"run.completed","result":{"id":"run-e8e94512-2578-458e-8fcd-3d2c232ed00a","requestId":"b0ca1b65-cdfd-4f50-8698-1924b0521b15","status":"finished","result":"first fixture turn complete","model":{"id":"composer-2.5"},"durationMs":3685}}}
{"type":"expect_outbound","label":"run.start:2","frame":{"type":"run.start","message":"Respond with exactly: second fixture turn complete","options":{"model":{"id":"composer-2.5"},"mode":"agent"}}}
{"type":"emit_inbound","label":"run.started:2","frame":{"type":"run.started","runId":"run-28ee8e5c-e5b0-4da3-a793-6ac182da167f","agentId":"agent-2c1578fc-9bfb-4db9-91c2-8d6744a8cb4c"}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-28ee8e5c-e5b0-4da3-a793-6ac182da167f","update":{"type":"text-delta","text":"second"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-28ee8e5c-e5b0-4da3-a793-6ac182da167f","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-28ee8e5c-e5b0-4da3-a793-6ac182da167f","update":{"type":"text-delta","text":" fixture"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-28ee8e5c-e5b0-4da3-a793-6ac182da167f","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-28ee8e5c-e5b0-4da3-a793-6ac182da167f","update":{"type":"text-delta","text":" turn"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-28ee8e5c-e5b0-4da3-a793-6ac182da167f","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-28ee8e5c-e5b0-4da3-a793-6ac182da167f","update":{"type":"text-delta","text":" complete"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-28ee8e5c-e5b0-4da3-a793-6ac182da167f","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"step-completed","frame":{"type":"interaction.update","runId":"run-28ee8e5c-e5b0-4da3-a793-6ac182da167f","update":{"type":"step-completed","stepId":1,"stepDurationMs":830}}}
{"type":"emit_inbound","label":"turn-ended","frame":{"type":"interaction.update","runId":"run-28ee8e5c-e5b0-4da3-a793-6ac182da167f","update":{"type":"turn-ended","usage":{"inputTokens":10458,"outputTokens":29,"cacheReadTokens":10432,"cacheWriteTokens":0}}}}
{"type":"emit_inbound","label":"run.completed:2","frame":{"type":"run.completed","result":{"id":"run-28ee8e5c-e5b0-4da3-a793-6ac182da167f","requestId":"9e7ec735-db7c-4bdc-b75d-dce82a288678","status":"finished","result":"second fixture turn complete","model":{"id":"composer-2.5"},"durationMs":2467}}}
{"type":"expect_outbound","label":"agent.close","frame":{"type":"agent.close","agentId":"agent-2c1578fc-9bfb-4db9-91c2-8d6744a8cb4c"}}
@@ -160,6 +160,12 @@ export type OrchestratorFixtureInputStep =
readonly attachments?: ReadonlyArray<ChatAttachment>;
readonly targetRunIndex: number;
}
| {
readonly type: "restart";
readonly text: string;
readonly attachments?: ReadonlyArray<ChatAttachment>;
readonly targetRunIndex: number;
}
| {
readonly type: "interrupt";
readonly targetRunIndex: number;
@@ -225,6 +231,11 @@ export const CLAUDE_MODEL_SELECTION = {
model: "claude-sonnet-4-6",
} satisfies ModelSelection;
export const CURSOR_MODEL_SELECTION = {
instanceId: ProviderInstanceId.make("cursor"),
model: "composer-2.5",
} satisfies ModelSelection;
export const READ_ONLY_ON_REQUEST_POLICY = {
approvalPolicy: "on-request",
sandboxPolicy: {
@@ -384,7 +395,8 @@ export function materializeFixtureInput(input: {
const shouldRunInBackground =
(nextStep !== undefined &&
((nextStep.type === "interrupt" && nextStep.targetRunIndex === messageIndex) ||
nextStep.type === "queue_message")) ||
nextStep.type === "queue_message" ||
(nextStep.type === "restart" && nextStep.targetRunIndex === messageIndex))) ||
nextStep?.type === "approve_next_runtime_request" ||
nextStep?.type === "answer_next_user_input_request";
const key = `run:${messageIndex}`;
@@ -410,7 +422,7 @@ export function materializeFixtureInput(input: {
} else if (
!(
nextStep !== undefined &&
nextStep.type === "steer" &&
(nextStep.type === "steer" || nextStep.type === "restart") &&
nextStep.targetRunIndex === messageIndex
)
) {
@@ -525,6 +537,40 @@ export function materializeFixtureInput(input: {
steps.push({ type: "await_thread_idle", threadId: ids.threadId });
}
break;
case "restart":
messageIndex += 1;
steps.push({
type: "await_run_steerable",
threadId: ids.threadId,
runId: runIdFor(step.targetRunIndex),
});
pushDispatch(
dispatchMessageCommand({
commandId: yield* idAllocator.allocate.command({
fixtureName: input.scenario,
commandName: `restart-${messageIndex}`,
}),
ids,
modelSelection: input.modelSelection,
messageId: yield* idAllocator.allocate.message({
threadId: ids.threadId,
ordinal: messageIndex,
}),
text: step.text,
...(step.attachments === undefined ? {} : { attachments: step.attachments }),
dispatchMode: {
type: "restart_active",
targetRunId: runIdFor(step.targetRunIndex),
},
}),
);
if (input.fixtureInput.steps[stepIndex + 1]?.type !== "approve_next_runtime_request") {
if (activeRunDispatchKeys.delete(`run:${step.targetRunIndex}`)) {
steps.push({ type: "await", key: `run:${step.targetRunIndex}` });
}
steps.push({ type: "await_thread_idle", threadId: ids.threadId });
}
break;
case "interrupt":
if (step.waitForTurnItemType !== undefined) {
steps.push({
@@ -0,0 +1,11 @@
{"type":"transcript_start","provider":"cursor","protocol":"cursor-agent-sdk.local","version":"1","scenario":"simple","metadata":{"generatedBy":"recordCursorAgentSdkReplayTranscript","nativeAgentId":"agent-78cfad4d-9b71-4534-b49c-fbcfab939a0f"}}
{"type":"expect_outbound","label":"agent.open","frame":{"type":"agent.open","operation":"create","options":{"model":{"id":"composer-2.5"},"hasName":true,"mode":"agent","local":{"hasCwd":true,"autoReview":false,"sandboxEnabled":false,"enableAgentRetries":true}}}}
{"type":"emit_inbound","label":"agent.opened","frame":{"type":"agent.opened","agentId":"agent-78cfad4d-9b71-4534-b49c-fbcfab939a0f"}}
{"type":"expect_outbound","label":"run.start:1","frame":{"type":"run.start","message":"Respond with the following text: fixture simple ok","options":{"model":{"id":"composer-2.5"},"mode":"agent"}}}
{"type":"emit_inbound","label":"run.started:1","frame":{"type":"run.started","runId":"run-74d16078-96e5-44f9-ac08-9d854eeb3bab","agentId":"agent-78cfad4d-9b71-4534-b49c-fbcfab939a0f"}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-74d16078-96e5-44f9-ac08-9d854eeb3bab","update":{"type":"text-delta","text":"fixture simple ok"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-74d16078-96e5-44f9-ac08-9d854eeb3bab","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"step-completed","frame":{"type":"interaction.update","runId":"run-74d16078-96e5-44f9-ac08-9d854eeb3bab","update":{"type":"step-completed","stepId":1,"stepDurationMs":1246}}}
{"type":"emit_inbound","label":"turn-ended","frame":{"type":"interaction.update","runId":"run-74d16078-96e5-44f9-ac08-9d854eeb3bab","update":{"type":"turn-ended","usage":{"inputTokens":10393,"outputTokens":38,"cacheReadTokens":1856,"cacheWriteTokens":0}}}}
{"type":"emit_inbound","label":"run.completed:1","frame":{"type":"run.completed","result":{"id":"run-74d16078-96e5-44f9-ac08-9d854eeb3bab","requestId":"a35bc166-9742-4bd7-bcc4-22620560c2d2","status":"finished","result":"fixture simple ok","model":{"id":"composer-2.5"},"durationMs":3983}}}
{"type":"expect_outbound","label":"agent.close","frame":{"type":"agent.close","agentId":"agent-78cfad4d-9b71-4534-b49c-fbcfab939a0f"}}
@@ -0,0 +1,79 @@
import { assert } from "@effect/vitest";
import type { ProviderReplayTranscript } from "@t3tools/contracts";
import type { OrchestratorV2ScenarioResult } from "../../OrchestratorScenario.ts";
import {
assertAssistantTextIncludes,
assertBaseProjection,
assertExecutionNodeKinds,
assertNoExtraAppRunsForProviderChildren,
assertRunProviderTurnCardinality,
assertSemanticProjectionIntegrity,
assertTurnItemTypes,
assertUserMessagesInclude,
projectionFor,
SUBAGENT_PROMPT,
} from "../shared.ts";
export function assertCursorSubagentOutput(
result: OrchestratorV2ScenarioResult,
transcript: ProviderReplayTranscript,
) {
assertBaseProjection({
result,
transcript,
runCount: 1,
runStatuses: ["completed"],
});
const projection = projectionFor(result, transcript.scenario);
assertSemanticProjectionIntegrity(projection);
assertExecutionNodeKinds(projection, ["root_turn", "subagent"]);
assertTurnItemTypes(projection, ["user_message", "subagent", "assistant_message"]);
assertRunProviderTurnCardinality({ projection, rootRunCount: 1 });
assertNoExtraAppRunsForProviderChildren({ projection, expectedAppRuns: 1 });
assertUserMessagesInclude(projection, [SUBAGENT_PROMPT]);
assertAssistantTextIncludes(projection, "cursor-read-only-fixture");
assertAssistantTextIncludes(projection, "ES2022");
assert.lengthOf(projection.subagents, 2);
assert.lengthOf(result.shellSnapshot.threads, 3);
assert.deepEqual(
projection.subagents.map((subagent) => subagent.status),
["completed", "completed"],
);
for (const subagent of projection.subagents) {
assert.equal(subagent.origin, "provider_native");
assert.equal(subagent.createdBy, "agent");
assert.equal(subagent.provider, "cursor");
assert.isNull(subagent.providerThreadId);
assert.isNotNull(subagent.childThreadId);
assert.isNotNull(subagent.nativeTaskRef);
assert.isNotNull(subagent.completedAt);
assert.isNotNull(subagent.result);
if (subagent.childThreadId === null) {
throw new Error(`Subagent ${subagent.id} is missing its child thread`);
}
const childProjection = result.projections.get(subagent.childThreadId);
assert.isDefined(childProjection);
assert.equal(childProjection.thread.lineage.parentThreadId, projection.thread.id);
assert.equal(childProjection.thread.lineage.relationshipToParent, "subagent");
assert.isNull(childProjection.thread.activeProviderThreadId);
assert.lengthOf(childProjection.runs, 0);
assert.lengthOf(childProjection.providerThreads, 0);
assert.lengthOf(childProjection.providerTurns, 0);
assertExecutionNodeKinds(childProjection, ["root_turn", "tool_call"]);
assertTurnItemTypes(childProjection, ["user_message", "file_search", "assistant_message"]);
assertUserMessagesInclude(childProjection, [subagent.prompt]);
assert.isTrue(
childProjection.turnItems.some(
(item) =>
item.type === "assistant_message" &&
subagent.result !== null &&
item.text.includes(subagent.result.slice(0, 40)),
),
);
}
}
@@ -0,0 +1,474 @@
{"type":"transcript_start","provider":"cursor","protocol":"cursor-agent-sdk.local","version":"1","scenario":"subagent","metadata":{"generatedBy":"recordCursorAgentSdkReplayTranscript","nativeAgentId":"agent-1eee5e51-da10-4b21-af9a-ef9aca8c482d"}}
{"type":"expect_outbound","label":"agent.open","frame":{"type":"agent.open","operation":"create","options":{"model":{"id":"composer-2.5"},"hasName":true,"mode":"agent","local":{"hasCwd":true,"autoReview":false,"sandboxEnabled":true,"enableAgentRetries":true}}}}
{"type":"emit_inbound","label":"agent.opened","frame":{"type":"agent.opened","agentId":"agent-1eee5e51-da10-4b21-af9a-ef9aca8c482d"}}
{"type":"expect_outbound","label":"run.start:1","frame":{"type":"run.start","message":"Spawn 2 subagents, one to read package.json and one to read tsconfig.json","options":{"model":{"id":"composer-2.5"},"mode":"agent"}}}
{"type":"emit_inbound","label":"run.started:1","frame":{"type":"run.started","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","agentId":"agent-1eee5e51-da10-4b21-af9a-ef9aca8c482d"}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"thinking-delta","text":"Spawning two subagents"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"thinking-delta","text":" to read package.json"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"thinking-delta","text":" and tsconfig.json."}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"thinking-completed","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"thinking-completed","thinkingDurationMs":130}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Sp"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"awning"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" two"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" sub"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"agents"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" in"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" parallel"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" to"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" read"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" `"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"package"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":".json"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"`"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" and"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" `"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"ts"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"config"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":".json"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"`.\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":72}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"partial-tool-call","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"partial-tool-call","callId":"tool_0c313ecc-9783-4a21-b0d5-74150331312","toolCall":{"type":"task","args":{"description":"Read package.json","prompt":"Read the file package.json in the workspace root at /tmp/cursor-replay-subagent/package.json and return its full contents along with a brief summary of what the project is (name, dependencies, scripts, etc.).","subagentType":{"kind":"unspecified"},"model":"composer-2.5-fast","agentId":"414d4889-6f0e-4866-9379-cd8a57673251","mode":"unspecified"}},"modelCallId":"393d6cf5-3363-488b-80aa-ca0498451dca-0-zcvb"}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"tool-call-started","callId":"tool_0c313ecc-9783-4a21-b0d5-74150331312","toolCall":{"type":"task","args":{"description":"Read package.json","prompt":"Read the file package.json in the workspace root at /tmp/cursor-replay-subagent/package.json and return its full contents along with a brief summary of what the project is (name, dependencies, scripts, etc.).","subagentType":{"kind":"unspecified"},"model":"composer-2.5-fast","agentId":"414d4889-6f0e-4866-9379-cd8a57673251","mode":"unspecified"}},"modelCallId":"393d6cf5-3363-488b-80aa-ca0498451dca-0-zcvb"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":78}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"partial-tool-call","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"partial-tool-call","callId":"tool_1d92aa7d-e115-4918-9cf6-d384c92098a","toolCall":{"type":"task","args":{"description":"Read tsconfig.json","prompt":"Read the file tsconfig.json in the workspace root at /tmp/cursor-replay-subagent/tsconfig.json and return its full contents along with a brief summary of the TypeScript configuration (compiler options, target, module settings, etc.).","subagentType":{"kind":"unspecified"},"model":"composer-2.5-fast","agentId":"4eab0559-c807-4f08-a101-c8d99d895c82","mode":"unspecified"}},"modelCallId":"393d6cf5-3363-488b-80aa-ca0498451dca-0-zcvb"}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"tool-call-started","callId":"tool_1d92aa7d-e115-4918-9cf6-d384c92098a","toolCall":{"type":"task","args":{"description":"Read tsconfig.json","prompt":"Read the file tsconfig.json in the workspace root at /tmp/cursor-replay-subagent/tsconfig.json and return its full contents along with a brief summary of the TypeScript configuration (compiler options, target, module settings, etc.).","subagentType":{"kind":"unspecified"},"model":"composer-2.5-fast","agentId":"4eab0559-c807-4f08-a101-c8d99d895c82","mode":"unspecified"}},"modelCallId":"393d6cf5-3363-488b-80aa-ca0498451dca-0-zcvb"}}}
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"tool-call-completed","callId":"tool_0c313ecc-9783-4a21-b0d5-74150331312","toolCall":{"type":"task","args":{"description":"Read package.json","prompt":"Read the file package.json in the workspace root at /tmp/cursor-replay-subagent/package.json and return its full contents along with a brief summary of what the project is (name, dependencies, scripts, etc.).","subagentType":{"kind":"unspecified"},"model":"composer-2.5-fast","agentId":"414d4889-6f0e-4866-9379-cd8a57673251","mode":"unspecified"},"result":{"status":"success","value":{"conversationSteps":[{"toolCall":{"readToolCall":{"args":{"path":"/tmp/cursor-replay-subagent/package.json"},"result":{"success":{"content":"{\"name\":\"cursor-read-only-fixture\",\"private\":true,\"scripts\":{\"typecheck\":\"tsc --noEmit\"}}","totalLines":1,"fileSize":89,"path":"/tmp/cursor-replay-subagent/package.json","readRange":{"startLine":1,"endLine":1}}}},"toolCallId":"tool_45b696cd-7ad1-4fb6-bdd5-32452d02ea5"}},{"assistantMessage":{"text":"## Full contents\n\n```json\n{\n \"name\": \"cursor-read-only-fixture\",\n \"private\": true,\n \"scripts\": {\n \"typecheck\": \"tsc --noEmit\"\n }\n}\n```\n\n## Summary\n\n| Field | Value |\n|--------|--------|\n| **Name** | `cursor-read-only-fixture` |\n| **Private** | `true` (not intended for npm publish) |\n| **Scripts** | `typecheck` — runs TypeScript compiler in check-only mode (`tsc --noEmit`) |\n| **Dependencies** | None listed |\n| **Dev dependencies** | None listed |\n\nThis is a minimal TypeScript fixture project. It has no runtime or build dependencies in `package.json`; the only script is type-checking via `tsc`. The name suggests it’s a read-only test or demo setup for Cursor/orchestrator tooling rather than a full application."}}],"agentId":"414d4889-6f0e-4866-9379-cd8a57673251","isBackground":false,"durationMs":3570,"backgroundReason":"unspecified"}}},"modelCallId":"393d6cf5-3363-488b-80aa-ca0498451dca-0-zcvb"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":258}}}
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"tool-call-completed","callId":"tool_1d92aa7d-e115-4918-9cf6-d384c92098a","toolCall":{"type":"task","args":{"description":"Read tsconfig.json","prompt":"Read the file tsconfig.json in the workspace root at /tmp/cursor-replay-subagent/tsconfig.json and return its full contents along with a brief summary of the TypeScript configuration (compiler options, target, module settings, etc.).","subagentType":{"kind":"unspecified"},"model":"composer-2.5-fast","agentId":"4eab0559-c807-4f08-a101-c8d99d895c82","mode":"unspecified"},"result":{"status":"success","value":{"conversationSteps":[{"assistantMessage":{"text":"Reading `tsconfig.json` and summarizing its TypeScript settings.\n"}},{"toolCall":{"readToolCall":{"args":{"path":"/tmp/cursor-replay-subagent/tsconfig.json"},"result":{"success":{"content":"{\"compilerOptions\":{\"module\":\"ESNext\",\"strict\":true,\"target\":\"ES2022\"}}","totalLines":1,"fileSize":71,"path":"/tmp/cursor-replay-subagent/tsconfig.json","readRange":{"startLine":1,"endLine":1}}}},"toolCallId":"tool_af98da3d-ddfc-4f07-a9a2-1c1ac8efcd6"}},{"assistantMessage":{"text":"## Full contents\n\n```json\n{\n \"compilerOptions\": {\n \"module\": \"ESNext\",\n \"strict\": true,\n \"target\": \"ES2022\"\n }\n}\n```\n\n## Summary\n\nThis is a minimal TypeScript config with three compiler options:\n\n| Option | Value | Meaning |\n|--------|--------|---------|\n| **target** | `ES2022` | Emit JavaScript for ES2022 (modern syntax and runtime features). |\n| **module** | `ESNext` | Use the latest ECMAScript module format for imports/exports. |\n| **strict** | `true` | Enable all strict type-checking options (e.g. `strictNullChecks`, `noImplicitAny`). |\n\n**Not specified (defaults apply):**\n- No `include` / `exclude` — TypeScript will include all `.ts` files in the project directory.\n- No `outDir` / `rootDir` — output location and root are inferred or use defaults.\n- No `moduleResolution`, `esModuleInterop`, `skipLibCheck`, or path aliases — standard defaults are used.\n\nOverall, it targets modern ES modules with strict checking and leaves most other settings at TypeScript defaults."}}],"agentId":"4eab0559-c807-4f08-a101-c8d99d895c82","isBackground":false,"durationMs":3614,"backgroundReason":"unspecified"}}},"modelCallId":"393d6cf5-3363-488b-80aa-ca0498451dca-0-zcvb"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":325}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Both"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" sub"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"agents"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" finished"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"."}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" Here"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"’s"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" what"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" they"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" reported"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":":\n\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"##"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" package"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":".json"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\n\n"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"```"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"json"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\n"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"{\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" "}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" \""}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"name"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\":"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" \""}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"cursor"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-read"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-only"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-fix"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"ture"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\",\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" "}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" \""}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"private"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\":"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" true"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":",\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" "}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" \""}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"scripts"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\":"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" {\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" "}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" \""}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"type"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"check"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\":"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" \""}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"t"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"sc"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" --"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"no"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Emit"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\"\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" "}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" }\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"}\n"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"```\n\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" **"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Name"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":":**"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" `"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"cursor"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-read"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-only"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-fix"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"ture"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"`\n"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" **"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Private"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":":**"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" `"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"true"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"`"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" ("}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"not"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" for"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" npm"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" publish"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":")\n"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" **"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Scripts"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":":**"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" `"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"type"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"check"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"`"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" runs"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" `"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"t"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"sc"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" --"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"no"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Emit"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"`\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" **"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Dependencies"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":":**"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" none"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" listed"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\n\n"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"This"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" looks"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" like"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" a"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" minimal"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" Type"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Script"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" fixture"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" for"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" Cursor"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"/or"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"che"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"strator"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" tooling"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":".\n\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"##"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" ts"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"config"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":".json"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\n\n"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"```"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"json"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\n"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"{\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" "}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" \""}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"compiler"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Options"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\":"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" {\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" "}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" \""}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"module"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\":"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" \""}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"ES"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Next"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\",\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" "}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" \""}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"strict"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\":"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" true"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":",\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" "}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" \""}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"target"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\":"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" \""}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"ES"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"202"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"2"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\"\n"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" "}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" }\n"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"}\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"```\n\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" **"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"target"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":":**"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" `"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"ES"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"202"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"2"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"`\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" **"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"module"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":":**"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" `"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"ES"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Next"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"`\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" **"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"strict"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":":**"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" `"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"true"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"`"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" ("}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"full"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" strict"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" type"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-check"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"ing"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":")\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" No"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" `"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"include"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"`"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"/`"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"exclude"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"`,"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" `"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"out"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Dir"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"`,"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" or"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" path"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" aliases"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" —"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" defaults"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" apply"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"\n\n"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Together"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":","}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" this"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" is"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" a"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" small"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" read"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"-only"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" Type"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"Script"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" project"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" with"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" strict"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" checking"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" and"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" a"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" single"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" type"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"check"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":" script"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"text-delta","text":"."}}}
{"type":"emit_inbound","label":"step-completed","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"step-completed","stepId":5,"stepDurationMs":6831}}}
{"type":"emit_inbound","label":"turn-ended","frame":{"type":"interaction.update","runId":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","update":{"type":"turn-ended","usage":{"inputTokens":21878,"outputTokens":661,"cacheReadTokens":17788,"cacheWriteTokens":0}}}}
{"type":"emit_inbound","label":"run.completed:1","frame":{"type":"run.completed","result":{"id":"run-4f9fd970-8f15-44ae-8973-09aa4d42daaf","requestId":"393d6cf5-3363-488b-80aa-ca0498451dca","status":"finished","result":"Both subagents finished. Here’s what they reported:\n\n## package.json\n\n```json\n{\n \"name\": \"cursor-read-only-fixture\",\n \"private\": true,\n \"scripts\": {\n \"typecheck\": \"tsc --noEmit\"\n }\n}\n```\n\n- **Name:** `cursor-read-only-fixture`\n- **Private:** `true` (not for npm publish)\n- **Scripts:** `typecheck` runs `tsc --noEmit`\n- **Dependencies:** none listed\n\nThis looks like a minimal TypeScript fixture for Cursor/orchestrator tooling.\n\n## tsconfig.json\n\n```json\n{\n \"compilerOptions\": {\n \"module\": \"ESNext\",\n \"strict\": true,\n \"target\": \"ES2022\"\n }\n}\n```\n\n- **target:** `ES2022`\n- **module:** `ESNext`\n- **strict:** `true` (full strict type-checking)\n- No `include`/`exclude`, `outDir`, or path aliases — defaults apply\n\nTogether, this is a small read-only TypeScript project with strict checking and a single typecheck script.","model":{"id":"composer-2.5"},"durationMs":9585}}}
{"type":"expect_outbound","label":"agent.close","frame":{"type":"agent.close","agentId":"agent-1eee5e51-da10-4b21-af9a-ef9aca8c482d"}}
@@ -0,0 +1,44 @@
import { assert } from "@effect/vitest";
import type { ProviderReplayTranscript } from "@t3tools/contracts";
import type { OrchestratorV2ScenarioResult } from "../../OrchestratorScenario.ts";
import {
assertAssistantTextIncludes,
assertBaseProjection,
assertExecutionNodeKinds,
assertRunOrdinals,
assertSemanticProjectionIntegrity,
assertTurnItemTypes,
assertUserMessagesInclude,
assertVisibleTurnItemsMirrorLocalTurnItems,
projectionFor,
TODO_LIST_PROMPT,
} from "../shared.ts";
export function assertTodoListCursorOutput(
result: OrchestratorV2ScenarioResult,
transcript: ProviderReplayTranscript,
) {
assertBaseProjection({ result, transcript, runCount: 1, runStatuses: ["completed"] });
const projection = projectionFor(result, transcript.scenario);
assertSemanticProjectionIntegrity(projection);
assertVisibleTurnItemsMirrorLocalTurnItems(projection);
assertRunOrdinals(projection, [1]);
assertExecutionNodeKinds(projection, ["root_turn", "todo_list", "tool_call"]);
assertTurnItemTypes(projection, [
"user_message",
"file_search",
"todo_list",
"assistant_message",
]);
assertUserMessagesInclude(projection, [TODO_LIST_PROMPT]);
assertAssistantTextIncludes(projection, "todo list fixture complete");
const todoLists = projection.plans.filter((plan) => plan.kind === "todo_list");
assert.isAtLeast(todoLists.length, 1);
assert.deepEqual(
todoLists.at(-1)?.steps.map((step) => step.status),
["completed", "completed", "completed"],
);
}
@@ -0,0 +1,104 @@
{"type":"transcript_start","provider":"cursor","protocol":"cursor-agent-sdk.local","version":"1","scenario":"todo_list","metadata":{"generatedBy":"recordCursorAgentSdkReplayTranscript","nativeAgentId":"agent-dc85ea29-1f94-4803-8d28-0dc358300ffe"}}
{"type":"expect_outbound","label":"agent.open","frame":{"type":"agent.open","operation":"create","options":{"model":{"id":"composer-2.5"},"hasName":true,"mode":"agent","local":{"hasCwd":true,"autoReview":false,"sandboxEnabled":true,"enableAgentRetries":true}}}}
{"type":"emit_inbound","label":"agent.opened","frame":{"type":"agent.opened","agentId":"agent-dc85ea29-1f94-4803-8d28-0dc358300ffe"}}
{"type":"expect_outbound","label":"run.start:1","frame":{"type":"run.start","message":"Use the update_plan tool to track exactly three steps: inspect package.json, inspect tsconfig.json, report completion. Then read package.json and tsconfig.json, and answer exactly: todo list fixture complete","options":{"model":{"id":"composer-2.5"},"mode":"agent"}}}
{"type":"emit_inbound","label":"run.started:1","frame":{"type":"run.started","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","agentId":"agent-dc85ea29-1f94-4803-8d28-0dc358300ffe"}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":"I'll"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":" use"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":" the update_plan"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":" tool for"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":" the three steps"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":","}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":" then read both"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":" config"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":" files"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":".\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":30}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"tool-call-started","callId":"tool_1afa2c76-8304-41d9-a59d-139ff962eb0","toolCall":{"type":"read","args":{"path":"/tmp/cursor-replay-todo_list/package.json"}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-0-wgfq"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":31}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"tool-call-started","callId":"tool_fb1809e9-fffb-4f76-9b0f-10e4f0f1f88","toolCall":{"type":"read","args":{"path":"/tmp/cursor-replay-todo_list/tsconfig.json"}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-0-wgfq"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":17}}}
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"tool-call-completed","callId":"tool_1afa2c76-8304-41d9-a59d-139ff962eb0","toolCall":{"type":"read","args":{"path":"/tmp/cursor-replay-todo_list/package.json"},"result":{"status":"success","value":{"content":"{\"name\":\"cursor-read-only-fixture\",\"private\":true,\"scripts\":{\"typecheck\":\"tsc --noEmit\"}}","totalLines":1,"fileSize":89}}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-0-wgfq"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":22}}}
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"tool-call-completed","callId":"tool_fb1809e9-fffb-4f76-9b0f-10e4f0f1f88","toolCall":{"type":"read","args":{"path":"/tmp/cursor-replay-todo_list/tsconfig.json"},"result":{"status":"success","value":{"content":"{\"compilerOptions\":{\"module\":\"ESNext\",\"strict\":true,\"target\":\"ES2022\"}}","totalLines":1,"fileSize":71}}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-0-wgfq"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":18}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"tool-call-started","callId":"tool_b9573f13-5878-4f12-8a4a-1ac6539d2c6","toolCall":{"type":"grep","args":{"pattern":"update_plan","offset":0}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-1-kj0v"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"tool-call-started","callId":"tool_85d050cc-5276-4dea-9ae0-69d7d0c5dcf","toolCall":{"type":"glob","args":{"globPattern":"**/*"}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-1-kj0v"}}}
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"tool-call-completed","callId":"tool_b9573f13-5878-4f12-8a4a-1ac6539d2c6","toolCall":{"type":"grep","args":{"pattern":"update_plan","offset":0},"result":{"status":"success","value":{"workspaceResults":{"/var/folders/b3/b51_pdxj7dl0t981zpqkxxhr0000gn/T/t3-orchestrator-v2-cursor-agent-sdk-record-todo_list-CIb23S":{"type":"content","output":{"matches":[],"totalMatches":0}}}}}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-1-kj0v"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":45}}}
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"tool-call-completed","callId":"tool_85d050cc-5276-4dea-9ae0-69d7d0c5dcf","toolCall":{"type":"glob","args":{"globPattern":"**/*"},"result":{"status":"success","value":{"files":["./tsconfig.json","./package.json","./.git/logs/refs/heads/main","./.git/logs/HEAD","./.git/refs/heads/main","./.git/objects/ca/af47d623ededb9003c98e14a66bcfd037f0182","./.git/COMMIT_EDITMSG","./README.md","./.git/config","./.git/HEAD","./.git/hooks/push-to-checkout.sample","./.git/hooks/update.sample","./.git/hooks/pre-push.sample","./.git/hooks/pre-applypatch.sample","./.git/hooks/pre-merge-commit.sample","./.git/hooks/post-update.sample","./.git/hooks/prepare-commit-msg.sample","./.git/hooks/pre-receive.sample","./.git/hooks/fsmonitor-watchman.sample","./.git/hooks/applypatch-msg.sample","./.git/hooks/pre-commit.sample","./.git/hooks/sendemail-validate.sample","./.git/hooks/pre-rebase.sample","./.git/hooks/commit-msg.sample","./.git/description","./.git/info/exclude"],"totalFiles":26,"clientTruncated":false,"ripgrepTruncated":false}}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-1-kj0v"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":206}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"thinking-delta","text":"The update_plan tool"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"thinking-delta","text":" does not exist in the"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"thinking-delta","text":" MCP servers or codebase."}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":6}}}
{"type":"emit_inbound","label":"thinking-completed","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"thinking-completed","thinkingDurationMs":608}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":30}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"tool-call-started","callId":"tool_196feaa1-1381-49c6-8bf5-e716ff05eef","toolCall":{"type":"read","args":{"path":"/tmp/cursor-replay-todo_list/README.md"}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-2-zbbf"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":10}}}
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"tool-call-completed","callId":"tool_196feaa1-1381-49c6-8bf5-e716ff05eef","toolCall":{"type":"read","args":{"path":"/tmp/cursor-replay-todo_list/README.md"},"result":{"status":"success","value":{"content":"# cursor-agent-sdk-record-todo_list\n","totalLines":2,"fileSize":36}}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-2-zbbf"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":9}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"thinking-delta","text":"The update_plan tool"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"thinking-delta","text":" is unavailable."}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"thinking-delta","text":"\n\nTodoWrite will replace"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":6}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"thinking-delta","text":" the unavailable update_plan"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":7}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"thinking-delta","text":" tool."}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"thinking-completed","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"thinking-completed","thinkingDurationMs":984}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":"No `update_plan"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":"` tool is"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":" available here; I'll"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":" track"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":" the three"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":" steps with Todo"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":"Write instead"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":".\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"partial-tool-call","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"partial-tool-call","callId":"tool_64775a27-f6f1-4f85-9061-2038c1c6d57","toolCall":{"type":"updateTodos","args":{"todos":[{"content":"inspect package.json","status":"completed"}]}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-3-fvov"}}}
{"type":"emit_inbound","label":"partial-tool-call","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"partial-tool-call","callId":"tool_64775a27-f6f1-4f85-9061-2038c1c6d57","toolCall":{"type":"updateTodos","args":{"todos":[{"content":"inspect package.json","status":"completed"},{"content":"inspect tsconfig.json","status":"completed"}]}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-3-fvov"}}}
{"type":"emit_inbound","label":"partial-tool-call","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"partial-tool-call","callId":"tool_64775a27-f6f1-4f85-9061-2038c1c6d57","toolCall":{"type":"updateTodos","args":{"todos":[{"content":"inspect package.json","status":"completed"},{"content":"inspect tsconfig.json","status":"completed"},{"content":"report completion","status":"completed"}]}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-3-fvov"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":53}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"tool-call-started","callId":"tool_64775a27-f6f1-4f85-9061-2038c1c6d57","toolCall":{"type":"updateTodos","args":{"todos":[{"content":"inspect package.json","status":"completed"},{"content":"inspect tsconfig.json","status":"completed"},{"content":"report completion","status":"completed"}]}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-3-fvov"}}}
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"tool-call-completed","callId":"tool_64775a27-f6f1-4f85-9061-2038c1c6d57","toolCall":{"type":"updateTodos","args":{"todos":[{"content":"inspect package.json","status":"completed"},{"content":"inspect tsconfig.json","status":"completed"},{"content":"report completion","status":"completed"}]},"result":{"status":"success","value":{"todos":[{"content":"inspect package.json","status":"completed"},{"content":"inspect tsconfig.json","status":"completed"},{"content":"report completion","status":"completed"}],"totalCount":3}}},"modelCallId":"78b3b965-5601-4832-a723-a9259703c762-3-fvov"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":93}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":"todo"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"text-delta","text":" list fixture complete"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"step-completed","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"step-completed","stepId":13,"stepDurationMs":9044}}}
{"type":"emit_inbound","label":"turn-ended","frame":{"type":"interaction.update","runId":"run-50c35736-cb9d-4070-8299-8a4360c76af7","update":{"type":"turn-ended","usage":{"inputTokens":55956,"outputTokens":1036,"cacheReadTokens":40288,"cacheWriteTokens":0}}}}
{"type":"emit_inbound","label":"run.completed:1","frame":{"type":"run.completed","result":{"id":"run-50c35736-cb9d-4070-8299-8a4360c76af7","requestId":"78b3b965-5601-4832-a723-a9259703c762","status":"finished","result":"todo list fixture complete","model":{"id":"composer-2.5"},"durationMs":11741}}}
{"type":"expect_outbound","label":"agent.close","frame":{"type":"agent.close","agentId":"agent-dc85ea29-1f94-4803-8d28-0dc358300ffe"}}
@@ -0,0 +1,39 @@
import { assert } from "@effect/vitest";
import type { ProviderReplayTranscript } from "@t3tools/contracts";
import type { OrchestratorV2ScenarioResult } from "../../OrchestratorScenario.ts";
import {
assertAssistantTextIncludes,
assertBaseProjection,
assertRuntimeRequestCounts,
assertSemanticProjectionIntegrity,
assertTurnItemTypes,
assertUserMessagesInclude,
assertVisibleTurnItemsMirrorLocalTurnItems,
projectionFor,
TOOL_CALL_READ_ONLY_PROMPT,
} from "../shared.ts";
export function assertToolCallReadOnlyCursorOutput(
result: OrchestratorV2ScenarioResult,
transcript: ProviderReplayTranscript,
) {
assertBaseProjection({ result, transcript, runCount: 1, runStatuses: ["completed"] });
const projection = projectionFor(result, transcript.scenario);
assertSemanticProjectionIntegrity(projection);
assertVisibleTurnItemsMirrorLocalTurnItems(projection);
assertTurnItemTypes(projection, ["user_message", "file_search", "assistant_message"]);
assertUserMessagesInclude(projection, [TOOL_CALL_READ_ONLY_PROMPT]);
assertAssistantTextIncludes(projection, "read only tool fixture complete");
assertRuntimeRequestCounts(projection, { total: 0 });
const fileSearches = projection.turnItems.filter((item) => item.type === "file_search");
assert.lengthOf(fileSearches, 2);
assert.isTrue(
fileSearches.some((item) =>
JSON.stringify(item.results ?? []).includes("cursor-read-only-fixture"),
),
);
assert.isTrue(fileSearches.some((item) => JSON.stringify(item.results ?? []).includes("ES2022")));
}
@@ -0,0 +1,27 @@
{"type":"transcript_start","provider":"cursor","protocol":"cursor-agent-sdk.local","version":"1","scenario":"tool_call_read_only","metadata":{"generatedBy":"recordCursorAgentSdkReplayTranscript","nativeAgentId":"agent-3d017b33-d7fe-40aa-868b-0b7a68d0e15b"}}
{"type":"expect_outbound","label":"agent.open","frame":{"type":"agent.open","operation":"create","options":{"model":{"id":"composer-2.5"},"hasName":true,"mode":"agent","local":{"hasCwd":true,"autoReview":false,"sandboxEnabled":true,"enableAgentRetries":true}}}}
{"type":"emit_inbound","label":"agent.opened","frame":{"type":"agent.opened","agentId":"agent-3d017b33-d7fe-40aa-868b-0b7a68d0e15b"}}
{"type":"expect_outbound","label":"run.start:1","frame":{"type":"run.start","message":"Read /tmp/claude-replay-tool_call_read_only/package.json and /tmp/claude-replay-tool_call_read_only/tsconfig.json, then answer exactly: read only tool fixture complete","options":{"model":{"id":"composer-2.5"},"mode":"agent"}}}
{"type":"emit_inbound","label":"run.started:1","frame":{"type":"run.started","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","agentId":"agent-3d017b33-d7fe-40aa-868b-0b7a68d0e15b"}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"text-delta","text":"Reading both files now"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"text-delta","text":".\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"token-delta","tokens":13}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"tool-call-started","callId":"tool_56c7e2fb-8a39-4b1d-8b28-31f47bd717e","toolCall":{"type":"read","args":{"path":"/tmp/cursor-replay-tool_call_read_only/package.json"}},"modelCallId":"fb59b086-fb0a-4263-ac27-2c53351e44ac-0-279u"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"token-delta","tokens":13}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"tool-call-started","callId":"tool_a4c6ef64-f13c-4738-b527-1aad09b6185","toolCall":{"type":"read","args":{"path":"/tmp/cursor-replay-tool_call_read_only/tsconfig.json"}},"modelCallId":"fb59b086-fb0a-4263-ac27-2c53351e44ac-0-279u"}}}
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"tool-call-completed","callId":"tool_56c7e2fb-8a39-4b1d-8b28-31f47bd717e","toolCall":{"type":"read","args":{"path":"/tmp/cursor-replay-tool_call_read_only/package.json"},"result":{"status":"success","value":{"content":"{\"name\":\"cursor-read-only-fixture\",\"private\":true,\"scripts\":{\"typecheck\":\"tsc --noEmit\"}}","totalLines":1,"fileSize":89}}},"modelCallId":"fb59b086-fb0a-4263-ac27-2c53351e44ac-0-279u"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"token-delta","tokens":23}}}
{"type":"emit_inbound","label":"tool-call-completed","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"tool-call-completed","callId":"tool_a4c6ef64-f13c-4738-b527-1aad09b6185","toolCall":{"type":"read","args":{"path":"/tmp/cursor-replay-tool_call_read_only/tsconfig.json"},"result":{"status":"success","value":{"content":"{\"compilerOptions\":{\"module\":\"ESNext\",\"strict\":true,\"target\":\"ES2022\"}}","totalLines":1,"fileSize":71}}},"modelCallId":"fb59b086-fb0a-4263-ac27-2c53351e44ac-0-279u"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"token-delta","tokens":17}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"text-delta","text":"read"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"text-delta","text":" only tool fixture complete"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"token-delta","tokens":6}}}
{"type":"emit_inbound","label":"step-completed","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"step-completed","stepId":4,"stepDurationMs":2132}}}
{"type":"emit_inbound","label":"turn-ended","frame":{"type":"interaction.update","runId":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","update":{"type":"turn-ended","usage":{"inputTokens":20572,"outputTokens":118,"cacheReadTokens":14720,"cacheWriteTokens":0}}}}
{"type":"emit_inbound","label":"run.completed:1","frame":{"type":"run.completed","result":{"id":"run-db8a1002-593e-4baf-9ed1-d837c14643ed","requestId":"fb59b086-fb0a-4263-ac27-2c53351e44ac","status":"finished","result":"read only tool fixture complete","model":{"id":"composer-2.5"},"durationMs":4662}}}
{"type":"expect_outbound","label":"agent.close","frame":{"type":"agent.close","agentId":"agent-3d017b33-d7fe-40aa-868b-0b7a68d0e15b"}}
@@ -0,0 +1,75 @@
import { assert } from "@effect/vitest";
import type { ProviderReplayTranscript } from "@t3tools/contracts";
import type { OrchestratorV2ScenarioResult } from "../../OrchestratorScenario.ts";
import {
assertBaseProjection,
assertSemanticProjectionIntegrity,
assertTurnItemTypes,
assertUserMessagesInclude,
assertVisibleTurnItemsMirrorLocalTurnItems,
projectionFor,
TURN_INTERRUPT_MID_TOOL_PROMPT,
} from "../shared.ts";
function frameType(frame: unknown): string | undefined {
return typeof frame === "object" && frame !== null
? (Reflect.get(frame, "type") as string | undefined)
: undefined;
}
function cursorUpdateType(frame: unknown): string | undefined {
if (frameType(frame) !== "interaction.update") {
return undefined;
}
const update = Reflect.get(frame as object, "update");
return typeof update === "object" && update !== null
? (Reflect.get(update, "type") as string | undefined)
: undefined;
}
export function assertTurnInterruptMidToolCursorOutput(
result: OrchestratorV2ScenarioResult,
transcript: ProviderReplayTranscript,
) {
const toolStartedIndex = transcript.entries.findIndex(
(entry) =>
entry.type === "emit_inbound" && cursorUpdateType(entry.frame) === "tool-call-started",
);
const cancelIndex = transcript.entries.findIndex(
(entry) => entry.type === "expect_outbound" && frameType(entry.frame) === "run.cancel",
);
assert.isAtLeast(toolStartedIndex, 0);
assert.isAbove(cancelIndex, toolStartedIndex);
assertBaseProjection({ result, transcript, runCount: 1, runStatuses: ["interrupted"] });
const projection = projectionFor(result, transcript.scenario);
assertSemanticProjectionIntegrity(projection);
assertVisibleTurnItemsMirrorLocalTurnItems(projection);
assertTurnItemTypes(projection, [
"user_message",
"command_execution",
"run_interrupt_request",
"run_interrupt_result",
]);
assertUserMessagesInclude(projection, [TURN_INTERRUPT_MID_TOOL_PROMPT]);
const commandItem = projection.turnItems.find((item) => item.type === "command_execution");
const interruptRequest = projection.turnItems.find(
(item) => item.type === "run_interrupt_request",
);
const interruptResult = projection.turnItems.find((item) => item.type === "run_interrupt_result");
assert.isDefined(commandItem);
assert.isDefined(interruptRequest);
assert.isDefined(interruptResult);
assert.include(commandItem.input, "node -e");
assert.equal(interruptRequest.status, "completed");
assert.equal(interruptResult.status, "interrupted");
assert.equal(interruptResult.parentItemId, interruptRequest.id);
assert.deepEqual(
projection.attempts.map((attempt) => attempt.status),
["interrupted"],
);
assert.equal(projection.providerThreads[0]?.status, "idle");
assert.equal(projection.providerTurns[0]?.status, "interrupted");
}
@@ -0,0 +1,43 @@
{"type":"transcript_start","provider":"cursor","protocol":"cursor-agent-sdk.local","version":"1","scenario":"turn_interrupt_mid_tool","metadata":{"generatedBy":"recordCursorAgentSdkReplayTranscript","nativeAgentId":"agent-e4dcb030-b82a-4526-9b30-3db02142c1bb"}}
{"type":"expect_outbound","label":"agent.open","frame":{"type":"agent.open","operation":"create","options":{"model":{"id":"composer-2.5"},"hasName":true,"mode":"agent","local":{"hasCwd":true,"autoReview":false,"sandboxEnabled":true,"enableAgentRetries":true}}}}
{"type":"emit_inbound","label":"agent.opened","frame":{"type":"agent.opened","agentId":"agent-e4dcb030-b82a-4526-9b30-3db02142c1bb"}}
{"type":"expect_outbound","label":"run.start:1","frame":{"type":"run.start","message":"Run this exact local command: `node -e \"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\"`. Do not answer until it completes, then respond exactly: interrupt fixture should not finish naturally.","options":{"model":{"id":"composer-2.5"},"mode":"agent"}}}
{"type":"emit_inbound","label":"run.started:1","frame":{"type":"run.started","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","agentId":"agent-e4dcb030-b82a-4526-9b30-3db02142c1bb"}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"thinking-delta","text":"Running the Node.js "}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"thinking-delta","text":"command now. Waiting"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"thinking-delta","text":" for it to complete "}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"thinking-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"thinking-delta","text":"before responding."}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"thinking-completed","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"thinking-completed","thinkingDurationMs":697}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"text-delta","text":"Running"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"text-delta","text":" the"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"text-delta","text":" command"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"text-delta","text":" and"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"text-delta","text":" waiting"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"text-delta","text":" for"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"text-delta","text":" it"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"text-delta","text":" to"}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"text-delta","text":" finish"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":2}}}
{"type":"emit_inbound","label":"text-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"text-delta","text":".\n"}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":3}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":22}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":4}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":9}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":5}}}
{"type":"emit_inbound","label":"token-delta","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"token-delta","tokens":1}}}
{"type":"emit_inbound","label":"tool-call-started","frame":{"type":"interaction.update","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","update":{"type":"tool-call-started","callId":"tool_6ecf0e02-3c15-448d-8994-2d041457475","toolCall":{"type":"shell","args":{"command":"node -e \"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\"","timeout":35000}},"modelCallId":"d7f78da1-7ccd-45fc-a021-a0f7c333bd1d-0-kteu"}}}
{"type":"expect_outbound","label":"run.cancel:1","frame":{"type":"run.cancel","runId":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2"}}
{"type":"emit_inbound","label":"run.completed:1","frame":{"type":"run.completed","result":{"id":"run-3735f72d-3c3a-40b3-ae4a-caed784e6ea2","requestId":"d7f78da1-7ccd-45fc-a021-a0f7c333bd1d","status":"cancelled","model":{"id":"composer-2.5"},"durationMs":4496}}}
{"type":"expect_outbound","label":"agent.close","frame":{"type":"agent.close","agentId":"agent-e4dcb030-b82a-4526-9b30-3db02142c1bb"}}
@@ -1,9 +1,9 @@
/**
* CursorDriver — `ProviderDriver` for the Cursor Agent (`cursor-agent`) runtime.
*
* Cursor exposes an ACP-based CLI. Model catalog and capability refreshes
* happen during the managed provider status check via Cursor's
* `list_available_models` extension method.
* Provider status and model discovery use the official Cursor SDK when an API
* key is configured. The ACP CLI remains the compatibility fallback for
* installations that authenticate through the local Cursor binary.
*
* Text generation is supported via the ACP runtime — `makeCursorTextGeneration`
* drives `runtime.prompt` with a structured-output schema and collects the
@@ -31,6 +31,7 @@ import {
checkCursorProviderStatus,
enrichCursorSnapshot,
} from "../Layers/CursorProvider.ts";
import { CursorSdkCatalogLive } from "../Layers/CursorSdkCatalog.ts";
import { ProviderEventLoggers } from "../Layers/ProviderEventLoggers.ts";
import { makeManagedServerProvider } from "../makeManagedServerProvider.ts";
import {
@@ -134,7 +135,7 @@ export const CursorDriver: ProviderDriver<CursorSettings, CursorDriverEnv> = {
const checkProvider = checkCursorProviderStatus(effectiveConfig, processEnv).pipe(
Effect.map(stampIdentity),
Effect.provideService(Crypto.Crypto, crypto),
Effect.provide(CursorSdkCatalogLive),
Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
Effect.provideService(FileSystem.FileSystem, fileSystem),
Effect.provideService(Path.Path, path),
@@ -3,17 +3,22 @@ import * as os from "node:os";
import { chmod, mkdtemp, readFile, writeFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
import type { SDKModel } from "@cursor/sdk";
import { describe, expect, it } from "@effect/vitest";
import * as NodeServices from "@effect/platform-node/NodeServices";
import { Effect } from "effect";
import { describe, expect, it } from "vitest";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
import * as Path from "effect/Path";
import type * as EffectAcpSchema from "effect-acp/schema";
import type { CursorSettings, ServerProviderModel } from "@t3tools/contracts";
import {
buildCursorProviderSnapshot,
buildCursorCapabilitiesFromConfigOptions,
buildCursorDiscoveredModelsFromConfigOptions,
discoverCursorModelCapabilitiesViaAcp,
buildCursorCapabilitiesFromSdkModel,
buildCursorDiscoveredModelsFromSdk,
checkCursorProviderStatus,
discoverCursorModelsViaAcp,
getCursorFallbackModels,
getCursorParameterizedModelPickerUnsupportedMessage,
@@ -23,6 +28,7 @@ import {
resolveCursorAcpBaseModelId,
resolveCursorAcpConfigUpdates,
} from "./CursorProvider.ts";
import { CursorSdkCatalogError, makeCursorSdkCatalogTestLayer } from "./CursorSdkCatalog.ts";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const mockAgentPath = path.join(__dirname, "../../../scripts/acp-mock-agent.ts");
@@ -239,13 +245,50 @@ const baseCursorSettings: CursorSettings = {
customModels: [],
};
const emptyCapabilities = {
reasoningEffortLevels: [],
supportsFastMode: false,
supportsThinkingToggle: false,
contextWindowOptions: [],
promptInjectedEffortLevels: [],
} as const;
const sdkParameterizedModel = {
id: "claude-opus-4-8",
displayName: "Opus 4.8",
parameters: [
{
id: "thinking",
displayName: "Thinking",
values: [{ value: "false" }, { value: "true" }],
},
{
id: "context",
displayName: "Context",
values: [
{ value: "300k", displayName: "300K" },
{ value: "1m", displayName: "1M" },
],
},
{
id: "effort",
displayName: "Effort",
values: [
{ value: "low", displayName: "Low" },
{ value: "high", displayName: "High" },
],
},
{
id: "fast",
displayName: "Fast",
values: [{ value: "false" }, { value: "true", displayName: "Fast" }],
},
],
variants: [
{
displayName: "Opus 4.8",
isDefault: true,
params: [
{ id: "thinking", value: "true" },
{ id: "context", value: "1m" },
{ id: "effort", value: "high" },
{ id: "fast", value: "false" },
],
},
],
} satisfies SDKModel;
describe("getCursorFallbackModels", () => {
it("does not publish any built-in cursor models before ACP discovery", () => {
@@ -361,22 +404,114 @@ describe("buildCursorCapabilitiesFromConfigOptions", () => {
});
});
describe("checkCursorProviderStatus", () => {
it("reports the install docs when the Cursor CLI command is missing", async () => {
const provider = await runNode(
checkCursorProviderStatus({
enabled: true,
binaryPath: missingCursorBinaryPath,
apiEndpoint: "",
customModels: [],
describe("Cursor SDK model discovery", () => {
it("maps native SDK parameter ids and default variant values to model capabilities", () => {
expect(buildCursorCapabilitiesFromSdkModel(sdkParameterizedModel)).toEqual(
createModelCapabilities({
optionDescriptors: [
selectDescriptor("effort", "Effort", [
{ id: "low", label: "Low" },
{ id: "high", label: "High", isDefault: true },
]),
selectDescriptor("contextWindow", "Context", [
{ id: "300k", label: "300K" },
{ id: "1m", label: "1M", isDefault: true },
]),
booleanDescriptor("fastMode", "Fast", false),
booleanDescriptor("thinking", "Thinking", true),
],
}),
);
});
it("filters invalid and duplicate SDK model entries", () => {
expect(
buildCursorDiscoveredModelsFromSdk([
sdkParameterizedModel,
{ ...sdkParameterizedModel, displayName: "Duplicate" },
{ id: "", displayName: "Invalid" },
]),
).toEqual([
{
slug: "claude-opus-4-8",
name: "Opus 4.8",
isCustom: false,
capabilities: buildCursorCapabilitiesFromSdkModel(sdkParameterizedModel),
},
]);
});
});
describe("checkCursorProviderStatus", () => {
it("uses the SDK catalog when CURSOR_API_KEY is configured", async () => {
const provider = await Effect.runPromise(
checkCursorProviderStatus(
{
...baseCursorSettings,
binaryPath: "cursor-cli-must-not-be-invoked",
customModels: ["internal/cursor-model"],
},
{ CURSOR_API_KEY: "test-cursor-key" },
).pipe(
Effect.provide(
Layer.mergeAll(
makeCursorSdkCatalogTestLayer((apiKey) => {
expect(apiKey).toBe("test-cursor-key");
return Effect.succeed({
user: {
apiKeyName: "test-key",
userEmail: "[email protected]",
createdAt: "2026-01-01T00:00:00.000Z",
},
models: [sdkParameterizedModel],
});
}),
NodeServices.layer,
),
),
),
);
expect(provider).toMatchObject({
status: "ready",
auth: {
status: "authenticated",
type: "api-key",
label: "Cursor API key (test-key)",
email: "[email protected]",
},
models: [
{ slug: "claude-opus-4-8", isCustom: false },
{ slug: "internal/cursor-model", isCustom: true },
],
});
});
it("surfaces SDK authentication failures without invoking the CLI", async () => {
const provider = await Effect.runPromise(
checkCursorProviderStatus(baseCursorSettings, {
CURSOR_API_KEY: "invalid-test-key",
}).pipe(
Effect.provide(
Layer.mergeAll(
makeCursorSdkCatalogTestLayer(() =>
Effect.fail(
new CursorSdkCatalogError({
authenticationFailure: true,
cause: new Error("unauthorized"),
}),
),
),
NodeServices.layer,
),
),
),
);
expect(provider).toMatchObject({
installed: false,
status: "error",
auth: { status: "unknown" },
message: cursorCliCommandMissingMessage,
auth: { status: "unauthenticated" },
message: "Cursor SDK authentication failed. Check CURSOR_API_KEY.",
});
});
@@ -393,8 +528,18 @@ describe("checkCursorProviderStatus", () => {
},
{
...process.env,
CURSOR_API_KEY: "",
T3_ACP_REQUEST_LOG_PATH: requestLogPath,
},
).pipe(
Effect.provide(
Layer.mergeAll(
makeCursorSdkCatalogTestLayer(() =>
Effect.die("SDK catalog must not be used without CURSOR_API_KEY"),
),
NodeServices.layer,
),
),
),
);
@@ -409,45 +554,40 @@ describe("checkCursorProviderStatus", () => {
});
describe("discoverCursorModelsViaAcp", () => {
it("keeps the ACP probe runtime alive long enough to discover models", async () => {
const wrapperPath = await makeMockAgentWrapper();
const models = await Effect.runPromise(
discoverCursorModelsViaAcp({
it.effect("keeps the ACP probe runtime alive long enough to discover models", () =>
Effect.gen(function* () {
const wrapperPath = yield* makeMockAgentWrapper();
const models = yield* discoverCursorModelsViaAcp({
enabled: true,
binaryPath: wrapperPath,
apiEndpoint: "",
customModels: [],
}).pipe(Effect.provide(NodeServices.layer), Effect.scoped),
);
});
expect(models.map((model) => model.slug)).toEqual([
"default",
"composer-2",
"gpt-5.4",
"claude-opus-4-6",
]);
});
expect(models.map((model) => model.slug)).toEqual([
"default",
"composer-2",
"gpt-5.4",
"claude-opus-4-6",
]);
}).pipe(Effect.provide(NodeServices.layer), Effect.scoped),
);
it("closes the ACP probe runtime after discovery completes", async () => {
const tempDir = await mkdtemp(path.join(os.tmpdir(), "cursor-provider-exit-log-"));
const exitLogPath = path.join(tempDir, "exit.log");
const wrapperPath = await makeMockAgentWrapper({
T3_ACP_EXIT_LOG_PATH: exitLogPath,
});
it.effect("closes the ACP probe runtime after discovery completes", () =>
Effect.gen(function* () {
const { exitLogPath, wrapperPath } = yield* makeExitLogFixture("cursor-provider-exit-log-");
await Effect.runPromise(
discoverCursorModelsViaAcp({
yield* discoverCursorModelsViaAcp({
enabled: true,
binaryPath: wrapperPath,
apiEndpoint: "",
customModels: [],
}).pipe(Effect.provide(NodeServices.layer)),
);
});
const exitLog = await waitForFileContent(exitLogPath);
expect(exitLog).toContain("SIGTERM");
});
const exitLog = yield* waitForFileContent(exitLogPath);
expect(exitLog).toContain("SIGTERM");
}).pipe(Effect.provide(NodeServices.layer)),
);
});
describe("discoverCursorModelCapabilitiesViaAcp", () => {
@@ -1,7 +1,9 @@
import * as NodeOS from "node:os";
import * as NodeOs from "node:os";
import type { SDKModel, SDKUser } from "@cursor/sdk";
import type {
CursorSettings,
ModelCapabilities,
ProviderOptionDescriptor,
ProviderOptionSelection,
ServerProvider,
ServerProviderAuth,
@@ -44,8 +46,10 @@ import {
enrichProviderSnapshotWithVersionAdvisory,
type ProviderMaintenanceCapabilities,
} from "../providerMaintenance.ts";
import * as AcpSessionRuntime from "../acp/AcpSessionRuntime.ts";
import { cursorSdkParameterPriority, cursorSdkProviderOptionId } from "../cursorSdkModel.ts";
import { AcpSessionRuntime } from "../acp/AcpSessionRuntime.ts";
import { CursorListAvailableModelsResponse } from "../acp/CursorAcpExtension.ts";
import { CursorSdkCatalog } from "./CursorSdkCatalog.ts";
const decodeCursorListAvailableModelsResponse = Schema.decodeUnknownEffect(
CursorListAvailableModelsResponse,
@@ -60,6 +64,7 @@ const EMPTY_CAPABILITIES: ModelCapabilities = createModelCapabilities({
});
const CURSOR_ACP_MODEL_DISCOVERY_TIMEOUT_MS = 15_000;
const CURSOR_SDK_CATALOG_TIMEOUT_MS = 15_000;
const CURSOR_PARAMETERIZED_MODEL_PICKER_MIN_VERSION_DATE = 2026_04_08;
const CURSOR_CLI_INSTALLATION_DOCS_URL = "https://cursor.com/docs/cli/installation";
const CURSOR_ACP_MODEL_DISCOVERY_FAILED_MESSAGE = [
@@ -378,6 +383,112 @@ function buildCursorDiscoveredModels(
});
}
function cursorSdkDefaultParameterValue(model: SDKModel, parameterId: string): string | undefined {
return model.variants
?.find((variant) => variant.isDefault)
?.params.find((parameter) => parameter.id === parameterId)?.value;
}
export function buildCursorCapabilitiesFromSdkModel(model: SDKModel): ModelCapabilities {
const seen = new Set<string>();
const optionDescriptors: Array<ProviderOptionDescriptor> = [];
const parameters = (model.parameters ?? [])
.map((parameter, index) => ({ parameter, index }))
.toSorted(
(left, right) =>
cursorSdkParameterPriority(left.parameter.id) -
cursorSdkParameterPriority(right.parameter.id) || left.index - right.index,
);
for (const { parameter } of parameters) {
const nativeId = parameter.id.trim();
const id = cursorSdkProviderOptionId(nativeId);
if (!nativeId || !id || seen.has(id)) {
continue;
}
seen.add(id);
const values = parameter.values.flatMap((entry) => {
const value = entry.value.trim();
if (!value) {
return [];
}
return [
{
value,
label: entry.displayName?.trim() || value,
},
];
});
if (values.length === 0) {
continue;
}
const label = parameter.displayName?.trim() || toTitleCaseWords(id);
const defaultValue = cursorSdkDefaultParameterValue(model, nativeId);
const normalizedValues = new Set(values.map((entry) => entry.value.toLowerCase()));
if (values.length === 2 && normalizedValues.has("true") && normalizedValues.has("false")) {
if (defaultValue === "true" || defaultValue === "false") {
optionDescriptors.push(
buildBooleanOptionDescriptor({
id,
label,
currentValue: defaultValue === "true",
}),
);
} else {
optionDescriptors.push(buildBooleanOptionDescriptor({ id, label }));
}
continue;
}
optionDescriptors.push(
buildSelectOptionDescriptor({
id,
label,
options: values.map((entry) => ({
...entry,
...(entry.value === defaultValue ? { isDefault: true } : {}),
})),
}),
);
}
return createModelCapabilities({ optionDescriptors });
}
export function buildCursorDiscoveredModelsFromSdk(
models: ReadonlyArray<SDKModel>,
): ReadonlyArray<ServerProviderModel> {
const seen = new Set<string>();
return models.flatMap((model) => {
const slug = model.id.trim();
const name = model.displayName.trim();
if (!slug || !name || seen.has(slug)) {
return [];
}
seen.add(slug);
return [
{
slug,
name,
isCustom: false,
capabilities: buildCursorCapabilitiesFromSdkModel(model),
} satisfies ServerProviderModel,
];
});
}
function cursorSdkAuth(user: SDKUser): ServerProviderAuth {
const email = user.userEmail?.trim();
const apiKeyName = user.apiKeyName.trim();
return {
status: "authenticated",
type: "api-key",
label: apiKeyName ? `Cursor API key (${apiKeyName})` : "Cursor API key",
...(email ? { email } : {}),
};
}
function buildCursorDiscoveredModelsFromAvailableModelsResponse(
response: typeof CursorListAvailableModelsResponse.Type,
): ReadonlyArray<ServerProviderModel> {
@@ -990,7 +1101,7 @@ export const checkCursorProviderStatus = Effect.fn("checkCursorProviderStatus")(
): Effect.fn.Return<
ServerProviderDraft,
never,
ChildProcessSpawner.ChildProcessSpawner | Crypto.Crypto | FileSystem.FileSystem | Path.Path
ChildProcessSpawner.ChildProcessSpawner | CursorSdkCatalog | FileSystem.FileSystem | Path.Path
> {
const checkedAt = DateTime.formatIso(yield* DateTime.now);
const fallbackModels = getCursorFallbackModels(cursorSettings);
@@ -1011,6 +1122,68 @@ export const checkCursorProviderStatus = Effect.fn("checkCursorProviderStatus")(
});
}
const sdkApiKey = environment?.CURSOR_API_KEY?.trim();
if (sdkApiKey) {
const sdkCatalog = yield* CursorSdkCatalog;
const catalogResult = yield* sdkCatalog
.read(sdkApiKey)
.pipe(Effect.timeoutOption(CURSOR_SDK_CATALOG_TIMEOUT_MS), Effect.result);
if (Result.isFailure(catalogResult)) {
yield* Effect.logWarning("Cursor SDK catalog probe failed", {
cause: catalogResult.failure.cause,
});
const authenticationFailure = catalogResult.failure.authenticationFailure;
return buildServerProvider({
presentation: CURSOR_PRESENTATION,
enabled: cursorSettings.enabled,
checkedAt,
models: fallbackModels,
probe: {
installed: true,
version: null,
status: "error",
auth: { status: authenticationFailure ? "unauthenticated" : "unknown" },
message: authenticationFailure
? "Cursor SDK authentication failed. Check CURSOR_API_KEY."
: "Cursor SDK catalog request failed. Check server logs for details.",
},
});
}
if (Option.isNone(catalogResult.success)) {
return buildServerProvider({
presentation: CURSOR_PRESENTATION,
enabled: cursorSettings.enabled,
checkedAt,
models: fallbackModels,
probe: {
installed: true,
version: null,
status: "error",
auth: { status: "unknown" },
message: `Cursor SDK catalog request timed out after ${CURSOR_SDK_CATALOG_TIMEOUT_MS}ms.`,
},
});
}
const snapshot = catalogResult.success.value;
const discoveredModels = buildCursorDiscoveredModelsFromSdk(snapshot.models);
return buildCursorProviderSnapshot({
checkedAt,
cursorSettings,
parsed: {
version: null,
status: "ready",
auth: cursorSdkAuth(snapshot.user),
},
discoveredModels,
...(discoveredModels.length === 0
? { discoveryWarning: "Cursor SDK model discovery returned no built-in models." }
: {}),
});
}
// Single `agent about` probe: returns version + auth status in one call.
const aboutProbe = yield* runCursorAboutCommand(cursorSettings, environment).pipe(
Effect.timeoutOption(ABOUT_TIMEOUT_MS),
@@ -1118,8 +1291,9 @@ export const checkCursorProviderStatus = Effect.fn("checkCursorProviderStatus")(
*
* Used by `CursorDriver` as the `makeManagedServerProvider.enrichSnapshot`
* hook: republishes update/version advisory metadata without performing any
* model or capability discovery. Cursor model data comes exclusively from
* `cursor/list_available_models` during provider status checks.
* model or capability discovery. Provider status checks source Cursor model
* data from the SDK when an API key is configured, with ACP discovery as the
* compatibility fallback.
*/
export const enrichCursorSnapshot = (input: {
readonly settings: CursorSettings;
@@ -0,0 +1,73 @@
import {
AuthenticationError,
Cursor,
CursorSdkError,
type SDKModel,
type SDKUser,
} from "@cursor/sdk";
import * as Context from "effect/Context";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Schema from "effect/Schema";
export interface CursorSdkCatalogSnapshot {
readonly user: SDKUser;
readonly models: ReadonlyArray<SDKModel>;
}
export class CursorSdkCatalogError extends Schema.TaggedErrorClass<CursorSdkCatalogError>()(
"CursorSdkCatalogError",
{
authenticationFailure: Schema.Boolean,
cause: Schema.Defect(),
},
) {
override get message(): string {
return this.authenticationFailure
? "Cursor SDK authentication failed."
: "Cursor SDK catalog request failed.";
}
}
export interface CursorSdkCatalogShape {
readonly read: (apiKey: string) => Effect.Effect<CursorSdkCatalogSnapshot, CursorSdkCatalogError>;
}
export class CursorSdkCatalog extends Context.Service<CursorSdkCatalog, CursorSdkCatalogShape>()(
"t3/provider/Layers/CursorSdkCatalog",
) {}
function isAuthenticationFailure(cause: unknown): boolean {
return (
cause instanceof AuthenticationError ||
(cause instanceof CursorSdkError && cause.status === 401)
);
}
const readCursorSdkCatalog = Effect.fn("CursorSdkCatalog.read")(function* (apiKey: string) {
return yield* Effect.tryPromise({
try: async () => {
const [user, models] = await Promise.all([
Cursor.me({ apiKey }),
Cursor.models.list({ apiKey }),
]);
return { user, models } satisfies CursorSdkCatalogSnapshot;
},
catch: (cause) =>
new CursorSdkCatalogError({
authenticationFailure: isAuthenticationFailure(cause),
cause,
}),
});
});
export const CursorSdkCatalogLive = Layer.succeed(
CursorSdkCatalog,
CursorSdkCatalog.of({ read: readCursorSdkCatalog }),
);
export function makeCursorSdkCatalogTestLayer(
read: CursorSdkCatalogShape["read"],
): Layer.Layer<CursorSdkCatalog> {
return Layer.succeed(CursorSdkCatalog, CursorSdkCatalog.of({ read }));
}
@@ -0,0 +1,33 @@
const CURSOR_SDK_PARAMETER_TO_PROVIDER_OPTION: Readonly<Record<string, string>> = {
context: "contextWindow",
fast: "fastMode",
};
const PROVIDER_OPTION_TO_CURSOR_SDK_PARAMETER: Readonly<Record<string, string>> = {
contextWindow: "context",
fastMode: "fast",
};
export function cursorSdkProviderOptionId(parameterId: string): string {
return CURSOR_SDK_PARAMETER_TO_PROVIDER_OPTION[parameterId] ?? parameterId;
}
export function cursorSdkParameterId(providerOptionId: string): string {
return PROVIDER_OPTION_TO_CURSOR_SDK_PARAMETER[providerOptionId] ?? providerOptionId;
}
export function cursorSdkParameterPriority(parameterId: string): number {
switch (parameterId) {
case "effort":
case "reasoning":
return 0;
case "context":
return 1;
case "fast":
return 2;
case "thinking":
return 3;
default:
return 4;
}
}
@@ -0,0 +1,22 @@
import { describe, expect, it } from "vite-plus/test";
import { removeAndRenumberTimelineItem } from "./orchestrationV2Timeline";
describe("removeAndRenumberTimelineItem", () => {
it("closes the position gap before a streamed item is reinserted", () => {
const remaining = removeAndRenumberTimelineItem(
[
{ position: 0, sourceItemId: "first" },
{ position: 1, sourceItemId: "streaming" },
{ position: 2, sourceItemId: "last" },
],
"streaming",
);
expect(remaining).toEqual([
{ position: 0, sourceItemId: "first" },
{ position: 1, sourceItemId: "last" },
]);
expect(new Set(remaining.map((row) => row.position)).size).toBe(remaining.length);
});
});
@@ -0,0 +1,8 @@
export function removeAndRenumberTimelineItem<
Id,
Row extends { readonly position: number; readonly sourceItemId: Id },
>(rows: ReadonlyArray<Row>, sourceItemId: Id): Array<Row> {
return rows
.filter((row) => row.sourceItemId !== sourceItemId)
.map((row, position) => ({ ...row, position }));
}
@@ -29,6 +29,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { ProviderModelPicker } from "../components/chat/ProviderModelPicker";
import { getPrimaryEnvironmentConnection } from "../environments/runtime";
import { useSettings } from "../hooks/useSettings";
import { removeAndRenumberTimelineItem } from "../lib/orchestrationV2Timeline";
import { newCommandId, newMessageId, newProjectId, newThreadId } from "../lib/utils";
import { type AppModelOption, getAppModelOptionsForInstance } from "../modelSelection";
import {
@@ -603,8 +604,9 @@ function applyStreamEventToProjection(
};
const withoutStaleItem = {
...nextProjection,
visibleTurnItems: activeVisibleTurnItems(nextProjection).filter(
(row) => row.sourceItemId !== event.payload.id,
visibleTurnItems: removeAndRenumberTimelineItem(
activeVisibleTurnItems(nextProjection),
event.payload.id,
),
};
return {