Skip to content

feat(client): add variable autocompletion to JSON body#3

Merged
moosebay merged 2 commits into
mainfrom
feature/json-body-var-completion
May 6, 2025
Merged

feat(client): add variable autocompletion to JSON body#3
moosebay merged 2 commits into
mainfrom
feature/json-body-var-completion

Conversation

@moosebay
Copy link
Copy Markdown
Contributor

@moosebay moosebay commented May 3, 2025

  • Add reference variable support to JSON body editor
  • Combine CodeMirror JSON syntax highlighting with variable autocompletion
  • Maintain same JSON formatting while enabling {{variable}} suggestions
  • Enable consistent variable usage between request headers and body

By submitting a PR to this repository, you agree to the terms within the Contributor Covenant Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.

Description

Describe the purpose of this PR along with any background information and the impacts of the proposed change. For the benefit of the community, please do not assume prior context.

Provide details that support your chosen implementation, including: breaking changes, alternatives considered, changes to the API, etc.

If the UI is being changed, please provide screenshots.

References

Include any links supporting this change such as a:

  • GitHub Issue/PR number addressed or fixed
  • StackOverflow post
  • Related pull requests/issues from other repos

If there are no references, simply delete this section.

Testing

Describe how this can be tested by reviewers. Be specific about anything not tested and reasons why.

Please include any manual steps for testing end-to-end or functionality not covered by unit/integration tests.

Also include details of the environment this PR was developed in (platform/browser version).

Checklist

  • I have added a Version Plan for new/changed functionality in this PR
  • All checks for formatting and tests are passing

- Add reference variable support to JSON body editor
- Combine CodeMirror JSON syntax highlighting with variable autocompletion
- Maintain same JSON formatting while enabling {{variable}} suggestions
- Enable consistent variable usage between request headers and body
@moosebay moosebay requested a review from Tomaszal May 3, 2025 10:05
Added support for variable autocompletion inside JSON strings by:
1. Enhanced token detection to handle JSON string context
2. Added completion triggers specifically for JSON strings
3. Removed constraint that limited completions to Reference tokens only
4. Added null check to prevent TypeError when syntax tree is unavailable
@moosebay moosebay merged commit 0e56f0e into main May 6, 2025
1 of 2 checks passed
Tomaszal added a commit that referenced this pull request May 6, 2025
Unsafe and likely incorrect code was generated by Claude AI, but it works so it is used a stopgap
@Tomaszal Tomaszal deleted the feature/json-body-var-completion branch May 6, 2025 14:33
@Tomaszal
Copy link
Copy Markdown
Contributor

Tomaszal commented May 6, 2025

Claude AI is not very good with more complex libraries like CodeMirror. There were a lot of type errors, as it hallucinated non-existing APIs, so I'm surprised it works at all. We'll definitely need to improve this implementation once there's time

ElecTwix pushed a commit that referenced this pull request Jul 30, 2025
…tion

feat(client): add variable autocompletion to JSON body
ElecTwix pushed a commit that referenced this pull request Jul 30, 2025
Unsafe and likely incorrect code was generated by Claude AI, but it works so it is used a stopgap
ElecTwix added a commit that referenced this pull request Jan 26, 2026
Implement POC #4 and #5 for improved AI tool discovery:

- Add AIParam struct with typed parameters (name, description, type)
- Add SourceHint field for auto-chaining between tools
- Create {{ ai('name', 'desc', 'type', 'source') }} syntax parser
- Add AIParamProvider interface for nodes to declare parameters
- Add DescribableNode interface for custom tool descriptions
- Add discover_tools function for on-demand tool discovery (POC #3)
- Create AI expression functions (ai, aivar, airef, aidesc, aichain)
- Add comprehensive integration tests comparing 5 POC approaches

Test results show POC #4+#5 combination is most effective:
- Typed params give AI clear input requirements
- SourceHint tells AI exactly where to get chained values
- Reduces tool calls and improves success rate
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.

2 participants