{"version":3,"file":"interactive-mode-brief-only.test.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-mode-brief-only.test.ts"],"names":[],"mappings":"","sourcesContent":["import type { AssistantMessage } from \"@apholdings/jensen-ai\";\nimport { Container } from \"@apholdings/jensen-tui\";\nimport { beforeAll, describe, expect, it, vi } from \"vitest\";\nimport type { SessionContext } from \"../../core/session-manager.js\";\nimport { ToolExecutionComponent } from \"./components/tool-execution.js\";\nimport { InteractiveMode } from \"./interactive-mode.js\";\nimport { getMarkdownTheme, initTheme } from \"./theme/theme.js\";\n\nbeforeAll(() => {\n\tinitTheme(\"dark\");\n});\n\ndescribe(\"InteractiveMode brief-only honesty\", () => {\n\tit(\"toggles brief-only mode through the /brief command surface\", () => {\n\t\tconst mode = Object.assign(Object.create(InteractiveMode.prototype), {\n\t\t\tchatContainer: new Container(),\n\t\t\tshowWarning: vi.fn(),\n\t\t\tui: { requestRender: vi.fn() },\n\t\t\tsession: {\n\t\t\t\tbriefOnly: false,\n\t\t\t\tsetBriefOnly(enabled: boolean) {\n\t\t\t\t\tthis.briefOnly = enabled;\n\t\t\t\t},\n\t\t\t},\n\t\t}) as unknown as {\n\t\t\thandleBriefCommand: (text: string) => void;\n\t\t\tchatContainer: Container;\n\t\t\tsession: { briefOnly: boolean };\n\t\t};\n\n\t\tmode.handleBriefCommand(\"/brief status\");\n\t\texpect(mode.chatContainer.children.at(-1)).toMatchObject({\n\t\t\ttext: expect.stringContaining(\"Brief-only mode is disabled for this session only (runtime-only).\"),\n\t\t});\n\t\tmode.handleBriefCommand(\"/brief on\");\n\t\texpect(mode.session.briefOnly).toBe(true);\n\t\texpect(mode.chatContainer.children.at(-1)).toMatchObject({\n\t\t\ttext: expect.stringContaining(\"Enabled brief-only mode for this session only (runtime-only).\"),\n\t\t});\n\t\tmode.handleBriefCommand(\"/brief off\");\n\t\texpect(mode.session.briefOnly).toBe(false);\n\t\texpect(mode.chatContainer.children.at(-1)).toMatchObject({\n\t\t\ttext: expect.stringContaining(\"Disabled brief-only mode for this session only (runtime-only).\"),\n\t\t});\n\t});\n\n\tit(\"queues /btw guidance through the interactive command surface\", () => {\n\t\tconst mode = Object.assign(Object.create(InteractiveMode.prototype), {\n\t\t\tchatContainer: new Container(),\n\t\t\tshowWarning: vi.fn(),\n\t\t\tui: { requestRender: vi.fn() },\n\t\t\tsession: {\n\t\t\t\tpendingBtwNotes: [] as string[],\n\t\t\t\tqueueByTheWay(note: string) {\n\t\t\t\t\tthis.pendingBtwNotes.push(note);\n\t\t\t\t},\n\t\t\t\tgetPendingByTheWayNotes() {\n\t\t\t\t\treturn this.pendingBtwNotes;\n\t\t\t\t},\n\t\t\t},\n\t\t}) as unknown as {\n\t\t\thandleBtwCommand: (text: string) => void;\n\t\t\tchatContainer: Container;\n\t\t\tsession: { pendingBtwNotes: string[] };\n\t\t};\n\n\t\tmode.handleBtwCommand(\"/btw keep the next step narrow\");\n\t\texpect(mode.session.pendingBtwNotes).toEqual([\"keep the next step narrow\"]);\n\t\texpect(mode.chatContainer.children.at(-1)).toMatchObject({\n\t\t\ttext: expect.stringContaining(\"Queued by-the-way guidance for the next turn only (runtime-only).\"),\n\t\t});\n\n\t\tmode.handleBtwCommand(\"/btw mention the pending blocker\");\n\t\texpect(mode.session.pendingBtwNotes).toEqual([\"keep the next step narrow\", \"mention the pending blocker\"]);\n\t\texpect(mode.chatContainer.children.at(-1)).toMatchObject({\n\t\t\ttext: expect.stringContaining(\"Pending BTW notes: 2.\"),\n\t\t});\n\t});\n\n\tit(\"keeps tool activity visible when assistant prose is suppressed\", () => {\n\t\tconst mode = Object.assign(Object.create(InteractiveMode.prototype), {\n\t\t\tpendingTools: new Map(),\n\t\t\tchatContainer: new Container(),\n\t\t\tfooter: { invalidate: vi.fn() },\n\t\t\tupdatePromptChrome: vi.fn(),\n\t\t\tui: { requestRender: vi.fn() },\n\t\t\tgetRegisteredToolDefinition: () => undefined,\n\t\t\ttoolOutputExpanded: false,\n\t\t\tsession: {\n\t\t\t\tbriefOnly: true,\n\t\t\t\tretryAttempt: 0,\n\t\t\t\tsettingsManager: { getShowImages: () => false },\n\t\t\t\textensionRunner: undefined,\n\t\t\t},\n\t\t\thideThinkingBlock: false,\n\t\t\tgetMarkdownThemeWithSettings: () => getMarkdownTheme(),\n\t\t}) as unknown as {\n\t\t\trenderSessionContext: (\n\t\t\t\tcontext: SessionContext,\n\t\t\t\toptions?: { updateFooter?: boolean; populateHistory?: boolean },\n\t\t\t) => void;\n\t\t\tchatContainer: Container;\n\t\t};\n\n\t\tconst assistantMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tprovider: \"test-provider\",\n\t\t\tmodel: \"test-model\",\n\t\t\tstopReason: \"end_turn\",\n\t\t\terrorMessage: undefined,\n\t\t\tcontent: [\n\t\t\t\t{ type: \"text\", text: \"suppressed prose\" },\n\t\t\t\t{ type: \"toolCall\", id: \"call_1\", name: \"bash\", arguments: '{\"command\":\"pwd\"}' },\n\t\t\t],\n\t\t\tusage: {\n\t\t\t\tinput: 0,\n\t\t\t\toutput: 0,\n\t\t\t\tcacheRead: 0,\n\t\t\t\tcacheWrite: 0,\n\t\t\t\tcost: { total: 0 },\n\t\t\t},\n\t\t\ttimestamp: Date.now(),\n\t\t} as unknown as AssistantMessage;\n\n\t\tmode.renderSessionContext({\n\t\t\tmessages: [assistantMessage],\n\t\t\tthinkingLevel: \"off\",\n\t\t\tmodel: null,\n\t\t\tmemoryItems: [],\n\t\t\ttodos: [],\n\t\t});\n\n\t\texpect(mode.chatContainer.children.some((child) => child instanceof ToolExecutionComponent)).toBe(true);\n\t});\n});\n"]}