mirror of
https://github.com/bendtherules/opencode-plugin-dsml-fix.git
synced 2026-10-17 16:56:50 +00:00
Recovers DeepSeek DSML tool calls that leak as assistant text: streaming middleware (AI-SDK path), SSE rewrite (native path), history sanitization, preventive directive, conditional system nudge, and a capped idle watchdog. 116 tests, synthetic golden fixtures.
2 lines
5.0 KiB
JSON
2 lines
5.0 KiB
JSON
[{"seq":5177,"finish":"stop","text":"Now collect the player state reactively and add the seek callback. Let me update the screen.\n\n<analysis>\nCollect state in onCreate and pass it into the settings screen.\n</analysis>\n\n<parameter name=\"edit\">\n<|DSML|parameter name=\"newString\" string=\"true\"> // Mirror the player state into a snapshot the UI reads.\n playerState.collect { state.value = it }</|DSML|parameter>\n<|DSML|parameter name=\"oldString\" string=\"true\"> playerState.collect { state.value = it }</|DSML|parameter>\n<|DSML|parameter name=\"path\" string=\"true\">/proj/app/src/main/java/com/example/app/MainScreen.kt</|DSML|parameter>\n</|DSML| invoke>\n</|DSML| calls>"},{"seq":5425,"finish":"stop","text":"The renderer joins pieces when the text buffer grows. Let me find where that happens.\n\n<analysis>\nFind the append call sites in the render loop.\n</analysis>\n\n<parameter name=\"shell\">\n<|DSML|parameter name=\"command\" string=\"true\">cd /proj/native\ngrep -n 'append' src/render.cpp | head -20</|DSML|parameter>\n</|DSML| invoke>\n</|DSML| calls>"},{"seq":5443,"finish":"stop","text":"The join rule handles the boundary marker. Let me inspect the decoder.\n\n<analysis>\nInspect how boundary markers turn into separators.\n</analysis>\n\n<parameter name=\"shell\">\n<|DSML|parameter name=\"command\" string=\"true\">cd /proj/native\ngrep -rn 'decode' src/*.cpp src/*.hpp | head\necho \"=== impl ===\"\ngrep -rn 'std::string decode' src/</|DSML|parameter>\n</|DSML| invoke>\n</|DSML| calls>"},{"seq":5608,"finish":"tool-calls","text":"The worker pool defaults to 8 threads, which oversubscribes a phone. Let me expose a thread-count knob with a sensible default.\n\n<analysis>\nAdd a small native setter and call it before first inference.\n</analysis>\n\n<|DSML|parameter name=\"edit\">\n<|DSML|parameter name=\"newString\" string=\"true\">#include \"engine_capi.h\"\n\nnamespace rt { void set_num_threads(int n); }</|DSML|parameter>\n<|DSML|parameter name=\"oldString\" string=\"true\">#include \"engine_capi.h\"</|DSML|parameter>\n<|DSML|parameter name=\"path\" string=\"true\">/proj/app/src/main/cpp/engine_jni.cpp</|DSML|parameter>\n</|DSML|invoke>"},{"seq":5624,"finish":"stop","text":"Call the thread setter during preload, tuned to the fast cores.\n\n<analysis>\nSet threads once before loading, capped to the big cluster.\n</analysis>\n\n<parameter name=\"edit\">\n<|DSML|parameter name=\"newString\" string=\"true\"> loading = true\n val threads = (cores / 2).coerceIn(2, 6)\n try { Native.setThreads(threads) } catch (_: Throwable) { }</|DSML|parameter>\n<|DSML|parameter name=\"oldString\" string=\"true\"> loading = true</|DSML|parameter>\n<|DSML|parameter name=\"path\" string=\"true\">/proj/app/src/main/java/com/example/app/engine/Model.kt</|DSML|parameter>\n</|DSML| invoke>\n</|DSML| calls>"},{"seq":5647,"finish":"stop","text":"The declaration may have landed inside the wrong scope. Let me check its position.\n\n<analysis>\nVerify the declaration sits at file scope, not inside a block.\n</analysis>\n\n<parameter name=\"shell\">\n<|DSML|parameter name=\"command\" string=\"true\">cd /proj/app/src/main/cpp\ngrep -n 'namespace rt' engine_jni.cpp | head</|DSML|parameter>\n</|DSML| invoke>\n</|DSML| calls>"},{"seq":5663,"finish":"stop","text":"The declaration didn't apply. Let me add it right after the include.\n\n<analysis>\nInsert after the capi include with a unique anchor.\n</analysis>\n\n<parameter name=\"edit\">\n<|DSML|parameter name=\"newString\" string=\"true\">#include \"engine_capi.h\"\n\nnamespace rt { void set_num_threads(int n); }</|DSML|parameter>\n<|DSML|parameter name=\"oldString\" string=\"true\">#include \"engine_capi.h\"</|DSML|parameter>\n<|DSML|parameter name=\"path\" string=\"true\">/proj/app/src/main/cpp/engine_jni.cpp</|DSML|parameter>\n</|DSML| invoke>\n</|DSML| calls>"},{"seq":5679,"finish":"stop","text":"Odd scoping at the call site. Let me check line numbers around it.\n\n<analysis>\nCheck declaration location versus call site ordering.\n</analysis>\n\n<parameter name=\"shell\">\n<|DSML|parameter name=\"command\" string=\"true\">cd /proj/app/src/main/cpp\ngrep -n 'set_num_threads' engine_jni.cpp</|DSML|parameter>\n</|DSML| invoke>\n</|DSML| calls>"},{"seq":5695,"finish":"stop","text":"The declaration is still missing. Let me write it directly.\n\n<analysis>\nInsert with a precise unique anchor this time.\n</analysis>\n\n<parameter name=\"edit\">\n<|DSML|parameter name=\"newString\" string=\"true\">#include \"engine_capi.h\"\n\nnamespace rt { void set_num_threads(int n); }</|DSML|parameter>\n<|DSML|parameter name=\"oldString\" string=\"true\">#include \"engine_capi.h\"</|DSML|parameter>\n<|DSML|parameter name=\"path\" string=\"true\">/proj/app/src/main/cpp/engine_jni.cpp</|DSML|parameter>\n</|DSML| invoke>\n</|DSML| calls>"}]
|