Skip to content

feat(agent-interface): accept write-in answers on select fields via allowCustom#20

Merged
vutuanlinh2k2 merged 1 commit into
mainfrom
feat/interaction-allow-custom
Jul 2, 2026
Merged

feat(agent-interface): accept write-in answers on select fields via allowCustom#20
vutuanlinh2k2 merged 1 commit into
mainfrom
feat/interaction-allow-custom

Conversation

@vutuanlinh2k2

Copy link
Copy Markdown
Contributor

Problem

A select question with an "Other…" option cannot accept the user's custom text: validateInteractionAnswer rejects any select value outside the declared options, so consumers that substitute the user's typed text as the answer value get a hard validation failure (surfaced as 400 INVALID_INTERACTION_ANSWER in agent-dev-container's sidecar).

Solution

  • Select interaction fields gain an optional allowCustom flag.
  • validateInteractionAnswer skips the option-membership check for fields with allowCustom: true, but stays fail-closed on shape: write-ins must be non-blank strings, and the existing multi/required rules still apply.
  • questionAnswerSpec propagates allowCustom from LegacyQuestion.allowCustom, so adapters whose native question tool supports custom answers can declare it.

Additive/optional — no behavior change for existing specs. Changeset: minor bump of @tangle-network/agent-interface.

Tests

New src/interaction.test.ts: schema round-trip, write-in accept/reject matrix (declared options, write-in with/without flag, blank write-in, multi + required rules), questionAnswerSpec propagation. Full workspace green: pnpm build && pnpm check-types && pnpm test (458 tests).

Context

Prerequisite for tangle-network/agent-dev-container#3048 (adapter stream-fidelity conformance suite; the "no write-in answers" finding). agent-dev-container will bump its pinned ^0.13.0 once this publishes.

…llowCustom

A select question with an "Other…" option could not accept the user's own
text: validateInteractionAnswer rejected any value outside the declared
options, so downstream UIs substituting typed text got a hard failure.

- select fields gain an optional allowCustom flag
- validateInteractionAnswer skips the option-membership check for such
  fields but stays fail-closed on shape: write-ins must be non-blank
  strings, and multi/required rules still apply
- questionAnswerSpec propagates allowCustom from LegacyQuestion
@vutuanlinh2k2 vutuanlinh2k2 merged commit 022f0c2 into main Jul 2, 2026
1 check passed
@vutuanlinh2k2 vutuanlinh2k2 deleted the feat/interaction-allow-custom branch July 2, 2026 08:09
vutuanlinh2k2 added a commit that referenced this pull request Jul 2, 2026
vutuanlinh2k2 added a commit that referenced this pull request Jul 2, 2026
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