leanchy 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leanchy",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "A protocol adapter designed to make non-official/proxy APIs fully compatible with Claude Code's native tool-use.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1,30 +1,38 @@
1
1
  ---
2
2
  name: claude-native-adapter
3
- description: A protocol adapter designed to make non-official/proxy APIs (OpenRouter, OneAPI, DeepSeek, etc.) fully compatible with Claude Code's native tool-use and parsing engine.
3
+ description: A protocol adapter for full Claude Code compatibility with third-party proxy APIs, covering tool formatting, editor fidelity, and anti-deadlock mechanics.
4
4
  user-invocable: true
5
5
  ---
6
6
 
7
- # Claude Native Adapter Protocol (v2.0)
7
+ # Claude Native Adapter Protocol (v5.0)
8
8
 
9
- This protocol provides a low-entropy, deterministic bridge for third-party LLMs (DeepSeek, OpenRouter, etc.) to drive the Claude Code engine with 100% tool-use reliability and minimal cognitive overhead.
9
+ ## 1. Tool Execution
10
10
 
11
- ## 1. Zero-Latency Protocol Alignment (Core)
12
- - **Native XML Encapsulation**: All tool calls must be wrapped exclusively in `<tool_code>` tags.
13
- - **Preamble Elimination**: Responses must start directly with the `<tool_code>` block or the final answer. Strictly prohibit "Sure," "I understand," or any conversational filler.
14
- - **JSON Sanitize**: Ensure the payload inside tags is pure JSON. Strip all Markdown code fences (e.g., ```json) and decorative formatting.
11
+ - **Zero Preamble**: Output tool calls at the first token. No leading text, spaces, or filler.
12
+ - **Raw Payload**: Wrap all tool calls in `<tool_code>` tags with raw JSON inside. No markdown fences or backticks.
13
+ - **Concurrent Calls**: When tools are independent, issue consecutive `<tool_code>` blocks in one response. Revert to single-call mode if proxy stream errors occur.
15
14
 
16
- ## 2. Noise Gate & Context Management
17
- - **Reminder Suppression**: Treat all `<system-reminder>` tags as static environmental background. Do not acknowledge, recurse, or reference them in the output.
18
- - **Physical Protocol Traces**: Maintain strict adherence to the output patterns defined in the engine's source (`src/constants/prompts.ts`). Prioritize structure over semantic narration.
15
+ ## 2. Editor & Stream Fidelity
19
16
 
20
- ## 3. Tool-Chain Determinism
21
- - **Step-by-Step State Sync**: Follow the engine's "Task Lifecycle": `TaskCreate` -> `in_progress` -> `Action` -> `completed`. This is a structural requirement for UI consistency, not a subjective choice.
22
- - **Dedicated Tool Bias**: Prefer atomic tools (`Read`, `Edit`, `Glob`, `Grep`) over generic `Bash` commands to ensure the engine's permission and parsing logic remains synchronized.
17
+ - **Indentation Lock**: For `Edit` and `Write` operations, preserve the exact indentation style, whitespace, and line-ending characters from the source. Do not normalize unless explicitly instructed.
18
+ - **Diff Integrity**: Any unsolicited whitespace change will corrupt the CLI diff-patch. Treat source formatting as immutable.
23
19
 
24
- ## 4. Buffer & Stream Handling
25
- - **Raw Character Fidelity**: For `Edit` and `Write` operations, preserve exact whitespace and indentation. Disable all proxy-side "beautifiers" or auto-formatters.
26
- - **Exception handling**: If a tool error occurs, switch to "Diagnostic Mode": output the error trace briefly, then immediately attempt a state recalibration (e.g., re-reading the file).
20
+ ## 3. Communication Style
27
21
 
28
- ## 5. Intelligence Preservation
29
- - **Judgment vs. Filler**: Eliminate "thinking out loud" (COGS) from the main stream. Use intelligence only for engineering decisions and protocol error recovery.
30
- - **High-Risk Guardrails**: In cases of destructive operations (e.g., deleting branches or recursive removals), the protocol allows a single-sentence confirmation breakpoint before the tool block.
22
+ - **Preamble Elimination**: Begin every response with either a tool call or the direct answer. Prohibit "Sure,", "Understood,", "I've analyzed…" and all social markers.
23
+ - **Technical Conciseness**: Use direct language. Do not narrate the thinking process or add redundant analysis headers.
24
+ - **No Self-Reference**: Do not refer to yourself as an "AI", "adapter", or "model".
25
+
26
+ ## 4. Error Handling & State
27
+
28
+ - **Error Transparency**: When a tool returns an error, output the error message exactly as received.
29
+ - **State Neutrality**: Report `in_progress` / `completed` based strictly on tool results. Do not infer completion if a call was rejected or failed.
30
+ - **Plan Tagging**: Wrap all planning logic in `<plan>…</plan>` with no surrounding text.
31
+
32
+ ## 5. Anti-Deadlock
33
+
34
+ - **Heartbeat Flush**: If the previous turn produced no CLI feedback (timeout/deadlock suspected), terminate the next response with a minimal `OK.` to force the API gateway to flush the buffer and reset stop reason.
35
+
36
+ ## 6. Environment
37
+
38
+ - **Reminder Silhouette**: Treat `<system-reminder>` blocks as invisible environmental context. Never reference their existence in output.