@autonav/core 1.5.0 → 1.7.0

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 (238) hide show
  1. package/README.md +2 -2
  2. package/dist/adapter/index.d.ts +3 -3
  3. package/dist/adapter/index.d.ts.map +1 -1
  4. package/dist/adapter/index.js +3 -3
  5. package/dist/adapter/index.js.map +1 -1
  6. package/dist/adapter/navigator-adapter.d.ts +196 -0
  7. package/dist/adapter/navigator-adapter.d.ts.map +1 -0
  8. package/dist/adapter/navigator-adapter.js +579 -0
  9. package/dist/adapter/navigator-adapter.js.map +1 -0
  10. package/dist/cli/autonav.d.ts +2 -5
  11. package/dist/cli/autonav.d.ts.map +1 -1
  12. package/dist/cli/autonav.js +35 -49
  13. package/dist/cli/autonav.js.map +1 -1
  14. package/dist/cli/nav-chat.d.ts +2 -1
  15. package/dist/cli/nav-chat.d.ts.map +1 -1
  16. package/dist/cli/nav-chat.js +32 -3
  17. package/dist/cli/nav-chat.js.map +1 -1
  18. package/dist/cli/nav-init.d.ts +2 -1
  19. package/dist/cli/nav-init.d.ts.map +1 -1
  20. package/dist/cli/nav-init.js +12 -4
  21. package/dist/cli/nav-init.js.map +1 -1
  22. package/dist/cli/nav-install.d.ts +2 -1
  23. package/dist/cli/nav-install.d.ts.map +1 -1
  24. package/dist/cli/nav-install.js +4 -2
  25. package/dist/cli/nav-install.js.map +1 -1
  26. package/dist/cli/nav-memento.d.ts +21 -0
  27. package/dist/cli/nav-memento.d.ts.map +1 -0
  28. package/dist/cli/nav-memento.js +185 -0
  29. package/dist/cli/nav-memento.js.map +1 -0
  30. package/dist/cli/nav-mend.d.ts +2 -1
  31. package/dist/cli/nav-mend.d.ts.map +1 -1
  32. package/dist/cli/nav-mend.js +4 -1
  33. package/dist/cli/nav-mend.js.map +1 -1
  34. package/dist/cli/nav-migrate.d.ts +2 -1
  35. package/dist/cli/nav-migrate.d.ts.map +1 -1
  36. package/dist/cli/nav-migrate.js +2 -6
  37. package/dist/cli/nav-migrate.js.map +1 -1
  38. package/dist/cli/nav-query.d.ts +2 -1
  39. package/dist/cli/nav-query.d.ts.map +1 -1
  40. package/dist/cli/nav-query.js +12 -6
  41. package/dist/cli/nav-query.js.map +1 -1
  42. package/dist/cli/nav-standup.d.ts +18 -0
  43. package/dist/cli/nav-standup.d.ts.map +1 -0
  44. package/dist/cli/nav-standup.js +151 -0
  45. package/dist/cli/nav-standup.js.map +1 -0
  46. package/dist/cli/nav-uninstall.d.ts +2 -1
  47. package/dist/cli/nav-uninstall.d.ts.map +1 -1
  48. package/dist/cli/nav-uninstall.js +4 -2
  49. package/dist/cli/nav-uninstall.js.map +1 -1
  50. package/dist/cli/nav-update.d.ts +2 -1
  51. package/dist/cli/nav-update.d.ts.map +1 -1
  52. package/dist/cli/nav-update.js +11 -6
  53. package/dist/cli/nav-update.js.map +1 -1
  54. package/dist/conversation/App.d.ts +9 -2
  55. package/dist/conversation/App.d.ts.map +1 -1
  56. package/dist/conversation/App.js +304 -111
  57. package/dist/conversation/App.js.map +1 -1
  58. package/dist/conversation/index.d.ts +5 -0
  59. package/dist/conversation/index.d.ts.map +1 -1
  60. package/dist/conversation/index.js +17 -2
  61. package/dist/conversation/index.js.map +1 -1
  62. package/dist/harness/chibi-harness.d.ts +36 -0
  63. package/dist/harness/chibi-harness.d.ts.map +1 -0
  64. package/dist/harness/chibi-harness.js +383 -0
  65. package/dist/harness/chibi-harness.js.map +1 -0
  66. package/dist/harness/chibi-plugins/get_plugin_config +64 -0
  67. package/dist/harness/chibi-plugins/query_navigator +114 -0
  68. package/dist/harness/chibi-plugins/submit_answer +38 -0
  69. package/dist/harness/chibi-plugins/update_plugin_config +91 -0
  70. package/dist/harness/claude-code-harness.d.ts +24 -0
  71. package/dist/harness/claude-code-harness.d.ts.map +1 -0
  72. package/dist/harness/claude-code-harness.js +242 -0
  73. package/dist/harness/claude-code-harness.js.map +1 -0
  74. package/dist/harness/ephemeral-home.d.ts +34 -0
  75. package/dist/harness/ephemeral-home.d.ts.map +1 -0
  76. package/dist/harness/ephemeral-home.js +56 -0
  77. package/dist/harness/ephemeral-home.js.map +1 -0
  78. package/dist/harness/factory.d.ts +47 -0
  79. package/dist/harness/factory.d.ts.map +1 -0
  80. package/dist/harness/factory.js +84 -0
  81. package/dist/harness/factory.js.map +1 -0
  82. package/dist/harness/helpers.d.ts +58 -0
  83. package/dist/harness/helpers.d.ts.map +1 -0
  84. package/dist/harness/helpers.js +78 -0
  85. package/dist/harness/helpers.js.map +1 -0
  86. package/dist/harness/index.d.ts +14 -0
  87. package/dist/harness/index.d.ts.map +1 -0
  88. package/dist/harness/index.js +13 -0
  89. package/dist/harness/index.js.map +1 -0
  90. package/dist/harness/opencode-harness.d.ts +79 -0
  91. package/dist/harness/opencode-harness.d.ts.map +1 -0
  92. package/dist/harness/opencode-harness.js +537 -0
  93. package/dist/harness/opencode-harness.js.map +1 -0
  94. package/dist/harness/opencode-tools/get_plugin_config.ts +72 -0
  95. package/dist/harness/opencode-tools/query_navigator.ts +126 -0
  96. package/dist/harness/opencode-tools/submit_answer.ts +40 -0
  97. package/dist/harness/opencode-tools/update_plugin_config.ts +105 -0
  98. package/dist/harness/sandbox.d.ts +59 -0
  99. package/dist/harness/sandbox.d.ts.map +1 -0
  100. package/dist/harness/sandbox.js +152 -0
  101. package/dist/harness/sandbox.js.map +1 -0
  102. package/dist/harness/tool-server.d.ts +50 -0
  103. package/dist/harness/tool-server.d.ts.map +1 -0
  104. package/dist/harness/tool-server.js +27 -0
  105. package/dist/harness/tool-server.js.map +1 -0
  106. package/dist/harness/types.d.ts +168 -0
  107. package/dist/harness/types.d.ts.map +1 -0
  108. package/dist/harness/types.js +12 -0
  109. package/dist/harness/types.js.map +1 -0
  110. package/dist/index.d.ts +3 -2
  111. package/dist/index.d.ts.map +1 -1
  112. package/dist/index.js +4 -2
  113. package/dist/index.js.map +1 -1
  114. package/dist/interview/App.d.ts +4 -2
  115. package/dist/interview/App.d.ts.map +1 -1
  116. package/dist/interview/App.js +36 -56
  117. package/dist/interview/App.js.map +1 -1
  118. package/dist/interview/index.d.ts +3 -0
  119. package/dist/interview/index.d.ts.map +1 -1
  120. package/dist/interview/index.js +1 -0
  121. package/dist/interview/index.js.map +1 -1
  122. package/dist/interview/prompts.d.ts +3 -1
  123. package/dist/interview/prompts.d.ts.map +1 -1
  124. package/dist/interview/prompts.js +5 -1
  125. package/dist/interview/prompts.js.map +1 -1
  126. package/dist/interview/ui/ChatBanner.d.ts +17 -0
  127. package/dist/interview/ui/ChatBanner.d.ts.map +1 -0
  128. package/dist/interview/ui/ChatBanner.js +30 -0
  129. package/dist/interview/ui/ChatBanner.js.map +1 -0
  130. package/dist/interview/ui/ChatInput.d.ts +36 -0
  131. package/dist/interview/ui/ChatInput.d.ts.map +1 -0
  132. package/dist/interview/ui/ChatInput.js +304 -0
  133. package/dist/interview/ui/ChatInput.js.map +1 -0
  134. package/dist/interview/ui/MarkdownText.d.ts +13 -0
  135. package/dist/interview/ui/MarkdownText.d.ts.map +1 -0
  136. package/dist/interview/ui/MarkdownText.js +107 -0
  137. package/dist/interview/ui/MarkdownText.js.map +1 -0
  138. package/dist/interview/ui/index.d.ts +3 -0
  139. package/dist/interview/ui/index.d.ts.map +1 -1
  140. package/dist/interview/ui/index.js +3 -0
  141. package/dist/interview/ui/index.js.map +1 -1
  142. package/dist/memento/git-operations.d.ts +95 -0
  143. package/dist/memento/git-operations.d.ts.map +1 -0
  144. package/dist/memento/git-operations.js +256 -0
  145. package/dist/memento/git-operations.js.map +1 -0
  146. package/dist/memento/implementer-agent.d.ts +31 -0
  147. package/dist/memento/implementer-agent.d.ts.map +1 -0
  148. package/dist/memento/implementer-agent.js +95 -0
  149. package/dist/memento/implementer-agent.js.map +1 -0
  150. package/dist/memento/index.d.ts +32 -0
  151. package/dist/memento/index.d.ts.map +1 -0
  152. package/dist/memento/index.js +40 -0
  153. package/dist/memento/index.js.map +1 -0
  154. package/dist/memento/loop.d.ts +34 -0
  155. package/dist/memento/loop.d.ts.map +1 -0
  156. package/dist/memento/loop.js +1227 -0
  157. package/dist/memento/loop.js.map +1 -0
  158. package/dist/memento/matrix-animation.d.ts +103 -0
  159. package/dist/memento/matrix-animation.d.ts.map +1 -0
  160. package/dist/memento/matrix-animation.js +303 -0
  161. package/dist/memento/matrix-animation.js.map +1 -0
  162. package/dist/memento/nav-protocol.d.ts +30 -0
  163. package/dist/memento/nav-protocol.d.ts.map +1 -0
  164. package/dist/memento/nav-protocol.js +75 -0
  165. package/dist/memento/nav-protocol.js.map +1 -0
  166. package/dist/memento/prompts.d.ts +57 -0
  167. package/dist/memento/prompts.d.ts.map +1 -0
  168. package/dist/memento/prompts.js +208 -0
  169. package/dist/memento/prompts.js.map +1 -0
  170. package/dist/memento/rate-limit.d.ts +85 -0
  171. package/dist/memento/rate-limit.d.ts.map +1 -0
  172. package/dist/memento/rate-limit.js +221 -0
  173. package/dist/memento/rate-limit.js.map +1 -0
  174. package/dist/memento/types.d.ts +123 -0
  175. package/dist/memento/types.d.ts.map +1 -0
  176. package/dist/memento/types.js +30 -0
  177. package/dist/memento/types.js.map +1 -0
  178. package/dist/memento/worker-agent.d.ts +33 -0
  179. package/dist/memento/worker-agent.d.ts.map +1 -0
  180. package/dist/memento/worker-agent.js +93 -0
  181. package/dist/memento/worker-agent.js.map +1 -0
  182. package/dist/registry.d.ts +35 -0
  183. package/dist/registry.d.ts.map +1 -0
  184. package/dist/registry.js +87 -0
  185. package/dist/registry.js.map +1 -0
  186. package/dist/repo-analyzer/index.d.ts +2 -1
  187. package/dist/repo-analyzer/index.d.ts.map +1 -1
  188. package/dist/repo-analyzer/index.js +6 -17
  189. package/dist/repo-analyzer/index.js.map +1 -1
  190. package/dist/standup/config.d.ts +19 -0
  191. package/dist/standup/config.d.ts.map +1 -0
  192. package/dist/standup/config.js +42 -0
  193. package/dist/standup/config.js.map +1 -0
  194. package/dist/standup/index.d.ts +24 -0
  195. package/dist/standup/index.d.ts.map +1 -0
  196. package/dist/standup/index.js +29 -0
  197. package/dist/standup/index.js.map +1 -0
  198. package/dist/standup/loop.d.ts +36 -0
  199. package/dist/standup/loop.d.ts.map +1 -0
  200. package/dist/standup/loop.js +508 -0
  201. package/dist/standup/loop.js.map +1 -0
  202. package/dist/standup/prompts.d.ts +62 -0
  203. package/dist/standup/prompts.d.ts.map +1 -0
  204. package/dist/standup/prompts.js +211 -0
  205. package/dist/standup/prompts.js.map +1 -0
  206. package/dist/standup/standup-protocol.d.ts +33 -0
  207. package/dist/standup/standup-protocol.d.ts.map +1 -0
  208. package/dist/standup/standup-protocol.js +189 -0
  209. package/dist/standup/standup-protocol.js.map +1 -0
  210. package/dist/standup/types.d.ts +185 -0
  211. package/dist/standup/types.d.ts.map +1 -0
  212. package/dist/standup/types.js +67 -0
  213. package/dist/standup/types.js.map +1 -0
  214. package/dist/tools/cross-nav.d.ts +21 -0
  215. package/dist/tools/cross-nav.d.ts.map +1 -0
  216. package/dist/tools/cross-nav.js +93 -0
  217. package/dist/tools/cross-nav.js.map +1 -0
  218. package/dist/tools/index.d.ts +1 -0
  219. package/dist/tools/index.d.ts.map +1 -1
  220. package/dist/tools/index.js +1 -0
  221. package/dist/tools/index.js.map +1 -1
  222. package/dist/tools/related-navs-config.d.ts +15 -0
  223. package/dist/tools/related-navs-config.d.ts.map +1 -0
  224. package/dist/tools/related-navs-config.js +132 -0
  225. package/dist/tools/related-navs-config.js.map +1 -0
  226. package/dist/tools/related-navs.d.ts +23 -0
  227. package/dist/tools/related-navs.d.ts.map +1 -0
  228. package/dist/tools/related-navs.js +107 -0
  229. package/dist/tools/related-navs.js.map +1 -0
  230. package/dist/tools/response.d.ts +3 -2
  231. package/dist/tools/response.d.ts.map +1 -1
  232. package/dist/tools/response.js +7 -11
  233. package/dist/tools/response.js.map +1 -1
  234. package/dist/tools/self-config.d.ts +2 -1
  235. package/dist/tools/self-config.d.ts.map +1 -1
  236. package/dist/tools/self-config.js +5 -9
  237. package/dist/tools/self-config.js.map +1 -1
  238. package/package.json +4 -1
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Prompts for Memento Loop
3
+ *
4
+ * System prompts and user prompts for navigator and implementer agents.
5
+ * Uses shared Agent Identity Protocol from communication-layer.
6
+ *
7
+ * Design principle: The IMPLEMENTER forgets between iterations (memento pattern).
8
+ * The NAVIGATOR maintains its own memory and knowledge base - we just provide
9
+ * git history as context about what the implementer has accomplished so far.
10
+ */
11
+ import { type NavigatorIdentity } from "@autonav/communication-layer";
12
+ import type { ImplementationPlan } from "./types.js";
13
+ export type { NavigatorIdentity };
14
+ /**
15
+ * Minimal context passed to nav prompt (no persisted state)
16
+ */
17
+ interface NavPromptContext {
18
+ codeDirectory: string;
19
+ task: string;
20
+ iteration: number;
21
+ maxIterations: number;
22
+ branch?: string;
23
+ }
24
+ /**
25
+ * Build the prompt for the navigator to provide an implementation plan
26
+ *
27
+ * Uses Agent Identity Protocol when navigator identity is available.
28
+ * Git history is provided as context about what the implementer has done,
29
+ * but the navigator maintains its own knowledge and memory.
30
+ */
31
+ export declare function buildNavPlanPrompt(context: NavPromptContext, gitLog: string, navigatorIdentity?: NavigatorIdentity | null): string;
32
+ /**
33
+ * Build the system prompt for the navigator agent
34
+ */
35
+ export declare function buildNavSystemPrompt(navSystemPrompt: string): string;
36
+ /**
37
+ * Build the prompt for the implementer agent to implement a plan
38
+ */
39
+ export declare function buildImplementerPrompt(codeDirectory: string, plan: ImplementationPlan): string;
40
+ /**
41
+ * Build the system prompt for the implementer agent
42
+ */
43
+ export declare function buildImplementerSystemPrompt(codeDirectory: string): string;
44
+ /**
45
+ * Build the prompt for the reviewer (navigator/opus) to review a diff.
46
+ * Single-turn, no tools — just read the diff and respond.
47
+ */
48
+ export declare function buildReviewPrompt(diff: string): string;
49
+ /**
50
+ * Build the prompt for the fixer (implementer/haiku) to fix review issues.
51
+ */
52
+ export declare function buildFixPrompt(codeDirectory: string, reviewResult: string): string;
53
+ /**
54
+ * Build the system prompt for the fixer agent
55
+ */
56
+ export declare function buildFixSystemPrompt(codeDirectory: string): string;
57
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/memento/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGrD,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC;;GAEG;AACH,UAAU,gBAAgB;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,MAAM,EACd,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,IAAI,GAC3C,MAAM,CAoDR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAqBpE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,kBAAkB,GACvB,MAAM,CA4BR;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAsB1E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmBtD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,GACnB,MAAM,CAeR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAgBlE"}
@@ -0,0 +1,208 @@
1
+ /**
2
+ * Prompts for Memento Loop
3
+ *
4
+ * System prompts and user prompts for navigator and implementer agents.
5
+ * Uses shared Agent Identity Protocol from communication-layer.
6
+ *
7
+ * Design principle: The IMPLEMENTER forgets between iterations (memento pattern).
8
+ * The NAVIGATOR maintains its own memory and knowledge base - we just provide
9
+ * git history as context about what the implementer has accomplished so far.
10
+ */
11
+ import { buildAgentIdentityProtocol, } from "@autonav/communication-layer";
12
+ /**
13
+ * Build the prompt for the navigator to provide an implementation plan
14
+ *
15
+ * Uses Agent Identity Protocol when navigator identity is available.
16
+ * Git history is provided as context about what the implementer has done,
17
+ * but the navigator maintains its own knowledge and memory.
18
+ */
19
+ export function buildNavPlanPrompt(context, gitLog, navigatorIdentity) {
20
+ const iterationInfo = context.maxIterations > 0
21
+ ? `Iteration ${context.iteration} of ${context.maxIterations}`
22
+ : `Iteration ${context.iteration}`;
23
+ // Agent Identity Protocol: Explicit role identification and mutual acknowledgment
24
+ const identityProtocol = buildAgentIdentityProtocol(navigatorIdentity, {
25
+ name: "Autonav Memento Loop",
26
+ request: "The memento loop is coordinating implementation work on behalf of the user. Please provide the next implementation plan using the `submit_implementation_plan` tool.",
27
+ });
28
+ return `${identityProtocol}# Memento Loop - Planning Phase
29
+
30
+ You are the **Navigator** guiding a memento loop. Your job is to provide the next implementation plan for the worker agent.
31
+
32
+ ## Task
33
+
34
+ ${context.task}
35
+
36
+ ## Current State
37
+
38
+ - **${iterationInfo}**
39
+ - **Code Directory:** ${context.codeDirectory}
40
+ - **Branch:** ${context.branch || "(default branch)"}
41
+
42
+ ## Recent Git History (Implementer's Progress)
43
+
44
+ The implementer agent has made the following commits. Use this to understand what has been implemented so far:
45
+
46
+ \`\`\`
47
+ ${gitLog || "(No commits yet)"}
48
+ \`\`\`
49
+
50
+ ## Instructions
51
+
52
+ 1. **Analyze** the current state - you may explore the codebase, consult your knowledge base, or use any resources you have
53
+ 2. **Determine** what work remains to complete the task
54
+ 3. **Create** a focused implementation plan for the next iteration
55
+ 4. **Use the submit_implementation_plan tool** to submit your plan
56
+
57
+ ### About the Memento Loop
58
+
59
+ - The **implementer agent forgets** between iterations (it has no memory of previous work)
60
+ - **You** (the navigator) maintain continuity - use your knowledge and judgment
61
+ - The git history shows what the implementer has accomplished so far
62
+ - Keep plans focused and incremental - the implementer implements one plan at a time
63
+ - Set \`isComplete: true\` when the entire task is done
64
+ - The implementer agent will implement your plan, not you
65
+
66
+ Submit your implementation plan now using the \`submit_implementation_plan\` tool.`;
67
+ }
68
+ /**
69
+ * Build the system prompt for the navigator agent
70
+ */
71
+ export function buildNavSystemPrompt(navSystemPrompt) {
72
+ return `${navSystemPrompt}
73
+
74
+ # Memento Loop Navigator Role
75
+
76
+ You are acting as the **Navigator** in a memento loop. Your responsibilities:
77
+
78
+ 1. **Analyze** the current state of the codebase
79
+ 2. **Plan** the next implementation steps
80
+ 3. **Submit** structured plans via the \`submit_implementation_plan\` tool
81
+ 4. **Determine** when the task is complete
82
+
83
+ You do NOT implement code yourself. You provide plans for the worker agent.
84
+
85
+ ## Key Principles
86
+
87
+ - Be specific and actionable in your plans
88
+ - Reference concrete files and commands
89
+ - Include clear validation criteria
90
+ - Only mark complete when ALL requirements are met
91
+ - Use conventional commit style for plan summaries (e.g., "feat: add user auth", "fix: resolve login bug")`;
92
+ }
93
+ /**
94
+ * Build the prompt for the implementer agent to implement a plan
95
+ */
96
+ export function buildImplementerPrompt(codeDirectory, plan) {
97
+ const stepsText = plan.steps
98
+ .map((step, i) => `### Step ${i + 1}: ${step.description}
99
+ ${step.files?.length ? `- Files: ${step.files.join(", ")}` : ""}
100
+ ${step.commands?.length ? `- Commands: ${step.commands.join(", ")}` : ""}`)
101
+ .join("\n\n");
102
+ return `# Implementation Task
103
+
104
+ ## Plan Summary
105
+
106
+ ${plan.summary}
107
+
108
+ ## Steps to Implement
109
+
110
+ ${stepsText}
111
+
112
+ ## Instructions
113
+
114
+ 1. Implement each step in order
115
+ 2. Report what you accomplished
116
+
117
+ **Working Directory:** ${codeDirectory}
118
+
119
+ Begin implementation now.`;
120
+ }
121
+ /**
122
+ * Build the system prompt for the implementer agent
123
+ */
124
+ export function buildImplementerSystemPrompt(codeDirectory) {
125
+ return `You are an **Implementer Agent** implementing code changes.
126
+
127
+ ## Your Role
128
+
129
+ You receive implementation plans from the Navigator and execute them precisely.
130
+
131
+ ## Guidelines
132
+
133
+ 1. **Execute** each step in the plan
134
+ 2. **Report** what you accomplished
135
+
136
+ ## Working Directory
137
+
138
+ All file paths are relative to: ${codeDirectory}
139
+
140
+ ## Important
141
+
142
+ - Focus on implementing the plan, not redesigning it
143
+ - If something is unclear, make reasonable assumptions
144
+ - Report any blockers or issues clearly
145
+ - Do not add features beyond what the plan specifies`;
146
+ }
147
+ /**
148
+ * Build the prompt for the reviewer (navigator/opus) to review a diff.
149
+ * Single-turn, no tools — just read the diff and respond.
150
+ */
151
+ export function buildReviewPrompt(diff) {
152
+ const truncatedDiff = diff.length > 8000 ? diff.substring(0, 8000) + "\n... (truncated)" : diff;
153
+ return `Review the following diff for bugs, correctness issues, or missing error handling. Do NOT use any tools — just read the diff and respond.
154
+
155
+ Respond in EXACTLY one of these formats:
156
+
157
+ If no issues: Reply with only "LGTM"
158
+
159
+ If issues found: Reply with a bullet list, one issue per line:
160
+ - [file:line] Issue description. Fix: what to do.
161
+ - [file:line] Issue description. Fix: what to do.
162
+
163
+ Do NOT suggest style improvements, refactors, or nice-to-haves. Only flag things that are bugs or will cause runtime errors.
164
+
165
+ \`\`\`diff
166
+ ${truncatedDiff}
167
+ \`\`\``;
168
+ }
169
+ /**
170
+ * Build the prompt for the fixer (implementer/haiku) to fix review issues.
171
+ */
172
+ export function buildFixPrompt(codeDirectory, reviewResult) {
173
+ return `# Fix Review Issues
174
+
175
+ Fix the following issues found during code review:
176
+
177
+ ${reviewResult}
178
+
179
+ ## Instructions
180
+
181
+ 1. Fix each issue listed above
182
+ 2. Report what you fixed
183
+
184
+ **Working Directory:** ${codeDirectory}
185
+
186
+ Begin fixing now.`;
187
+ }
188
+ /**
189
+ * Build the system prompt for the fixer agent
190
+ */
191
+ export function buildFixSystemPrompt(codeDirectory) {
192
+ return `You are a **Code Fixer Agent** fixing issues found during code review.
193
+
194
+ ## Your Role
195
+
196
+ You receive a list of issues from a code reviewer and fix them precisely.
197
+
198
+ ## Working Directory
199
+
200
+ All file paths are relative to: ${codeDirectory}
201
+
202
+ ## Important
203
+
204
+ - Fix only the issues listed — do not refactor or add features
205
+ - If something is unclear, make a reasonable assumption
206
+ - Report what you fixed`;
207
+ }
208
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/memento/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,0BAA0B,GAE3B,MAAM,8BAA8B,CAAC;AAiBtC;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAyB,EACzB,MAAc,EACd,iBAA4C;IAE5C,MAAM,aAAa,GACjB,OAAO,CAAC,aAAa,GAAG,CAAC;QACvB,CAAC,CAAC,aAAa,OAAO,CAAC,SAAS,OAAO,OAAO,CAAC,aAAa,EAAE;QAC9D,CAAC,CAAC,aAAa,OAAO,CAAC,SAAS,EAAE,CAAC;IAEvC,kFAAkF;IAClF,MAAM,gBAAgB,GAAG,0BAA0B,CAAC,iBAAiB,EAAE;QACrE,IAAI,EAAE,sBAAsB;QAC5B,OAAO,EACL,sKAAsK;KACzK,CAAC,CAAC;IAEH,OAAO,GAAG,gBAAgB;;;;;;EAM1B,OAAO,CAAC,IAAI;;;;MAIR,aAAa;wBACK,OAAO,CAAC,aAAa;gBAC7B,OAAO,CAAC,MAAM,IAAI,kBAAkB;;;;;;;EAOlD,MAAM,IAAI,kBAAkB;;;;;;;;;;;;;;;;;;;mFAmBqD,CAAC;AACpF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,eAAuB;IAC1D,OAAO,GAAG,eAAe;;;;;;;;;;;;;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EG;AACH,MAAM,UAAU,oBAAoB,CAAC,aAAqB;IACxD,OAAO;;;;;;;;kCAQyB,aAAa;;;;;;wBAMvB,CAAC;AACzB,CAAC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Rate Limit Handling for Memento Loop
3
+ *
4
+ * Detects rate limits and implements retry with countdown.
5
+ */
6
+ /**
7
+ * Parsed rate limit info from an error message
8
+ */
9
+ export interface RateLimitInfo {
10
+ /** Whether this is a rate limit error */
11
+ isRateLimited: boolean;
12
+ /** Parsed reset time if available */
13
+ resetTime?: Date;
14
+ /** Raw reset time string from error */
15
+ resetTimeRaw?: string;
16
+ /** Seconds until reset (if we could calculate it) */
17
+ secondsUntilReset?: number;
18
+ }
19
+ /**
20
+ * Parse a rate limit error message to extract reset time
21
+ *
22
+ * Looks for patterns like:
23
+ * - "resets Feb 4, 9pm"
24
+ * - "resets in 2 hours"
25
+ * - "try again at 2026-02-04T21:00:00Z"
26
+ * - "retry after 3600 seconds"
27
+ */
28
+ export declare function parseRateLimitError(errorMessage: string): RateLimitInfo;
29
+ /**
30
+ * Format seconds as human-readable duration
31
+ */
32
+ export declare function formatDuration(seconds: number): string;
33
+ /**
34
+ * Maximum wait time: 4 hours (just under session limit window)
35
+ */
36
+ export declare const MAX_WAIT_SECONDS: number;
37
+ /**
38
+ * Exponential backoff delays (in seconds), capped at 4h
39
+ */
40
+ export declare const BACKOFF_DELAYS: number[];
41
+ /**
42
+ * Get the backoff delay for a given retry attempt
43
+ */
44
+ export declare function getBackoffDelay(attempt: number): number;
45
+ /**
46
+ * Sleep for a given number of milliseconds
47
+ */
48
+ export declare function sleep(ms: number): Promise<void>;
49
+ /**
50
+ * Wait with countdown display
51
+ *
52
+ * @param seconds - Seconds to wait
53
+ * @param onTick - Called every second with remaining time
54
+ * @returns Promise that resolves when wait is complete
55
+ */
56
+ export declare function waitWithCountdown(seconds: number, onTick?: (remaining: number, formatted: string) => void): Promise<void>;
57
+ /**
58
+ * Print rate limit waiting message
59
+ */
60
+ export declare function printRateLimitWait(info: RateLimitInfo, attempt: number): void;
61
+ /**
62
+ * Check if an error is a transient connection error worth retrying.
63
+ * These are common on flaky networks, CGNAT, or when connections go stale.
64
+ */
65
+ export declare function isTransientConnectionError(errorMessage: string): boolean;
66
+ /** Short delays for connection retries (seconds) — no need to wait long */
67
+ export declare const CONNECTION_RETRY_DELAYS: number[];
68
+ /**
69
+ * Get retry delay for a connection error attempt
70
+ */
71
+ export declare function getConnectionRetryDelay(attempt: number): number;
72
+ /**
73
+ * Configuration for rate limit retry behavior
74
+ */
75
+ export interface RateLimitRetryConfig {
76
+ /** Maximum number of retry attempts (default: 4) */
77
+ maxRetries?: number;
78
+ /** Whether to use parsed reset time or always use backoff (default: true) */
79
+ useResetTime?: boolean;
80
+ /** Callback for countdown updates */
81
+ onCountdown?: (remaining: number, formatted: string) => void;
82
+ /** Callback when rate limit is detected */
83
+ onRateLimited?: (info: RateLimitInfo, attempt: number) => void;
84
+ }
85
+ //# sourceMappingURL=rate-limit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../../src/memento/rate-limit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,aAAa,EAAE,OAAO,CAAC;IACvB,qCAAqC;IACrC,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,CA6EvE;AAsCD;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAYtD;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAc,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,cAAc,UAM1B,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,GACtD,OAAO,CAAC,IAAI,CAAC,CAUf;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAU7E;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAiBxE;AAED,2EAA2E;AAC3E,eAAO,MAAM,uBAAuB,UAMnC,CAAC;AAEF;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG/D;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qCAAqC;IACrC,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,2CAA2C;IAC3C,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAChE"}
@@ -0,0 +1,221 @@
1
+ /**
2
+ * Rate Limit Handling for Memento Loop
3
+ *
4
+ * Detects rate limits and implements retry with countdown.
5
+ */
6
+ import chalk from "chalk";
7
+ /**
8
+ * Parse a rate limit error message to extract reset time
9
+ *
10
+ * Looks for patterns like:
11
+ * - "resets Feb 4, 9pm"
12
+ * - "resets in 2 hours"
13
+ * - "try again at 2026-02-04T21:00:00Z"
14
+ * - "retry after 3600 seconds"
15
+ */
16
+ export function parseRateLimitError(errorMessage) {
17
+ const lowerMessage = errorMessage.toLowerCase();
18
+ // Check if this is a rate limit error
19
+ const isRateLimited = lowerMessage.includes("rate limit") ||
20
+ lowerMessage.includes("rate_limit") ||
21
+ lowerMessage.includes("usage limit") ||
22
+ lowerMessage.includes("limit reached") ||
23
+ lowerMessage.includes("you've hit your limit");
24
+ if (!isRateLimited) {
25
+ return { isRateLimited: false };
26
+ }
27
+ // Try to parse reset time
28
+ let resetTime;
29
+ let resetTimeRaw;
30
+ let secondsUntilReset;
31
+ // Pattern: "resets Feb 4, 9pm" or "resets February 4, 9:00 PM"
32
+ const resetsDateMatch = errorMessage.match(/resets?\s+([A-Za-z]+\s+\d{1,2},?\s+\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/i);
33
+ if (resetsDateMatch?.[1]) {
34
+ resetTimeRaw = resetsDateMatch[1];
35
+ const parsed = parseFuzzyDateTime(resetTimeRaw);
36
+ if (parsed) {
37
+ resetTime = parsed;
38
+ secondsUntilReset = Math.max(0, Math.floor((parsed.getTime() - Date.now()) / 1000));
39
+ }
40
+ }
41
+ // Pattern: "resets in X hours/minutes"
42
+ const resetsInMatch = errorMessage.match(/resets?\s+in\s+(\d+)\s*(hours?|minutes?|mins?|hrs?|seconds?|secs?)/i);
43
+ if (resetsInMatch && !resetTime) {
44
+ const amount = parseInt(resetsInMatch[1], 10);
45
+ const unit = resetsInMatch[2].toLowerCase();
46
+ let seconds = amount;
47
+ if (unit.startsWith("hour") || unit.startsWith("hr")) {
48
+ seconds = amount * 3600;
49
+ }
50
+ else if (unit.startsWith("min")) {
51
+ seconds = amount * 60;
52
+ }
53
+ secondsUntilReset = seconds;
54
+ resetTime = new Date(Date.now() + seconds * 1000);
55
+ resetTimeRaw = `in ${amount} ${unit}`;
56
+ }
57
+ // Pattern: "retry after X seconds"
58
+ const retryAfterMatch = errorMessage.match(/retry\s+after\s+(\d+)\s*(?:seconds?|secs?)?/i);
59
+ if (retryAfterMatch && !resetTime) {
60
+ const seconds = parseInt(retryAfterMatch[1], 10);
61
+ secondsUntilReset = seconds;
62
+ resetTime = new Date(Date.now() + seconds * 1000);
63
+ resetTimeRaw = `${seconds} seconds`;
64
+ }
65
+ // Pattern: ISO datetime "2026-02-04T21:00:00Z"
66
+ const isoMatch = errorMessage.match(/(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?)/);
67
+ if (isoMatch && !resetTime) {
68
+ const parsed = new Date(isoMatch[1]);
69
+ if (!isNaN(parsed.getTime())) {
70
+ resetTime = parsed;
71
+ resetTimeRaw = isoMatch[1];
72
+ secondsUntilReset = Math.max(0, Math.floor((parsed.getTime() - Date.now()) / 1000));
73
+ }
74
+ }
75
+ return {
76
+ isRateLimited: true,
77
+ resetTime,
78
+ resetTimeRaw,
79
+ secondsUntilReset,
80
+ };
81
+ }
82
+ /**
83
+ * Parse a fuzzy date/time string like "Feb 4, 9pm"
84
+ */
85
+ function parseFuzzyDateTime(str) {
86
+ try {
87
+ // Add current year if not present
88
+ const now = new Date();
89
+ let dateStr = str.trim();
90
+ // Normalize PM/AM
91
+ dateStr = dateStr.replace(/(\d)\s*(pm|am)/i, "$1 $2");
92
+ // Try parsing with current year
93
+ const withYear = `${dateStr} ${now.getFullYear()}`;
94
+ let parsed = new Date(withYear);
95
+ // If that didn't work, try next year (for dates that wrapped)
96
+ if (isNaN(parsed.getTime())) {
97
+ parsed = new Date(`${dateStr} ${now.getFullYear() + 1}`);
98
+ }
99
+ // If the date is in the past, assume it's next occurrence
100
+ if (parsed.getTime() < now.getTime()) {
101
+ // Try adding a day, week, month, or year
102
+ parsed = new Date(parsed.getTime() + 24 * 60 * 60 * 1000); // +1 day
103
+ if (parsed.getTime() < now.getTime()) {
104
+ parsed = new Date(`${dateStr} ${now.getFullYear() + 1}`);
105
+ }
106
+ }
107
+ return isNaN(parsed.getTime()) ? null : parsed;
108
+ }
109
+ catch {
110
+ return null;
111
+ }
112
+ }
113
+ /**
114
+ * Format seconds as human-readable duration
115
+ */
116
+ export function formatDuration(seconds) {
117
+ if (seconds < 60) {
118
+ return `${seconds}s`;
119
+ }
120
+ if (seconds < 3600) {
121
+ const mins = Math.floor(seconds / 60);
122
+ const secs = seconds % 60;
123
+ return secs > 0 ? `${mins}m ${secs}s` : `${mins}m`;
124
+ }
125
+ const hours = Math.floor(seconds / 3600);
126
+ const mins = Math.floor((seconds % 3600) / 60);
127
+ return mins > 0 ? `${hours}h ${mins}m` : `${hours}h`;
128
+ }
129
+ /**
130
+ * Maximum wait time: 4 hours (just under session limit window)
131
+ */
132
+ export const MAX_WAIT_SECONDS = 4 * 60 * 60; // 14400
133
+ /**
134
+ * Exponential backoff delays (in seconds), capped at 4h
135
+ */
136
+ export const BACKOFF_DELAYS = [
137
+ 60, // 1 minute
138
+ 300, // 5 minutes
139
+ 1800, // 30 minutes
140
+ 7200, // 2 hours
141
+ 14400, // 4 hours (cap)
142
+ ];
143
+ /**
144
+ * Get the backoff delay for a given retry attempt
145
+ */
146
+ export function getBackoffDelay(attempt) {
147
+ const index = Math.min(attempt, BACKOFF_DELAYS.length - 1);
148
+ return BACKOFF_DELAYS[index];
149
+ }
150
+ /**
151
+ * Sleep for a given number of milliseconds
152
+ */
153
+ export function sleep(ms) {
154
+ return new Promise((resolve) => setTimeout(resolve, ms));
155
+ }
156
+ /**
157
+ * Wait with countdown display
158
+ *
159
+ * @param seconds - Seconds to wait
160
+ * @param onTick - Called every second with remaining time
161
+ * @returns Promise that resolves when wait is complete
162
+ */
163
+ export async function waitWithCountdown(seconds, onTick) {
164
+ let remaining = seconds;
165
+ while (remaining > 0) {
166
+ if (onTick) {
167
+ onTick(remaining, formatDuration(remaining));
168
+ }
169
+ await sleep(1000);
170
+ remaining -= 1;
171
+ }
172
+ }
173
+ /**
174
+ * Print rate limit waiting message
175
+ */
176
+ export function printRateLimitWait(info, attempt) {
177
+ const waitTime = info.secondsUntilReset ?? getBackoffDelay(attempt);
178
+ const formatted = formatDuration(waitTime);
179
+ console.log("");
180
+ console.log(chalk.yellow("⏳ Rate limited"));
181
+ if (info.resetTimeRaw) {
182
+ console.log(chalk.dim(` Reset time: ${info.resetTimeRaw}`));
183
+ }
184
+ console.log(chalk.dim(` Waiting ${formatted} before retry (attempt ${attempt + 1})...`));
185
+ }
186
+ /**
187
+ * Check if an error is a transient connection error worth retrying.
188
+ * These are common on flaky networks, CGNAT, or when connections go stale.
189
+ */
190
+ export function isTransientConnectionError(errorMessage) {
191
+ const lower = errorMessage.toLowerCase();
192
+ return (lower.includes("econnreset") ||
193
+ lower.includes("etimedout") ||
194
+ lower.includes("econnrefused") ||
195
+ lower.includes("epipe") ||
196
+ lower.includes("ehostunreach") ||
197
+ lower.includes("enetunreach") ||
198
+ lower.includes("connection") && lower.includes("timeout") ||
199
+ lower.includes("socket hang up") ||
200
+ lower.includes("apiconnectiontimeouterror") ||
201
+ lower.includes("apiconnectionerror") ||
202
+ lower.includes("network") && lower.includes("error") ||
203
+ lower.includes("fetch failed") ||
204
+ lower.includes("aborted"));
205
+ }
206
+ /** Short delays for connection retries (seconds) — no need to wait long */
207
+ export const CONNECTION_RETRY_DELAYS = [
208
+ 5, // 5 seconds
209
+ 15, // 15 seconds
210
+ 30, // 30 seconds
211
+ 60, // 1 minute
212
+ 120, // 2 minutes
213
+ ];
214
+ /**
215
+ * Get retry delay for a connection error attempt
216
+ */
217
+ export function getConnectionRetryDelay(attempt) {
218
+ const index = Math.min(attempt, CONNECTION_RETRY_DELAYS.length - 1);
219
+ return CONNECTION_RETRY_DELAYS[index];
220
+ }
221
+ //# sourceMappingURL=rate-limit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate-limit.js","sourceRoot":"","sources":["../../src/memento/rate-limit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;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