Skip to content

feat(dialects): Phase 1 A6 inband dialect layer#467

Open
quangdang46 wants to merge 8 commits into
masterfrom
feat/A6-inband-dialects
Open

feat(dialects): Phase 1 A6 inband dialect layer#467
quangdang46 wants to merge 8 commits into
masterfrom
feat/A6-inband-dialects

Conversation

@quangdang46

Copy link
Copy Markdown
Owner

Summary

Implements Phase 1 of A6: the inband (streaming) tool-call dialect layer for non-JSON LLM providers.

Changes

Core types (new crates/jcode-llm-dialects/src/types.rs):

  • InbandScanEvent enum (7 variants: Text, ThinkingStart, ThinkingDelta, ThinkingEnd, ToolStart, ToolArgDelta, ToolEnd)
  • InbandScanner trait (feed, flush)
  • Dialect enum (12 variants)
  • InbandScannerOptions struct
  • Prompt constants for all 12 dialects

3 dialects fully implemented:

  • HermesInbandScanner (hermes.rs) — JSON-in-<tool_call> tags, optional <think> blocks. 4 tests.
  • KimiInbandScanner (kimi.rs) — Token-delimited <|tool_calls_section_begin|> markers, 5-state machine. 3 tests.
  • GeminiInbandScanner (gemini.rs) — Python ````tool_code``` fence parser with keyword-arg deserialization. 5 tests (inc. Python value parsing).

Factory (lib.rs): create_inband_scanner() dispatcher + dialect_prompt() for prompt fragments.

9 remaining dialects (Anthropic, DeepSeek, Gemma, GLM, Harmony, MiniMax, Qwen3, Xml) currently fall back to Hermes scanner — ready for transition to full implementations in Phase 2.

Verification

  • cargo test -p jcode-llm-dialects12/12 pass
  • cargo check — clean (warnings: unused gen_id in kimi.rs, expected until Phase 2)

Refs: docs/pr-plans/A6-inband-dialects.md

Add consolidated PR backlog from 13 reference repos (A-J, ~80 features)
and supporting docs (MASTER_GOAL_PROMPT, GOAL_DRIVEN_PROMPT, CONSOLIDATED_FINDINGS).
Adds core InbandScanner trait, event types, and 3 fully-implemented
dialects (Hermes JSON-tag, Kimi token-delimited, Gemini Python-fence)
with 12 passing tests. 9 remaining dialects fall back to Hermes scanner.

Refs: docs/pr-plans/A6-inband-dialects.md
Adds model-family-aware prompt resolution so the system prompt is tuned
to the active model's instruction-following profile.

- PromptVariant enum with Claude/Gpt/Gemini/Default variants
- resolve_prompt_variant(model_id) prefix-based resolution
- system_prompt_for_model(model_id) convenience function
- Per-model markdown files: system_prompt_claude.md, system_prompt_gpt.md,
  system_prompt_gemini.md
- Wired into prompting.rs via model_id parameter
- Wired into both build_system_prompt_full and build_system_prompt_split

Refs: docs/pr-plans/C3-prompt-variants.md
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