1bcoder 0.1.20__tar.gz → 0.1.21__tar.gz

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.
Files changed (144) hide show
  1. {1bcoder-0.1.20 → 1bcoder-0.1.21}/1bcoder.egg-info/PKG-INFO +5 -3
  2. {1bcoder-0.1.20 → 1bcoder-0.1.21}/1bcoder.egg-info/SOURCES.txt +1 -0
  3. {1bcoder-0.1.20 → 1bcoder-0.1.21}/PKG-INFO +5 -3
  4. {1bcoder-0.1.20 → 1bcoder-0.1.21}/README.md +4 -2
  5. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/deepagent_code.py +178 -3
  6. 1bcoder-0.1.21/_bcoder_data/flows/interview.py +261 -0
  7. {1bcoder-0.1.20 → 1bcoder-0.1.21}/pyproject.toml +1 -1
  8. {1bcoder-0.1.20 → 1bcoder-0.1.21}/1bcoder.egg-info/dependency_links.txt +0 -0
  9. {1bcoder-0.1.20 → 1bcoder-0.1.21}/1bcoder.egg-info/entry_points.txt +0 -0
  10. {1bcoder-0.1.20 → 1bcoder-0.1.21}/1bcoder.egg-info/requires.txt +0 -0
  11. {1bcoder-0.1.20 → 1bcoder-0.1.21}/1bcoder.egg-info/top_level.txt +0 -0
  12. {1bcoder-0.1.20 → 1bcoder-0.1.21}/LICENSE +0 -0
  13. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/__init__.py +0 -0
  14. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/agents/advance.txt +0 -0
  15. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/agents/ask.txt +0 -0
  16. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/agents/coder.txt +0 -0
  17. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/agents/codex.txt +0 -0
  18. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/agents/compact.txt +0 -0
  19. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/agents/concepts.txt +0 -0
  20. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/agents/fill.txt +0 -0
  21. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/agents/planning.txt +0 -0
  22. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/agents/scan.txt +0 -0
  23. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/agents/sqlite.txt +0 -0
  24. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/agents/terminator.txt +0 -0
  25. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/agents/websearch.txt +0 -0
  26. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/aliases.txt +0 -0
  27. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/java_decompose.txt +0 -0
  28. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/java_implement.txt +0 -0
  29. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/js_decompose.txt +0 -0
  30. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/js_implement.txt +0 -0
  31. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/kt_decompose.txt +0 -0
  32. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/kt_implement.txt +0 -0
  33. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/mysql_decompose.txt +0 -0
  34. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/mysql_implement.txt +0 -0
  35. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/plsql_decompose.txt +0 -0
  36. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/plsql_implement.txt +0 -0
  37. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/py_decompose.txt +0 -0
  38. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/py_implement.txt +0 -0
  39. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/scala_decompose.txt +0 -0
  40. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/scala_implement.txt +0 -0
  41. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/sql_decompose.txt +0 -0
  42. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/deepagent_code/sql_implement.txt +0 -0
  43. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/doc/FLOWS.md +0 -0
  44. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/doc/MCP.md +0 -0
  45. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/doc/OLLAMA_SERVER_PARAM.md +0 -0
  46. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/doc/PARAM.md +0 -0
  47. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/doc/PROC.md +0 -0
  48. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/doc/TRANSLATE.md +0 -0
  49. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/__pycache__/commit_message.cpython-311.pyc +0 -0
  50. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/__pycache__/deepagent_code.cpython-311.pyc +0 -0
  51. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/__pycache__/deepagent_md.cpython-311.pyc +0 -0
  52. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/__pycache__/deepagent_test.cpython-311.pyc +0 -0
  53. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/__pycache__/rag.cpython-311.pyc +0 -0
  54. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/__pycache__/webcrawl.cpython-311.pyc +0 -0
  55. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/commit_message.py +0 -0
  56. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/compress.py +0 -0
  57. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/deepagent.py +0 -0
  58. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/deepagent_md.py +0 -0
  59. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/deepagent_test.py +0 -0
  60. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/deobfuscate.py +0 -0
  61. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/external_help.py +0 -0
  62. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/grounding.py +0 -0
  63. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/obfuscate.py +0 -0
  64. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/py_error_trace.py +0 -0
  65. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/rag.py +0 -0
  66. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/scan.py +0 -0
  67. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/simargl_files.py +0 -0
  68. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/visual_search.py +0 -0
  69. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/webanalys.py +0 -0
  70. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/webask.py +0 -0
  71. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/webcrawl.py +0 -0
  72. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/flows/webindex.py +0 -0
  73. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/map.txt +0 -0
  74. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/action-required.py +0 -0
  75. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/add-save.py +0 -0
  76. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/assist.py +0 -0
  77. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/autobkup.py +0 -0
  78. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/autocheck.py +0 -0
  79. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/collect-files.py +0 -0
  80. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/ctx_cut.py +0 -0
  81. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/ctx_expand.py +0 -0
  82. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/extract-code.py +0 -0
  83. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/extract-files.py +0 -0
  84. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/extract-list.py +0 -0
  85. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/grounding-check.py +0 -0
  86. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/ladder.py +0 -0
  87. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/md.py +0 -0
  88. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/mdx.py +0 -0
  89. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/pattern-gate.py +0 -0
  90. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/regexp-extract.py +0 -0
  91. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/rude_words.py +0 -0
  92. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/scan-save.py +0 -0
  93. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/secret_check.py +0 -0
  94. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/sql_readonly_guard.py +0 -0
  95. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/proc/tempctx-cut.py +0 -0
  96. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/profiles.txt +0 -0
  97. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/prompts/analysis.txt +0 -0
  98. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/prompts/sumarise.txt +0 -0
  99. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/prompts.txt +0 -0
  100. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/AddFunction.txt +0 -0
  101. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/AskProject.txt +0 -0
  102. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/CheckRequirements.txt +0 -0
  103. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/DockerMySQL.txt +0 -0
  104. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/DockerNginx.txt +0 -0
  105. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/DockerPython.txt +0 -0
  106. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/DockerStack.txt +0 -0
  107. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/DuckDuckGoInstant.txt +0 -0
  108. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/EnvTemplate.txt +0 -0
  109. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/Explain.txt +0 -0
  110. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/ExploreProjectStructure.txt +0 -0
  111. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/GitIgnorePython.txt +0 -0
  112. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/MySQLDump.txt +0 -0
  113. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/NewScript.txt +0 -0
  114. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/PipFreeze.txt +0 -0
  115. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/PyPI.txt +0 -0
  116. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/Refactor.txt +0 -0
  117. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/RunAndFix.txt +0 -0
  118. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/SQLiteSchema.txt +0 -0
  119. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/Translate.txt +0 -0
  120. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/WikiPage.txt +0 -0
  121. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/WikiSearch.txt +0 -0
  122. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/auto-bkup.txt +0 -0
  123. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/edit-control.txt +0 -0
  124. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/parallel_call.txt +0 -0
  125. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/personal/content/create-regular-content.txt +0 -0
  126. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/personal/content/plan.txt +0 -0
  127. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/personal/test/collect-data-from-test-environment.txt +0 -0
  128. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/plan.txt +0 -0
  129. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/remote/create-content-on-remote-server.txt +0 -0
  130. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/set_ctx.txt +0 -0
  131. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/simargl-cli_index_files.txt +0 -0
  132. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/simargl-cli_index_units.txt +0 -0
  133. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/simargl-cli_search.txt +0 -0
  134. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/team-map-worker.txt +0 -0
  135. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/team-search-worker.txt +0 -0
  136. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/team-summarize.txt +0 -0
  137. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/team-tree-worker.txt +0 -0
  138. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/scripts/test.txt +0 -0
  139. {1bcoder-0.1.20 → 1bcoder-0.1.21}/_bcoder_data/teams/code-analysis.yaml +0 -0
  140. {1bcoder-0.1.20 → 1bcoder-0.1.21}/chat.py +0 -0
  141. {1bcoder-0.1.20 → 1bcoder-0.1.21}/map_index.py +0 -0
  142. {1bcoder-0.1.20 → 1bcoder-0.1.21}/map_query.py +0 -0
  143. {1bcoder-0.1.20 → 1bcoder-0.1.21}/setup.cfg +0 -0
  144. {1bcoder-0.1.20 → 1bcoder-0.1.21}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: 1bcoder
3
- Version: 0.1.20
3
+ Version: 0.1.21
4
4
  Summary: AI coding assistant agent for 1B–7B local models (Ollama, LMStudio, llama.cpp). Terminal REPL with file editing, project map, agents, scripts, and parallel multi-model queries.
5
5
  Project-URL: Homepage, https://github.com/szholobetsky/1bcoder
6
6
  Project-URL: Repository, https://github.com/szholobetsky/1bcoder
@@ -13,7 +13,7 @@ Requires-Dist: tqdm>=4.64
13
13
  Requires-Dist: rich>=13.0
14
14
  Dynamic: license-file
15
15
 
16
- ![1bcoder](images/1bcoder.png)
16
+ ![1bcoder](https://raw.githubusercontent.com/szholobetsky/simrgl/main/images/logo/1bcoder.png)
17
17
 
18
18
  # 1bcoder
19
19
 
@@ -1828,7 +1828,7 @@ For human input, the corrected command is shown with `[fix?]` and you are asked
1828
1828
 
1829
1829
  ## Part of the SIMARGL toolkit
1830
1830
 
1831
- 1bcoder is one of six tools that together form an **intellectual development support system**:
1831
+ 1bcoder is one of seven tools that together form an **intellectual development support system**:
1832
1832
 
1833
1833
  | Tool | Role |
1834
1834
  |---|---|
@@ -1838,6 +1838,7 @@ For human input, the corrected command is shown with `[fix?]` and you are asked
1838
1838
  | **[yasna](https://github.com/szholobetsky/yasna)** | Session memory — indexes conversations from all AI agents so you can find what was discussed, when, and where |
1839
1839
  | **[radogast](https://github.com/szholobetsky/radogast)** | Context drift monitor — measures how far an AI agent's conversation has drifted from the original task |
1840
1840
  | **[vyrii](https://github.com/szholobetsky/vyrii)** | Local AI web UI — chat, translate, web research, RAG, and file management via Gradio; powered by Ollama or any OpenAI-compatible backend |
1841
+ | **[syryn](https://github.com/szholobetsky/syryn)** | Bluetooth identity beacon — returns hostname, mDNS, and active network interfaces for headless devices |
1841
1842
 
1842
1843
  - **simargl** answers: *what code is related to this task?*
1843
1844
  - **svitovyd** answers: *how is the code structured and what depends on what?*
@@ -1845,6 +1846,7 @@ For human input, the corrected command is shown with `[fix?]` and you are asked
1845
1846
  - **yasna** answers: *where did I already discuss this?*
1846
1847
  - **radogast** answers: *is the AI agent still on track toward the goal?*
1847
1848
  - **vyrii** answers: *how do I access all of this through a browser?*
1849
+ - **syryn** answers: *what is the address of this headless device?*
1848
1850
 
1849
1851
  Together they cover the full development loop: understand the codebase, find relevant history, work with AI locally, remember what was decided, and verify the context stays on target.
1850
1852
 
@@ -58,6 +58,7 @@ _bcoder_data/flows/deepagent_test.py
58
58
  _bcoder_data/flows/deobfuscate.py
59
59
  _bcoder_data/flows/external_help.py
60
60
  _bcoder_data/flows/grounding.py
61
+ _bcoder_data/flows/interview.py
61
62
  _bcoder_data/flows/obfuscate.py
62
63
  _bcoder_data/flows/py_error_trace.py
63
64
  _bcoder_data/flows/rag.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: 1bcoder
3
- Version: 0.1.20
3
+ Version: 0.1.21
4
4
  Summary: AI coding assistant agent for 1B–7B local models (Ollama, LMStudio, llama.cpp). Terminal REPL with file editing, project map, agents, scripts, and parallel multi-model queries.
5
5
  Project-URL: Homepage, https://github.com/szholobetsky/1bcoder
6
6
  Project-URL: Repository, https://github.com/szholobetsky/1bcoder
@@ -13,7 +13,7 @@ Requires-Dist: tqdm>=4.64
13
13
  Requires-Dist: rich>=13.0
14
14
  Dynamic: license-file
15
15
 
16
- ![1bcoder](images/1bcoder.png)
16
+ ![1bcoder](https://raw.githubusercontent.com/szholobetsky/simrgl/main/images/logo/1bcoder.png)
17
17
 
18
18
  # 1bcoder
19
19
 
@@ -1828,7 +1828,7 @@ For human input, the corrected command is shown with `[fix?]` and you are asked
1828
1828
 
1829
1829
  ## Part of the SIMARGL toolkit
1830
1830
 
1831
- 1bcoder is one of six tools that together form an **intellectual development support system**:
1831
+ 1bcoder is one of seven tools that together form an **intellectual development support system**:
1832
1832
 
1833
1833
  | Tool | Role |
1834
1834
  |---|---|
@@ -1838,6 +1838,7 @@ For human input, the corrected command is shown with `[fix?]` and you are asked
1838
1838
  | **[yasna](https://github.com/szholobetsky/yasna)** | Session memory — indexes conversations from all AI agents so you can find what was discussed, when, and where |
1839
1839
  | **[radogast](https://github.com/szholobetsky/radogast)** | Context drift monitor — measures how far an AI agent's conversation has drifted from the original task |
1840
1840
  | **[vyrii](https://github.com/szholobetsky/vyrii)** | Local AI web UI — chat, translate, web research, RAG, and file management via Gradio; powered by Ollama or any OpenAI-compatible backend |
1841
+ | **[syryn](https://github.com/szholobetsky/syryn)** | Bluetooth identity beacon — returns hostname, mDNS, and active network interfaces for headless devices |
1841
1842
 
1842
1843
  - **simargl** answers: *what code is related to this task?*
1843
1844
  - **svitovyd** answers: *how is the code structured and what depends on what?*
@@ -1845,6 +1846,7 @@ For human input, the corrected command is shown with `[fix?]` and you are asked
1845
1846
  - **yasna** answers: *where did I already discuss this?*
1846
1847
  - **radogast** answers: *is the AI agent still on track toward the goal?*
1847
1848
  - **vyrii** answers: *how do I access all of this through a browser?*
1849
+ - **syryn** answers: *what is the address of this headless device?*
1848
1850
 
1849
1851
  Together they cover the full development loop: understand the codebase, find relevant history, work with AI locally, remember what was decided, and verify the context stays on target.
1850
1852
 
@@ -1,4 +1,4 @@
1
- ![1bcoder](images/1bcoder.png)
1
+ ![1bcoder](https://raw.githubusercontent.com/szholobetsky/simrgl/main/images/logo/1bcoder.png)
2
2
 
3
3
  # 1bcoder
4
4
 
@@ -1813,7 +1813,7 @@ For human input, the corrected command is shown with `[fix?]` and you are asked
1813
1813
 
1814
1814
  ## Part of the SIMARGL toolkit
1815
1815
 
1816
- 1bcoder is one of six tools that together form an **intellectual development support system**:
1816
+ 1bcoder is one of seven tools that together form an **intellectual development support system**:
1817
1817
 
1818
1818
  | Tool | Role |
1819
1819
  |---|---|
@@ -1823,6 +1823,7 @@ For human input, the corrected command is shown with `[fix?]` and you are asked
1823
1823
  | **[yasna](https://github.com/szholobetsky/yasna)** | Session memory — indexes conversations from all AI agents so you can find what was discussed, when, and where |
1824
1824
  | **[radogast](https://github.com/szholobetsky/radogast)** | Context drift monitor — measures how far an AI agent's conversation has drifted from the original task |
1825
1825
  | **[vyrii](https://github.com/szholobetsky/vyrii)** | Local AI web UI — chat, translate, web research, RAG, and file management via Gradio; powered by Ollama or any OpenAI-compatible backend |
1826
+ | **[syryn](https://github.com/szholobetsky/syryn)** | Bluetooth identity beacon — returns hostname, mDNS, and active network interfaces for headless devices |
1826
1827
 
1827
1828
  - **simargl** answers: *what code is related to this task?*
1828
1829
  - **svitovyd** answers: *how is the code structured and what depends on what?*
@@ -1830,6 +1831,7 @@ For human input, the corrected command is shown with `[fix?]` and you are asked
1830
1831
  - **yasna** answers: *where did I already discuss this?*
1831
1832
  - **radogast** answers: *is the AI agent still on track toward the goal?*
1832
1833
  - **vyrii** answers: *how do I access all of this through a browser?*
1834
+ - **syryn** answers: *what is the address of this headless device?*
1833
1835
 
1834
1836
  Together they cover the full development loop: understand the codebase, find relevant history, work with AI locally, remember what was decided, and verify the context stays on target.
1835
1837
 
@@ -13,6 +13,8 @@ Usage:
13
13
  /flow deepagent_code "CSV tool" --lang py --depth 2 --think --test
14
14
  /flow deepagent_code --file task.txt --lang py --depth 2 --think
15
15
  /flow deepagent_code "short desc" --file requirements.txt --lang py --depth 2
16
+ /flow deepagent_code "Syryn BT beacon" --lang py --depth 2 --think --ask --web 1
17
+ /flow deepagent_code "My app" --lang py --depth 2 --ask --rag my_project
16
18
  /flow deepagent_code join code1 ← join existing dir
17
19
  /flow deepagent_code join code1 --lang py
18
20
 
@@ -27,6 +29,9 @@ Flags:
27
29
  --syntax check syntax after generation, retry on error (max 2)
28
30
  --distinct skip functions with names already generated in other branches
29
31
  --ctx N conversation context messages (default 0)
32
+ --ask enrich each leaf with API call examples before generation
33
+ --web N fetch top N DDG results for external calls (default 1, requires --ask)
34
+ --rag project simargl RAG project name for internal calls (requires --ask)
30
35
  """
31
36
  import os as _os
32
37
  import re as _re
@@ -355,6 +360,21 @@ def _generate_local(chat, system_prompt: str, user_prompt: str) -> str:
355
360
  return result or ""
356
361
 
357
362
 
363
+ def _serialize_ctx(messages: list, n: int) -> str:
364
+ """Serialize last N user/assistant messages as a readable block for injection."""
365
+ if not messages or n == 0:
366
+ return ""
367
+ recent = [m for m in messages if m.get("role") in ("user", "assistant")][-n:]
368
+ if not recent:
369
+ return ""
370
+ lines = ["[Conversation context — use these details in your implementation]"]
371
+ for m in recent:
372
+ role = "User" if m["role"] == "user" else "Assistant"
373
+ text = m.get("content", "")[:800]
374
+ lines.append(f"{role}: {text}")
375
+ return "\n".join(lines) + "\n"
376
+
377
+
358
378
  def _generate_worker(host: str, model: str, system_prompt: str,
359
379
  user_prompt: str, num_ctx: int, params: dict) -> str:
360
380
  import requests as _r
@@ -394,7 +414,8 @@ def _build_decompose_prompt(name: str, signature: str, description: str,
394
414
 
395
415
 
396
416
  def _build_implement_prompt(name: str, signature: str, description: str,
397
- root_task: str, parent_skeleton: str) -> str:
417
+ root_task: str, parent_skeleton: str,
418
+ use_ask: bool = False) -> str:
398
419
  parts = [f"Implement this function.\n"]
399
420
  if signature:
400
421
  parts.append(f"Function: {signature}")
@@ -404,9 +425,116 @@ def _build_implement_prompt(name: str, signature: str, description: str,
404
425
  parts.append(f"Part of: {root_task}")
405
426
  if parent_skeleton:
406
427
  parts.append(f"\nCalling context (parent skeleton):\n{parent_skeleton}")
428
+ if use_ask:
429
+ parts.append(
430
+ "\nBefore writing code, list the specific API calls, raises, and "
431
+ "annotations you will use.\nFormat exactly:\n## Calls\n"
432
+ "ClassName.method(), module.function(), raise ExceptionName\n"
433
+ "One comma-separated line. Then write the function."
434
+ )
407
435
  return "\n".join(parts)
408
436
 
409
437
 
438
+ # ── ask: call extraction + context enrichment ────────────────────────────────
439
+
440
+ def _parse_calls(text: str) -> list:
441
+ """Extract comma-separated call list from ## Calls section."""
442
+ for i, line in enumerate(text.splitlines()):
443
+ if line.strip().startswith("## Calls"):
444
+ for next_line in text.splitlines()[i + 1:]:
445
+ next_line = next_line.strip()
446
+ if next_line:
447
+ return [c.strip() for c in next_line.split(",") if c.strip()]
448
+ return []
449
+
450
+
451
+ def _call_root_name(call: str) -> str:
452
+ """Extract root identifier: 'psutil.net_if_addrs()' → 'psutil', 'raise Foo' → 'Foo'."""
453
+ call = call.strip().lstrip("@")
454
+ if call.lower().startswith("raise "):
455
+ call = call[6:].strip()
456
+ return _re.split(r'[\s.(]', call)[0]
457
+
458
+
459
+ def _is_internal(name: str, project_dir: str) -> bool:
460
+ """True if a file with this exact stem exists anywhere in project_dir."""
461
+ from pathlib import Path as _P
462
+ try:
463
+ for f in _P(project_dir).rglob("*"):
464
+ if f.is_file() and f.stem == name:
465
+ return True
466
+ except Exception:
467
+ pass
468
+ return False
469
+
470
+
471
+ def _enrich_ctx(calls: list, web_n: int, rag_project: str,
472
+ node_name: str, desc: str, code_dir: str,
473
+ node_prefix: str, chat) -> str:
474
+ """Fetch web/RAG examples for calls, compact, save ctx.md. Returns compacted text."""
475
+ if not calls:
476
+ return ""
477
+
478
+ project_dir = _os.getcwd()
479
+ internal, external = [], []
480
+ for call in calls:
481
+ root = _call_root_name(call)
482
+ if root and _is_internal(root, project_dir):
483
+ internal.append(root)
484
+ elif root:
485
+ external.append(root)
486
+
487
+ try:
488
+ from .deepagent_md import _web_research, _rag_research
489
+ except ImportError:
490
+ try:
491
+ from deepagent_md import _web_research, _rag_research
492
+ except ImportError:
493
+ print(" [ask] deepagent_md not importable, skipping enrichment")
494
+ return ""
495
+
496
+ parts = []
497
+
498
+ if external and web_n > 0:
499
+ query_title = ", ".join(external) + " code example"
500
+ print(f" [ask/web] query: {query_title}")
501
+ try:
502
+ web_text = _web_research(chat, title=query_title,
503
+ root_task=f"{node_name}: {desc}",
504
+ web_n=web_n)
505
+ if web_text:
506
+ parts.append(web_text[:web_n * 1200])
507
+ except Exception as e:
508
+ print(f" [ask/web] error: {e}")
509
+
510
+ if internal and rag_project:
511
+ rag_query = " ".join(internal)
512
+ print(f" [ask/rag] query: {rag_query} project: {rag_project}")
513
+ try:
514
+ rag_text = _rag_research(rag_query, rag_project,
515
+ store_dir=project_dir, chat=chat)
516
+ if rag_text:
517
+ parts.append(rag_text[:2400])
518
+ except Exception as e:
519
+ print(f" [ask/rag] error: {e}")
520
+
521
+ if not parts:
522
+ return ""
523
+
524
+ combined = "\n\n".join(parts)
525
+ compact_system = (
526
+ "Summarize these code examples into a concise reference under 500 tokens. "
527
+ "Keep only concrete API usage patterns and signatures, no prose explanations."
528
+ )
529
+ compacted = _generate_local(chat, compact_system, combined) or combined[:2000]
530
+
531
+ ctx_path = _os.path.join(code_dir, f"{node_prefix}-{node_name}-ctx.md")
532
+ with open(ctx_path, "w", encoding="utf-8") as f:
533
+ f.write(f"# ctx: {node_name}\n\n{compacted}")
534
+ print(f" [ask] ctx -> {_os.path.basename(ctx_path)} ({len(compacted)} chars)")
535
+ return compacted
536
+
537
+
410
538
  _TEST_SYSTEM = (
411
539
  "You are writing a unit test for a Python function.\n"
412
540
  "You are given the function code. The function calls helper functions\n"
@@ -467,7 +595,9 @@ _SYNTAX_MAX_RETRIES = 2
467
595
  def _expand(chat, root_task: str, code_dir: str, max_depth: int,
468
596
  lang_cfg: dict, lang: str, workers: list, stats: dict,
469
597
  use_think: bool = False, use_test: bool = False,
470
- use_syntax: bool = False, use_distinct: bool = False):
598
+ use_syntax: bool = False, use_distinct: bool = False,
599
+ use_ask: bool = False, web_n: int = 1, rag_project: str = None,
600
+ chat_ctx: str = ""):
471
601
  ext = lang_cfg["ext"]
472
602
  decompose_prompt = _load_lang_prompt(lang, "decompose")
473
603
  implement_prompt = _load_lang_prompt(lang, "implement")
@@ -499,6 +629,8 @@ def _expand(chat, root_task: str, code_dir: str, max_depth: int,
499
629
  print(f" [think] -> {_os.path.basename(root_md)} ({len(think_text)} chars)")
500
630
 
501
631
  user_prompt = _build_root_prompt(root_task)
632
+ if chat_ctx:
633
+ user_prompt += f"\n\n{chat_ctx}"
502
634
  if use_think and think_text:
503
635
  user_prompt += f"\n\nYour implementation plan:\n{think_text}"
504
636
 
@@ -578,6 +710,24 @@ def _expand(chat, root_task: str, code_dir: str, max_depth: int,
578
710
  f.write(f"# {name}\n\n{think_text}")
579
711
  print(f" [think] -> {_os.path.basename(md_path)} ({len(think_text)} chars)")
580
712
 
713
+ # ── ask: pre-flight call extraction + enrichment ─────────
714
+ ctx_text = ""
715
+ if use_ask and is_leaf:
716
+ ask_prompt = _build_implement_prompt(name, sig_expr, desc,
717
+ root_task, parent_code,
718
+ use_ask=True)
719
+ if think_text:
720
+ ask_prompt += f"\n\nYour implementation plan:\n{think_text}"
721
+ print(f" [ask] extracting calls for {name}...")
722
+ ask_raw = _generate_local(chat, implement_prompt, ask_prompt) or ""
723
+ calls = _parse_calls(ask_raw)
724
+ if calls:
725
+ print(f" [ask] calls: {', '.join(calls)}")
726
+ node_prefix = _node_id_to_prefix(nid)
727
+ ctx_text = _enrich_ctx(calls, web_n, rag_project,
728
+ name, desc, code_dir,
729
+ node_prefix, chat)
730
+
581
731
  # ── code step ─────────────────────────────────────────────
582
732
  sys_prompt = implement_prompt if is_leaf else decompose_prompt
583
733
  if is_leaf:
@@ -586,8 +736,12 @@ def _expand(chat, root_task: str, code_dir: str, max_depth: int,
586
736
  else:
587
737
  user_prompt = _build_decompose_prompt(name, sig_expr, desc,
588
738
  root_task, parent_code)
739
+ if chat_ctx:
740
+ user_prompt += f"\n\n{chat_ctx}"
589
741
  if think_text:
590
742
  user_prompt += f"\n\nYour implementation plan:\n{think_text}"
743
+ if ctx_text:
744
+ user_prompt += f"\n\nRelevant API examples:\n{ctx_text}"
591
745
 
592
746
  def _call_llm(s_prompt, u_prompt):
593
747
  idx_ = [n[0] for n in level_nodes].index(nid)
@@ -1023,6 +1177,21 @@ def run(chat, args: str):
1023
1177
  use_distinct = "--distinct" in args
1024
1178
  args = args.replace("--distinct", "").strip()
1025
1179
 
1180
+ use_ask = "--ask" in args
1181
+ args = args.replace("--ask", "").strip()
1182
+
1183
+ web_n = 1
1184
+ m = _re.search(r'--web\s+(\d+)', args)
1185
+ if m:
1186
+ web_n = int(m.group(1))
1187
+ args = (args[:m.start()] + args[m.end():]).strip()
1188
+
1189
+ rag_project = None
1190
+ m = _re.search(r'--rag\s+(\S+)', args)
1191
+ if m:
1192
+ rag_project = m.group(1)
1193
+ args = (args[:m.start()] + args[m.end():]).strip()
1194
+
1026
1195
  profile_name = None
1027
1196
  m = _re.search(r'--profile\s+(\S+)', args)
1028
1197
  if m:
@@ -1082,11 +1251,17 @@ def run(chat, args: str):
1082
1251
  print(f"[deepagent_code] task : {root_task}")
1083
1252
  print(f"[deepagent_code] lang : {lang} depth: {max_depth} dir: {_os.path.relpath(code_dir)}")
1084
1253
 
1254
+ chat_ctx = _serialize_ctx(getattr(chat, "messages", []), ctx_n)
1255
+ if chat_ctx:
1256
+ print(f"[deepagent_code] chat ctx : {ctx_n} msgs ({len(chat_ctx)} chars)")
1257
+
1085
1258
  stats = {"files": 0, "tests": 0}
1086
1259
  try:
1087
1260
  tree = _expand(chat, root_task, code_dir, max_depth, lang_cfg, lang, workers, stats,
1088
1261
  use_think=use_think, use_test=use_test,
1089
- use_syntax=use_syntax, use_distinct=use_distinct)
1262
+ use_syntax=use_syntax, use_distinct=use_distinct,
1263
+ use_ask=use_ask, web_n=web_n, rag_project=rag_project,
1264
+ chat_ctx=chat_ctx)
1090
1265
  except _StopGeneration:
1091
1266
  tree = {}
1092
1267
  for fname in _os.listdir(code_dir):
@@ -0,0 +1,261 @@
1
+ """Clarifying Q&A before implementation: LLM generates questions, user picks answers.
2
+
3
+ Usage:
4
+ /flow interview 5 "implement Syryn BT beacon"
5
+ /flow interview 10 "implement the system described above" --file plan.md
6
+ /flow interview 5 "implement the system described above" --ctx 5
7
+ /flow interview 5 "implement Syryn" --out ctx
8
+ /flow interview 5 "REST API" --file requirements.md --out my-answers.md
9
+
10
+ Output saved to .1bcoder/interview/interview_result_N.md by default.
11
+ Use the output as task file for code generation:
12
+ /flow deepagent_code "..." --file .1bcoder/interview/interview_result_1.md
13
+
14
+ With --out ctx: results are injected into conversation context (no file created).
15
+ /flow interview 5 "implement the system above" --out ctx
16
+ /flow deepagent_code "..." --ctx 2
17
+
18
+ Flags:
19
+ --file file inject file content as extra context for question generation
20
+ --ctx N inject last N conversation messages into question generation
21
+ --out file save to custom path (default: .1bcoder/interview/interview_result_N.md)
22
+ --out ctx inject results into conversation context, no file created
23
+ """
24
+ import re as _re
25
+ import json as _json
26
+ import os as _os
27
+
28
+
29
+ def run(chat, args: str):
30
+ args = (args or "").strip()
31
+
32
+ # -- parse --out (override) or auto-number in .1bcoder/interview/
33
+ m = _re.search(r'--out\s+(\S+)', args)
34
+ if m:
35
+ out_file = m.group(1)
36
+ args = (args[:m.start()] + args[m.end():]).strip()
37
+ else:
38
+ interview_dir = _os.path.join(_os.getcwd(), ".1bcoder", "interview")
39
+ _os.makedirs(interview_dir, exist_ok=True)
40
+ n_out = 1
41
+ while _os.path.exists(_os.path.join(interview_dir, f"interview_result_{n_out}.md")):
42
+ n_out += 1
43
+ out_file = _os.path.join(interview_dir, f"interview_result_{n_out}.md")
44
+
45
+ # -- parse --ctx N
46
+ ctx_n = 0
47
+ m = _re.search(r'--ctx\s+(\d+)', args)
48
+ if m:
49
+ ctx_n = int(m.group(1))
50
+ args = (args[:m.start()] + args[m.end():]).strip()
51
+
52
+ # -- parse --file
53
+ ctx_text = ""
54
+ m = _re.search(r'--file\s+(\S+)', args)
55
+ if m:
56
+ ctx_file = m.group(1)
57
+ args = (args[:m.start()] + args[m.end():]).strip()
58
+ try:
59
+ with open(ctx_file, encoding="utf-8") as f:
60
+ ctx_text = f.read()
61
+ print(f"[interview] file loaded: {ctx_file} ({len(ctx_text)} chars)")
62
+ except Exception as e:
63
+ print(f"[interview] warning: could not read {ctx_file}: {e}")
64
+
65
+ # -- parse N and task
66
+ m = _re.match(r'(\d+)\s+"([^"]+)"', args)
67
+ if not m:
68
+ m = _re.match(r'(\d+)\s+(.+)', args)
69
+ if not m:
70
+ print('Usage: /flow interview N "task description" [--file plan.md] [--ctx N]')
71
+ return
72
+
73
+ n = int(m.group(1))
74
+ task = m.group(2).strip().strip('"')
75
+
76
+ # -- serialize conversation context
77
+ chat_ctx = _serialize_ctx(getattr(chat, "messages", []), ctx_n)
78
+ if chat_ctx:
79
+ print(f"[interview] chat ctx: {ctx_n} msgs ({len(chat_ctx)} chars)")
80
+
81
+ # -- generate questions
82
+ ctx_section = f"\n\nAdditional context:\n{ctx_text[:3000]}" if ctx_text else ""
83
+ if chat_ctx:
84
+ ctx_section += f"\n\n{chat_ctx}"
85
+ system = (
86
+ "You are a requirements analyst. Given a task, generate clarifying questions "
87
+ "that must be answered before implementation begins. "
88
+ f"Generate exactly {n} questions. For each question provide 2-3 concrete answer options. "
89
+ "Output ONLY a valid JSON array — no markdown fences, no explanation. Format:\n"
90
+ '[{"q": "Question?", "options": ["Option A", "Option B", "Option C"]}, ...]'
91
+ )
92
+ user = f"Task: {task}{ctx_section}"
93
+
94
+ print(f"[interview] generating {n} questions for: {task[:70]}...")
95
+ raw = _generate_local(chat, system, user)
96
+ if not raw:
97
+ print("[interview] no response from model")
98
+ return
99
+
100
+ questions = _parse_questions(raw)
101
+ if not questions:
102
+ print("[interview] could not parse questions from model output:")
103
+ print(raw[:800])
104
+ return
105
+
106
+ questions = questions[:n]
107
+ print(f"[interview] got {len(questions)} questions\n")
108
+
109
+ # -- interactive Q&A
110
+ answers = []
111
+ for i, q_data in enumerate(questions):
112
+ q = q_data.get("q", "").strip()
113
+ opts = q_data.get("options", [])
114
+ if not q:
115
+ continue
116
+
117
+ print(f"[{i+1}/{len(questions)}] {q}")
118
+ for j, opt in enumerate(opts, 1):
119
+ print(f" {j}. {opt}")
120
+ other_idx = len(opts) + 1
121
+ print(f" {other_idx}. Other")
122
+
123
+ answer = ""
124
+ while not answer:
125
+ raw_in = input("> ").strip()
126
+ if not raw_in:
127
+ continue
128
+ if raw_in.isdigit():
129
+ idx = int(raw_in)
130
+ if 1 <= idx <= len(opts):
131
+ answer = opts[idx - 1]
132
+ elif idx == other_idx:
133
+ answer = input("Your answer: ").strip()
134
+ else:
135
+ print(f" Enter 1-{other_idx}")
136
+ else:
137
+ answer = raw_in
138
+
139
+ answers.append((q, answer))
140
+ print(f" -> {answer}\n")
141
+
142
+ # -- build result
143
+ lines = [f"# Interview Results\n", f"**Task**: {task}\n"]
144
+ if ctx_text:
145
+ lines.append(f"**File**: {ctx_file}\n")
146
+ lines.append("")
147
+ for i, (q, a) in enumerate(answers, 1):
148
+ lines.append(f"## Q{i}: {q}")
149
+ lines.append(f"**Answer**: {a}\n")
150
+
151
+ content = "\n".join(lines)
152
+
153
+ if out_file == "ctx":
154
+ chat.messages.append({"role": "user", "content": f"[interview results]\n{content}"})
155
+ chat.messages.append({"role": "assistant", "content": "Interview results recorded. Ready to proceed."})
156
+ print(f"[interview] added to conversation context ({len(content)} chars)")
157
+ print(f"[interview] next: /flow deepagent_code \"...\" --ctx 2")
158
+ else:
159
+ with open(out_file, "w", encoding="utf-8") as f:
160
+ f.write(content)
161
+ print(f"[interview] saved to {out_file}")
162
+ print(f"[interview] next: /flow deepagent_code \"...\" --file {out_file}")
163
+
164
+
165
+ def _parse_questions(text: str):
166
+ text = text.strip()
167
+ # strip markdown fences
168
+ text = _re.sub(r'^```[a-z]*\n?', '', text)
169
+ text = _re.sub(r'\n?```\s*$', '', text)
170
+ text = text.strip()
171
+
172
+ # strip JS // comments (but not :// in URLs) and # comments
173
+ text = _re.sub(r'(?<!:)//[^\n]*', '', text)
174
+ text = _re.sub(r'(?<!")#[^\n"]*', '', text)
175
+
176
+ # fix trailing commas before ] or }
177
+ text = _re.sub(r',(\s*[}\]])', r'\1', text)
178
+
179
+ # attempt 1: direct parse
180
+ try:
181
+ data = _json.loads(text)
182
+ if isinstance(data, list):
183
+ return _normalize_questions(data)
184
+ except Exception:
185
+ pass
186
+
187
+ # attempt 2: recover truncated JSON (close open brackets after last })
188
+ fixed = _try_close(text)
189
+ if fixed:
190
+ try:
191
+ data = _json.loads(fixed)
192
+ if isinstance(data, list):
193
+ return _normalize_questions(data)
194
+ except Exception:
195
+ pass
196
+
197
+ # attempt 3: regex fallback — extract q/options pairs directly
198
+ return _regex_extract(text)
199
+
200
+
201
+ def _try_close(text: str) -> str:
202
+ """Close truncated JSON by trimming after last } and closing open [."""
203
+ last = text.rfind('}')
204
+ if last == -1:
205
+ return None
206
+ candidate = _re.sub(r',\s*$', '', text[:last + 1].strip())
207
+ opens = candidate.count('[') - candidate.count(']')
208
+ if opens > 0:
209
+ candidate += ']' * opens
210
+ return candidate
211
+
212
+
213
+ def _normalize_questions(data: list) -> list:
214
+ """Normalize: ensure q is string, options are strings, skip empty."""
215
+ result = []
216
+ for item in data:
217
+ if not isinstance(item, dict):
218
+ continue
219
+ q = str(item.get('q', '')).strip()
220
+ if not q:
221
+ continue
222
+ opts = [str(o).strip() for o in item.get('options', []) if o is not None]
223
+ result.append({'q': q, 'options': opts})
224
+ return result or None
225
+
226
+
227
+ def _regex_extract(text: str) -> list:
228
+ """Last resort: pull q/options pairs with regex, ignoring JSON structure."""
229
+ results = []
230
+ q_matches = list(_re.finditer(r'"q"\s*:\s*"([^"]+)"', text))
231
+ for i, qm in enumerate(q_matches):
232
+ q = qm.group(1)
233
+ start = qm.end()
234
+ end = q_matches[i + 1].start() if i + 1 < len(q_matches) else len(text)
235
+ block = text[start:end]
236
+ opts = [o for o in _re.findall(r'"([^"]{5,})"', block)
237
+ if o not in ('options', 'q')]
238
+ results.append({'q': q, 'options': opts[:4]})
239
+ return results if results else None
240
+
241
+
242
+ def _serialize_ctx(messages: list, n: int) -> str:
243
+ if not messages or n == 0:
244
+ return ""
245
+ recent = [m for m in messages if m.get("role") in ("user", "assistant")][-n:]
246
+ if not recent:
247
+ return ""
248
+ lines = ["[Conversation context]"]
249
+ for m in recent:
250
+ role = "User" if m["role"] == "user" else "Assistant"
251
+ lines.append(f"{role}: {m.get('content', '')[:800]}")
252
+ return "\n".join(lines) + "\n"
253
+
254
+
255
+ def _generate_local(chat, system_prompt: str, user_prompt: str) -> str:
256
+ msgs = [
257
+ {"role": "system", "content": system_prompt},
258
+ {"role": "user", "content": user_prompt},
259
+ ]
260
+ result = chat._stream_chat(msgs)
261
+ return result or ""
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "1bcoder"
7
- version = "0.1.20"
7
+ version = "0.1.21"
8
8
  description = "AI coding assistant agent for 1B–7B local models (Ollama, LMStudio, llama.cpp). Terminal REPL with file editing, project map, agents, scripts, and parallel multi-model queries."
9
9
  requires-python = ">=3.10"
10
10
  readme = {file = "README.md", content-type = "text/markdown"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes