bonecode 1.2.3 → 1.4.1

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 (85) hide show
  1. package/README.md +62 -0
  2. package/compat/opencode_adapter.ts +69 -8
  3. package/dist/compat/opencode_adapter.js +63 -7
  4. package/dist/compat/opencode_adapter.js.map +1 -1
  5. package/dist/src/db_adapter.js +30 -0
  6. package/dist/src/db_adapter.js.map +1 -1
  7. package/dist/src/engine/agent/prompt/compaction.txt +9 -0
  8. package/dist/src/engine/agent/prompt/explore.txt +18 -0
  9. package/dist/src/engine/agent/prompt/scout.txt +36 -0
  10. package/dist/src/engine/agent/prompt/summary.txt +11 -0
  11. package/dist/src/engine/agent/prompt/title.txt +44 -0
  12. package/dist/src/engine/session/build_mode.d.ts +83 -0
  13. package/dist/src/engine/session/build_mode.js +789 -0
  14. package/dist/src/engine/session/build_mode.js.map +1 -0
  15. package/dist/src/engine/session/build_mode_helpers.d.ts +6 -0
  16. package/dist/src/engine/session/build_mode_helpers.js +61 -0
  17. package/dist/src/engine/session/build_mode_helpers.js.map +1 -0
  18. package/dist/src/engine/session/prompt/anthropic.txt +105 -0
  19. package/dist/src/engine/session/prompt/beast.txt +147 -0
  20. package/dist/src/engine/session/prompt/bonescript.txt +402 -0
  21. package/dist/src/engine/session/prompt/build-switch.txt +5 -0
  22. package/dist/src/engine/session/prompt/codex.txt +79 -0
  23. package/dist/src/engine/session/prompt/copilot-gpt-5.txt +143 -0
  24. package/dist/src/engine/session/prompt/default.txt +105 -0
  25. package/dist/src/engine/session/prompt/gemini.txt +155 -0
  26. package/dist/src/engine/session/prompt/gpt.txt +107 -0
  27. package/dist/src/engine/session/prompt/kimi.txt +95 -0
  28. package/dist/src/engine/session/prompt/max-steps.txt +16 -0
  29. package/dist/src/engine/session/prompt/plan-reminder-anthropic.txt +67 -0
  30. package/dist/src/engine/session/prompt/plan.txt +26 -0
  31. package/dist/src/engine/session/prompt/trinity.txt +97 -0
  32. package/dist/src/engine/session/prompt.js +92 -4
  33. package/dist/src/engine/session/prompt.js.map +1 -1
  34. package/dist/src/engine/skill/prompt/customize-opencode.md +377 -0
  35. package/dist/src/engine/tool/apply_patch.txt +33 -0
  36. package/dist/src/engine/tool/edit.txt +10 -0
  37. package/dist/src/engine/tool/glob.txt +6 -0
  38. package/dist/src/engine/tool/grep.txt +8 -0
  39. package/dist/src/engine/tool/lsp.txt +24 -0
  40. package/dist/src/engine/tool/plan-enter.txt +14 -0
  41. package/dist/src/engine/tool/plan-exit.txt +13 -0
  42. package/dist/src/engine/tool/question.txt +10 -0
  43. package/dist/src/engine/tool/read.txt +14 -0
  44. package/dist/src/engine/tool/repo_clone.txt +5 -0
  45. package/dist/src/engine/tool/repo_overview.txt +4 -0
  46. package/dist/src/engine/tool/shell/shell.txt +77 -0
  47. package/dist/src/engine/tool/skill.txt +5 -0
  48. package/dist/src/engine/tool/task.txt +58 -0
  49. package/dist/src/engine/tool/task_status.txt +13 -0
  50. package/dist/src/engine/tool/todowrite.txt +167 -0
  51. package/dist/src/engine/tool/tool/apply_patch.txt +33 -0
  52. package/dist/src/engine/tool/tool/edit.txt +10 -0
  53. package/dist/src/engine/tool/tool/glob.txt +6 -0
  54. package/dist/src/engine/tool/tool/grep.txt +8 -0
  55. package/dist/src/engine/tool/tool/lsp.txt +24 -0
  56. package/dist/src/engine/tool/tool/plan-enter.txt +14 -0
  57. package/dist/src/engine/tool/tool/plan-exit.txt +13 -0
  58. package/dist/src/engine/tool/tool/question.txt +10 -0
  59. package/dist/src/engine/tool/tool/read.txt +14 -0
  60. package/dist/src/engine/tool/tool/repo_clone.txt +5 -0
  61. package/dist/src/engine/tool/tool/repo_overview.txt +4 -0
  62. package/dist/src/engine/tool/tool/shell/shell.txt +77 -0
  63. package/dist/src/engine/tool/tool/skill.txt +5 -0
  64. package/dist/src/engine/tool/tool/task.txt +58 -0
  65. package/dist/src/engine/tool/tool/task_status.txt +13 -0
  66. package/dist/src/engine/tool/tool/todowrite.txt +167 -0
  67. package/dist/src/engine/tool/tool/webfetch.txt +13 -0
  68. package/dist/src/engine/tool/tool/websearch.txt +14 -0
  69. package/dist/src/engine/tool/tool/write.txt +8 -0
  70. package/dist/src/engine/tool/webfetch.txt +13 -0
  71. package/dist/src/engine/tool/websearch.txt +14 -0
  72. package/dist/src/engine/tool/write.txt +8 -0
  73. package/dist/src/tui.js +146 -9
  74. package/dist/src/tui.js.map +1 -1
  75. package/package.json +2 -2
  76. package/scripts/copy_prompts.js +58 -0
  77. package/scripts/test_bonescript_primer.js +111 -0
  78. package/scripts/test_build_fallback.js +221 -0
  79. package/scripts/test_build_mode.js +301 -0
  80. package/src/db_adapter.ts +29 -0
  81. package/src/engine/session/build_mode.ts +895 -0
  82. package/src/engine/session/build_mode_helpers.ts +72 -0
  83. package/src/engine/session/prompt/bonescript.txt +402 -0
  84. package/src/engine/session/prompt.ts +105 -4
  85. package/src/tui.ts +147 -9
