feat: expose cwd in listener state snapshots (#1315)
This commit is contained in:
@@ -247,6 +247,14 @@ describe("listen-client state_response control protocol", () => {
|
||||
const snapshot = __listenClientTestUtils.buildStateResponse(runtime, 1);
|
||||
expect(snapshot.control_response_capable).toBe(true);
|
||||
});
|
||||
|
||||
test("includes the effective working directory", () => {
|
||||
const runtime = __listenClientTestUtils.createRuntime();
|
||||
const snapshot = __listenClientTestUtils.buildStateResponse(runtime, 1);
|
||||
|
||||
expect(typeof snapshot.cwd).toBe("string");
|
||||
expect(snapshot.cwd.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("listen-client state_response pending interrupt snapshot", () => {
|
||||
|
||||
@@ -187,6 +187,7 @@ interface StateResponseMessage {
|
||||
snapshot_id: string;
|
||||
generated_at: string;
|
||||
state_seq: number;
|
||||
cwd: string;
|
||||
mode: "default" | "acceptEdits" | "plan" | "bypassPermissions";
|
||||
is_processing: boolean;
|
||||
last_stop_reason: string | null;
|
||||
@@ -723,6 +724,7 @@ function buildStateResponse(
|
||||
generated_at: new Date().toISOString(),
|
||||
state_seq: stateSeq,
|
||||
event_seq: stateSeq,
|
||||
cwd: process.env.USER_CWD || process.cwd(),
|
||||
mode: permissionMode.getMode(),
|
||||
is_processing: runtime.isProcessing,
|
||||
last_stop_reason: runtime.lastStopReason,
|
||||
|
||||
Reference in New Issue
Block a user