Skip to content

fix(ui): keep prompt attachments in sync#164

Merged
shantur merged 1 commit intodevfrom
codenomad/issue-159
Feb 13, 2026
Merged

fix(ui): keep prompt attachments in sync#164
shantur merged 1 commit intodevfrom
codenomad/issue-159

Conversation

@codenomadbot
Copy link
Contributor

@codenomadbot codenomadbot bot commented Feb 13, 2026

Fixes prompt-token/attachment desync for placeholder-backed attachments.

  • Chip “×” removal now goes through PromptInputApi.removeAttachment() so the exact [Image #N] / [pasted #N] token is removed from the prompt at the same time.
  • Placeholder cleanup is regex-based (tolerates whitespace/case) and avoids global whitespace-collapsing across the whole prompt.
  • Paste-time indexing now derives from the current prompt text (scan highest counter in prompt) so counters don’t drift.
  • Adds a small reconciliation effect: if a placeholder token is removed from the prompt by editing, the corresponding placeholder-backed attachment is removed from the bar/store.

Files:

  • packages/ui/src/components/prompt-input/usePromptAttachments.ts
  • packages/ui/src/components/prompt-input/attachmentPlaceholders.ts
  • packages/ui/src/components/prompt-input/types.ts
  • packages/ui/src/components/prompt-input.tsx
  • packages/ui/src/components/session/session-view.tsx

Notes:

  • Local npm run typecheck currently fails in this repo due to pre-existing packages/ui/src/stores/preferences.tsx errors (unrelated to this change).

--
Yours, CodeNomadBot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments