{"version":3,"file":"print-mode-steer.test.d.ts","sourceRoot":"","sources":["../../src/modes/print-mode-steer.test.ts"],"names":[],"mappings":"","sourcesContent":["import { describe, expect, it, vi } from \"vitest\";\nimport type { UltraplanArtifact, UltraplanRunResult } from \"../core/ultraplan.js\";\nimport { getPrintModeLocalCommandOutput } from \"./print-mode.js\";\n\nfunction makeUltraplanArtifact(): UltraplanArtifact {\n\treturn {\n\t\tversion: 1,\n\t\tplannerMode: \"local_subagent\",\n\t\tplannerAgent: \"planner\",\n\t\texecutionState: \"plan_only\",\n\t\tobjective: \"unused\",\n\t\tassumptions: [],\n\t\tconstraints: [],\n\t\tphases: [],\n\t\trisks: [],\n\t\trecommendedExecutionOrder: [],\n\t\tactionableNextSteps: [],\n\t\tcreatedAt: \"2026-04-03T00:00:00.000Z\",\n\t};\n}\n\nfunction makeUltraplanRunResult(): UltraplanRunResult {\n\treturn {\n\t\tartifact: makeUltraplanArtifact(),\n\t\tdisplayText: \"unused\",\n\t\trawPlannerOutput: \"\",\n\t};\n}\n\nfunction makeSession() {\n\tconst steeringMessages: string[] = [];\n\tconst continueCurrentWork = vi.fn<() => Promise<void>>().mockResolvedValue(undefined);\n\n\treturn {\n\t\tget briefOnly() {\n\t\t\treturn false;\n\t\t},\n\t\tsetBriefOnly: () => {},\n\t\tqueueByTheWay: () => {},\n\t\tgetPendingByTheWayNotes: () => [],\n\t\tisStreaming: false,\n\t\tstate: { messages: [{ role: \"assistant\" }] },\n\t\tsteer: async (message: string) => {\n\t\t\tsteeringMessages.push(message);\n\t\t},\n\t\tgetSteeringMessages: () => steeringMessages,\n\t\tagent: {\n\t\t\tcontinue: continueCurrentWork,\n\t\t},\n\t\tgetMemoryHistory: () => [],\n\t\tresolveMemorySnapshotSelector: () => ({\n\t\t\tsnapshot: undefined,\n\t\t\tmatchedInput: \"\",\n\t\t\tresolvedId: undefined,\n\t\t\terror: \"empty\" as const,\n\t\t\tcandidates: [],\n\t\t}),\n\t\tgetLatestUltraplanPlan: () => undefined,\n\t\trunUltraplan: async () => makeUltraplanRunResult(),\n\t\trunUltraplanRevise: async () => makeUltraplanRunResult(),\n\t\tapplyUltraplan: () => ({ applied: [], displayText: \"unused\" }),\n\t\tcontinueCurrentWork,\n\t\tsteeringMessages,\n\t};\n}\n\ndescribe(\"getPrintModeLocalCommandOutput /steer\", () => {\n\tit(\"routes /steer through print mode and resumes the active workstream\", async () => {\n\t\tconst session = makeSession();\n\n\t\tconst output = await getPrintModeLocalCommandOutput(session, \"/steer keep the fix narrow\");\n\n\t\texpect(output).toContain(\n\t\t\t\"Submitted steering for the active workstream and resumed from the latest assistant turn.\",\n\t\t);\n\t\texpect(session.steeringMessages).toEqual([\"keep the fix narrow\"]);\n\t\texpect(session.continueCurrentWork).toHaveBeenCalledTimes(1);\n\t});\n\n\tit(\"returns usage for invalid /steer commands in print mode\", async () => {\n\t\texpect(await getPrintModeLocalCommandOutput(makeSession(), \"/steer\")).toBe(\"Usage: /steer <message>\");\n\t\texpect(await getPrintModeLocalCommandOutput(makeSession(), \"/steer    \")).toBe(\"Usage: /steer <message>\");\n\t});\n});\n"]}