1. Simple Adapter Smoke Test

Purpose: Verify token optimization, compact JSON serialization, adapter prompt rendering, DeepSeek fetch wrapper, recency utilities, and STYLE_RULES deduplication.

Prerequisites: None (pure unit tests, no API keys or DB needed)

Cost / Duration: $0 | ~5-10 seconds

Prompt

Run the token optimization smoke tests and DeepSeek fetch wrapper tests:

```bash
bun test packages/ai/src/__tests__/token-optimization-smoke.test.ts
bun test packages/ai/src/__tests__/deepseek-fetch-wrapper.test.ts
```

The token optimization suite validates:
- Compact JSON serialization produces valid output without whitespace
- Gemini adapter prompts render correctly (template interpolation works)
- Shared checklist appears in all fact-oriented task suffixes
- recency-utils functions behave correctly
- STYLE_RULES dedup reconstruction fidelity (round-trip integrity)
- Deduped format achieves ≥40% size reduction
- Prompt stable prefix is consistent across variable inputs
- Deduped prompt contains all refinement text and style_data

The DeepSeek fetch wrapper suite validates:
- `json_schema` → `json_object` response_format downgrade
- Schema guidance injection into system prompt (after existing content)
- `buildSchemaGuidance()` produces human-readable imperative descriptions
- Nested objects, arrays, enums, and nullable fields handled correctly

All tests must pass with zero failures.

Verification

  • All token optimization tests pass (exit code 0)
  • All DeepSeek fetch wrapper tests pass (exit code 0)
  • No skipped or pending tests
  • Compact JSON assertions confirm no \n or in output
  • STYLE_RULES dedup achieves ≥40% size reduction
  • Reconstruction fidelity: deduped content round-trips to original

Back to index