Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/programs/error-tracking-upload-source-maps/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ STEP 1 — Get a personal API key from the user. (skill: "Get a personal API key
STEP 5:
{
id: "api-key",
prompt: "Paste your PostHog personal API key below. Don't have one yet? Create one here:\\n\\n${apiKeyUrl}",
prompt: "Uploading source maps needs a PostHog personal API key. Source maps let PostHog show your original code in error stack traces, not minified code.\\n\\nCreate a key with the right permissions here:\\n${apiKeyUrl}\\n\\nThen paste it below.",
kind: "text",
sensitive: true
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
PostHog Wizard v0.0.0-test Feedback: wizard@posthog.com

Cost (running): $0.00 · no agent turns yet Ctrl+T to hide








╭──────────────────────────────────────────────────────────────────────╮
│ │
│ ◆ error-tracking │
│ │
│ Uploading source maps needs a PostHog personal API key. Source │
│ maps let PostHog show your original code in error stack traces, │
│ not minified code. │
│ │
│ Create a key with the right permissions here: │
│ https://us.posthog.com/source-maps-key │
│ │
│ Then paste it below. │
│ │
│ Type your answer │
│ │
│ Hidden as you type. The AI agent never sees it. ENTER submit │
│ │
│ ESC skip │
│ │
╰──────────────────────────────────────────────────────────────────────╯
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
PostHog Wizard v0.0.0-test Feedback: wizard@posthog.com

Cost (running): $0.00 · no agent turns yet Ctrl+T to hide


╭──────────────────────────────────────────────────────────────────────╮
│ │
│ ◆ error-tracking │
│ │
│ Uploading source maps needs a PostHog personal API key. Source │
│ maps let PostHog show your original code in error stack traces, │
│ not minified code. │
│ │
│ Create a key with the right permissions here: │
│ https://us.posthog.com/source-maps-key │
│ │
│ Then paste it below. │
│ │
│ Type your answer │
│ │
│ Hidden as you type. The AI agent never sees it. ENTER submit │
│ │
│ ESC skip │
│ │
╰──────────────────────────────────────────────────────────────────────╯
29 changes: 29 additions & 0 deletions src/tui/__tests__/frames.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,35 @@ describe('feature-flags-intro with an unsupported framework version', () => {
});
});

describe('wizard-ask with a sensitive text question', () => {
it.each(SIZES)(`at $columns x $rows`, async (size) => {
const store = makeStore(Program.PostHogIntegration);
void store.requestQuestion({
id: 'q1',
source: 'error-tracking',
questions: [
{
id: 'api-key',
prompt:
'Uploading source maps needs a PostHog personal API key. Source maps let PostHog show your original code in error stack traces, not minified code.\n\nCreate a key with the right permissions here:\nhttps://us.posthog.com/source-maps-key\n\nThen paste it below.',
kind: 'text',
sensitive: true,
},
],
});
expect(store.currentScreen).toBe(Overlay.WizardAsk);
const { frame } = await renderScreen(
store,
screenShell(store, makeServices(store)),
size,
);
expect(frame).toContain('The AI agent never sees it.');
await expect(frame).toMatchFileSnapshot(
`__snapshots__/frames/wizard-ask-sensitive-${size.columns}x${size.rows}.txt`,
);
});
});

function snapshotPath(screen: ScreenName, size: TerminalSize): string {
return `__snapshots__/frames/${screen}-${size.columns}x${size.rows}.txt`;
}
15 changes: 13 additions & 2 deletions src/tui/screens/WizardAskScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ const QuestionInput = ({ question, onSubmit }: QuestionInputProps) => {
}

case 'text': {
const Input = shouldMaskAnswer(question) ? PasswordInput : TextInput;
const masked = shouldMaskAnswer(question);
const Input = masked ? PasswordInput : TextInput;
return (
// `width="100%"` on both the column and the hint row anchors them to
// the modal's content width — without it, Ink/Yoga shrinks the column
Expand All @@ -372,7 +373,17 @@ const QuestionInput = ({ question, onSubmit }: QuestionInputProps) => {
placeholder="Type your answer"
onSubmit={(value) => onSubmit(value)}
/>
<Box marginTop={1} width="100%" justifyContent="flex-end">
<Box
marginTop={1}
width="100%"
justifyContent={masked ? 'space-between' : 'flex-end'}
>
{/* A sensitive answer is vaulted; the agent only gets a secretRef. */}
{masked && (
<Text dimColor>
Hidden as you type. The AI agent never sees it.
</Text>
)}
<Text>
<Text color={Colors.accent}>ENTER</Text>
<Text dimColor> submit</Text>
Expand Down
Loading