@@ -0,0 +1,44 @@
1
+ You are a title generator. You output ONLY a thread title. Nothing else.
2
+
3
+ <task>
4
+ Generate a brief title that would help the user find this conversation later.
5
+
6
+ Follow all rules in <rules>
7
+ Use the <examples> so you know what a good title looks like.
8
+ Your output must be:
9
+ - A single line
10
+ - ≤50 characters
11
+ - No explanations
12
+ </task>
13
+
14
+ <rules>
15
+ - you MUST use the same language as the user message you are summarizing
16
+ - Title must be grammatically correct and read naturally - no word salad
17
+ - Never include tool names in the title (e.g. "read tool", "bash tool", "edit tool")
18
+ - Focus on the main topic or question the user needs to retrieve
19
+ - Vary your phrasing - avoid repetitive patterns like always starting with "Analyzing"
20
+ - When a file is mentioned, focus on WHAT the user wants to do WITH the file, not just that they shared it
21
+ - Keep exact: technical terms, numbers, filenames, HTTP codes
22
+ - Remove: the, this, my, a, an
23
+ - Never assume tech stack
24
+ - Never use tools
25
+ - NEVER respond to questions, just generate a title for the conversation
26
+ - The title should NEVER include "summarizing" or "generating" when generating a title
27
+ - DO NOT SAY YOU CANNOT GENERATE A TITLE OR COMPLAIN ABOUT THE INPUT
28
+ - Always output something meaningful, even if the input is minimal.
29
+ - If the user message is short or conversational (e.g. "hello", "lol", "what's up", "hey"):
30
+ → create a title that reflects the user's tone or intent (such as Greeting, Quick check-in, Light chat, Intro message, etc.)
31
+ </rules>
32
+
33
+ <examples>
34
+ "debug 500 errors in production" → Debugging production 500 errors
35
+ "refactor user service" → Refactoring user service
36
+ "why is app.js failing" → app.js failure investigation
37
+ "implement rate limiting" → Rate limiting implementation
38
+ "how do I connect postgres to my API" → Postgres API connection
39
+ "best practices for React hooks" → React hooks best practices
40
+ "@src/auth.ts can you add refresh token support" → Auth refresh token support
41
+ "@utils/parser.ts this is broken" → Parser bug fix
42
+ "look at @config.json" → Config review
43
+ "@App.tsx add dark mode toggle" → Dark mode toggle in App
44
+ </examples>
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Autonomous Build Mode — small-model-friendly project orchestrator
3
+ *
4
+ * Why: small/local models (8-20B) struggle with open-ended "build me X" prompts.
5
+ * They produce prose, hallucinate edits, and forget what they were doing across
6
+ * turns. This module replaces the single-turn agent loop with a deterministic
7
+ * state machine that drives the model through narrow, focused stages.
8
+ *
9
+ * State flow:
10
+ *
11
+ * ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
12
+ * │ CLARIFY │ ──▶ │ PLAN │ ──▶ │ EXECUTE │ ──▶ │ VERIFY │
13
+ * │ (Q&A) │ │ (todos) │ │ (loop) │ │ (yes/no) │
14
+ * └──────────┘ └──────────┘ └─────┬────┘ └─────┬────┘
15
+ * │ │
16
+ * ▼ ▼
17
+ * ┌────────┐ ┌────────┐
18
+ * │ DONE │ ◀──── │ all ok │
19
+ * └────────┘ └────────┘
20
+ * │
21
+ * │ failures
22
+ * ▼
23
+ * back to PLAN
24
+ *
25
+ * Each stage uses a tightly scoped prompt with a structured-output requirement
26
+ * (JSON we parse deterministically). The agent's natural "describe what I'd do"
27
+ * tendency is replaced by short, mechanical answers.
28
+ *
29
+ * State is persisted to the sessions table (in build_state JSON column) so
30
+ * the loop can resume across restarts and is visible to the user via the UI.
31
+ */
32
+ export type BuildStage = "clarify" | "plan" | "execute" | "verify" | "done" | "failed";
33
+ export interface DesignDoc {
34
+ goal: string;
35
+ requirements: string[];
36
+ constraints: string[];
37
+ artifacts: string[];
38
+ }
39
+ export interface BuildTodo {
40
+ id: string;
41
+ title: string;
42
+ description: string;
43
+ status: "pending" | "in_progress" | "completed" | "failed";
44
+ failure_count: number;
45
+ evidence?: string;
46
+ }
47
+ export interface BuildState {
48
+ stage: BuildStage;
49
+ original_prompt: string;
50
+ design: DesignDoc | null;
51
+ todos: BuildTodo[];
52
+ iteration: number;
53
+ max_iterations: number;
54
+ pending_clarification?: string;
55
+ verification_results?: VerificationResult[];
56
+ error?: string;
57
+ /** Set after probe: whether the model can emit OpenAI-format tool calls. */
58
+ tool_capable?: boolean;
59
+ }
60
+ export interface VerificationResult {
61
+ requirement: string;
62
+ satisfied: boolean;
63
+ evidence: string;
64
+ }
65
+ export interface BuildModeInput {
66
+ session_id: string;
67
+ message_id: string;
68
+ prompt: string;
69
+ model_id: string;
70
+ provider_id: string;
71
+ }
72
+ /**
73
+ * Called when the user has answered the clarification questions.
74
+ * Combines the original prompt + answers into a finalized design.
75
+ */
76
+ export declare function continueAfterClarification(session_id: string, user_answer: string, model_id: string, provider_id: string): Promise<BuildState | null>;
77
+ export declare function runBuildMode(input: BuildModeInput): Promise<BuildState>;
78
+ /**
79
+ * Heuristic: should this prompt go through build mode rather than the
80
+ * regular agent loop? Build-mode prompts are project-scoped — "build me",
81
+ * "create a", "design and implement", "make a full" — vs ad-hoc questions.
82
+ */
83
+ export declare function isBuildPrompt(prompt: string): boolean;