@autonav/core 1.6.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.
- package/README.md +2 -2
- package/dist/adapter/index.d.ts +3 -3
- package/dist/adapter/index.d.ts.map +1 -1
- package/dist/adapter/index.js +3 -3
- package/dist/adapter/index.js.map +1 -1
- package/dist/adapter/navigator-adapter.d.ts +196 -0
- package/dist/adapter/navigator-adapter.d.ts.map +1 -0
- package/dist/adapter/navigator-adapter.js +579 -0
- package/dist/adapter/navigator-adapter.js.map +1 -0
- package/dist/cli/autonav.d.ts +2 -6
- package/dist/cli/autonav.d.ts.map +1 -1
- package/dist/cli/autonav.js +32 -53
- package/dist/cli/autonav.js.map +1 -1
- package/dist/cli/nav-chat.d.ts +2 -1
- package/dist/cli/nav-chat.d.ts.map +1 -1
- package/dist/cli/nav-chat.js +32 -3
- package/dist/cli/nav-chat.js.map +1 -1
- package/dist/cli/nav-init.d.ts +2 -1
- package/dist/cli/nav-init.d.ts.map +1 -1
- package/dist/cli/nav-init.js +12 -4
- package/dist/cli/nav-init.js.map +1 -1
- package/dist/cli/nav-install.d.ts +2 -1
- package/dist/cli/nav-install.d.ts.map +1 -1
- package/dist/cli/nav-install.js +4 -2
- package/dist/cli/nav-install.js.map +1 -1
- package/dist/cli/nav-memento.d.ts +3 -2
- package/dist/cli/nav-memento.d.ts.map +1 -1
- package/dist/cli/nav-memento.js +12 -6
- package/dist/cli/nav-memento.js.map +1 -1
- package/dist/cli/nav-mend.d.ts +2 -1
- package/dist/cli/nav-mend.d.ts.map +1 -1
- package/dist/cli/nav-mend.js +4 -1
- package/dist/cli/nav-mend.js.map +1 -1
- package/dist/cli/nav-migrate.d.ts +2 -1
- package/dist/cli/nav-migrate.d.ts.map +1 -1
- package/dist/cli/nav-migrate.js +2 -6
- package/dist/cli/nav-migrate.js.map +1 -1
- package/dist/cli/nav-query.d.ts +2 -1
- package/dist/cli/nav-query.d.ts.map +1 -1
- package/dist/cli/nav-query.js +12 -6
- package/dist/cli/nav-query.js.map +1 -1
- package/dist/cli/nav-standup.d.ts +18 -0
- package/dist/cli/nav-standup.d.ts.map +1 -0
- package/dist/cli/nav-standup.js +151 -0
- package/dist/cli/nav-standup.js.map +1 -0
- package/dist/cli/nav-uninstall.d.ts +2 -1
- package/dist/cli/nav-uninstall.d.ts.map +1 -1
- package/dist/cli/nav-uninstall.js +4 -2
- package/dist/cli/nav-uninstall.js.map +1 -1
- package/dist/cli/nav-update.d.ts +2 -1
- package/dist/cli/nav-update.d.ts.map +1 -1
- package/dist/cli/nav-update.js +11 -6
- package/dist/cli/nav-update.js.map +1 -1
- package/dist/conversation/App.d.ts +9 -2
- package/dist/conversation/App.d.ts.map +1 -1
- package/dist/conversation/App.js +304 -111
- package/dist/conversation/App.js.map +1 -1
- package/dist/conversation/index.d.ts +5 -0
- package/dist/conversation/index.d.ts.map +1 -1
- package/dist/conversation/index.js +17 -2
- package/dist/conversation/index.js.map +1 -1
- package/dist/harness/chibi-harness.d.ts +36 -0
- package/dist/harness/chibi-harness.d.ts.map +1 -0
- package/dist/harness/chibi-harness.js +383 -0
- package/dist/harness/chibi-harness.js.map +1 -0
- package/dist/harness/chibi-plugins/get_plugin_config +64 -0
- package/dist/harness/chibi-plugins/query_navigator +114 -0
- package/dist/harness/chibi-plugins/submit_answer +38 -0
- package/dist/harness/chibi-plugins/update_plugin_config +91 -0
- package/dist/harness/claude-code-harness.d.ts +24 -0
- package/dist/harness/claude-code-harness.d.ts.map +1 -0
- package/dist/harness/claude-code-harness.js +242 -0
- package/dist/harness/claude-code-harness.js.map +1 -0
- package/dist/harness/ephemeral-home.d.ts +34 -0
- package/dist/harness/ephemeral-home.d.ts.map +1 -0
- package/dist/harness/ephemeral-home.js +56 -0
- package/dist/harness/ephemeral-home.js.map +1 -0
- package/dist/harness/factory.d.ts +47 -0
- package/dist/harness/factory.d.ts.map +1 -0
- package/dist/harness/factory.js +84 -0
- package/dist/harness/factory.js.map +1 -0
- package/dist/harness/helpers.d.ts +58 -0
- package/dist/harness/helpers.d.ts.map +1 -0
- package/dist/harness/helpers.js +78 -0
- package/dist/harness/helpers.js.map +1 -0
- package/dist/harness/index.d.ts +14 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +13 -0
- package/dist/harness/index.js.map +1 -0
- package/dist/harness/opencode-harness.d.ts +79 -0
- package/dist/harness/opencode-harness.d.ts.map +1 -0
- package/dist/harness/opencode-harness.js +537 -0
- package/dist/harness/opencode-harness.js.map +1 -0
- package/dist/harness/opencode-tools/get_plugin_config.ts +72 -0
- package/dist/harness/opencode-tools/query_navigator.ts +126 -0
- package/dist/harness/opencode-tools/submit_answer.ts +40 -0
- package/dist/harness/opencode-tools/update_plugin_config.ts +105 -0
- package/dist/harness/sandbox.d.ts +59 -0
- package/dist/harness/sandbox.d.ts.map +1 -0
- package/dist/harness/sandbox.js +152 -0
- package/dist/harness/sandbox.js.map +1 -0
- package/dist/harness/tool-server.d.ts +50 -0
- package/dist/harness/tool-server.d.ts.map +1 -0
- package/dist/harness/tool-server.js +27 -0
- package/dist/harness/tool-server.js.map +1 -0
- package/dist/harness/types.d.ts +168 -0
- package/dist/harness/types.d.ts.map +1 -0
- package/dist/harness/types.js +12 -0
- package/dist/harness/types.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/interview/App.d.ts +4 -2
- package/dist/interview/App.d.ts.map +1 -1
- package/dist/interview/App.js +36 -56
- package/dist/interview/App.js.map +1 -1
- package/dist/interview/index.d.ts +3 -0
- package/dist/interview/index.d.ts.map +1 -1
- package/dist/interview/index.js +1 -0
- package/dist/interview/index.js.map +1 -1
- package/dist/interview/prompts.d.ts +3 -1
- package/dist/interview/prompts.d.ts.map +1 -1
- package/dist/interview/prompts.js +5 -1
- package/dist/interview/prompts.js.map +1 -1
- package/dist/interview/ui/ChatBanner.d.ts +17 -0
- package/dist/interview/ui/ChatBanner.d.ts.map +1 -0
- package/dist/interview/ui/ChatBanner.js +30 -0
- package/dist/interview/ui/ChatBanner.js.map +1 -0
- package/dist/interview/ui/ChatInput.d.ts +36 -0
- package/dist/interview/ui/ChatInput.d.ts.map +1 -0
- package/dist/interview/ui/ChatInput.js +304 -0
- package/dist/interview/ui/ChatInput.js.map +1 -0
- package/dist/interview/ui/MarkdownText.d.ts +13 -0
- package/dist/interview/ui/MarkdownText.d.ts.map +1 -0
- package/dist/interview/ui/MarkdownText.js +107 -0
- package/dist/interview/ui/MarkdownText.js.map +1 -0
- package/dist/interview/ui/index.d.ts +3 -0
- package/dist/interview/ui/index.d.ts.map +1 -1
- package/dist/interview/ui/index.js +3 -0
- package/dist/interview/ui/index.js.map +1 -1
- package/dist/memento/implementer-agent.d.ts +31 -0
- package/dist/memento/implementer-agent.d.ts.map +1 -0
- package/dist/memento/implementer-agent.js +95 -0
- package/dist/memento/implementer-agent.js.map +1 -0
- package/dist/memento/index.d.ts +6 -5
- package/dist/memento/index.d.ts.map +1 -1
- package/dist/memento/index.js +7 -5
- package/dist/memento/index.js.map +1 -1
- package/dist/memento/loop.d.ts +6 -5
- package/dist/memento/loop.d.ts.map +1 -1
- package/dist/memento/loop.js +872 -180
- package/dist/memento/loop.js.map +1 -1
- package/dist/memento/matrix-animation.d.ts +26 -0
- package/dist/memento/matrix-animation.d.ts.map +1 -1
- package/dist/memento/matrix-animation.js +93 -18
- package/dist/memento/matrix-animation.js.map +1 -1
- package/dist/memento/nav-protocol.d.ts +2 -2
- package/dist/memento/nav-protocol.d.ts.map +1 -1
- package/dist/memento/nav-protocol.js +39 -43
- package/dist/memento/nav-protocol.js.map +1 -1
- package/dist/memento/prompts.d.ts +21 -8
- package/dist/memento/prompts.d.ts.map +1 -1
- package/dist/memento/prompts.js +79 -39
- package/dist/memento/prompts.js.map +1 -1
- package/dist/memento/rate-limit.d.ts +85 -0
- package/dist/memento/rate-limit.d.ts.map +1 -0
- package/dist/memento/rate-limit.js +221 -0
- package/dist/memento/rate-limit.js.map +1 -0
- package/dist/memento/types.d.ts +6 -6
- package/dist/memento/types.d.ts.map +1 -1
- package/dist/memento/types.js +3 -3
- package/dist/memento/worker-agent.d.ts +4 -1
- package/dist/memento/worker-agent.d.ts.map +1 -1
- package/dist/memento/worker-agent.js +38 -54
- package/dist/memento/worker-agent.js.map +1 -1
- package/dist/registry.d.ts +35 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +87 -0
- package/dist/registry.js.map +1 -0
- package/dist/repo-analyzer/index.d.ts +2 -1
- package/dist/repo-analyzer/index.d.ts.map +1 -1
- package/dist/repo-analyzer/index.js +6 -17
- package/dist/repo-analyzer/index.js.map +1 -1
- package/dist/skill-generator/index.d.ts +142 -0
- package/dist/skill-generator/index.d.ts.map +1 -0
- package/dist/skill-generator/index.js +510 -0
- package/dist/skill-generator/index.js.map +1 -0
- package/dist/standup/config.d.ts +19 -0
- package/dist/standup/config.d.ts.map +1 -0
- package/dist/standup/config.js +42 -0
- package/dist/standup/config.js.map +1 -0
- package/dist/standup/index.d.ts +24 -0
- package/dist/standup/index.d.ts.map +1 -0
- package/dist/standup/index.js +29 -0
- package/dist/standup/index.js.map +1 -0
- package/dist/standup/loop.d.ts +36 -0
- package/dist/standup/loop.d.ts.map +1 -0
- package/dist/standup/loop.js +508 -0
- package/dist/standup/loop.js.map +1 -0
- package/dist/standup/prompts.d.ts +62 -0
- package/dist/standup/prompts.d.ts.map +1 -0
- package/dist/standup/prompts.js +211 -0
- package/dist/standup/prompts.js.map +1 -0
- package/dist/standup/standup-protocol.d.ts +33 -0
- package/dist/standup/standup-protocol.d.ts.map +1 -0
- package/dist/standup/standup-protocol.js +189 -0
- package/dist/standup/standup-protocol.js.map +1 -0
- package/dist/standup/types.d.ts +185 -0
- package/dist/standup/types.d.ts.map +1 -0
- package/dist/standup/types.js +67 -0
- package/dist/standup/types.js.map +1 -0
- package/dist/templates/.gitignore.template +26 -0
- package/dist/templates/CLAUDE-pack.md.template +114 -0
- package/dist/templates/CLAUDE.md.template +153 -0
- package/dist/templates/README.md.template +174 -0
- package/dist/templates/config-pack.json.template +16 -0
- package/dist/templates/config.json.template +11 -0
- package/dist/templates/index.d.ts +22 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +32 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/plugins.json.template +33 -0
- package/dist/templates/system-configuration.md.template +70 -0
- package/dist/tools/cross-nav.d.ts +21 -0
- package/dist/tools/cross-nav.d.ts.map +1 -0
- package/dist/tools/cross-nav.js +93 -0
- package/dist/tools/cross-nav.js.map +1 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/related-navs-config.d.ts +15 -0
- package/dist/tools/related-navs-config.d.ts.map +1 -0
- package/dist/tools/related-navs-config.js +132 -0
- package/dist/tools/related-navs-config.js.map +1 -0
- package/dist/tools/related-navs.d.ts +23 -0
- package/dist/tools/related-navs.d.ts.map +1 -0
- package/dist/tools/related-navs.js +107 -0
- package/dist/tools/related-navs.js.map +1 -0
- package/dist/tools/response.d.ts +3 -2
- package/dist/tools/response.d.ts.map +1 -1
- package/dist/tools/response.js +7 -11
- package/dist/tools/response.js.map +1 -1
- package/dist/tools/self-config.d.ts +2 -1
- package/dist/tools/self-config.d.ts.map +1 -1
- package/dist/tools/self-config.js +5 -9
- package/dist/tools/self-config.js.map +1 -1
- package/package.json +4 -1
- package/dist/memento/state.d.ts +0 -56
- package/dist/memento/state.d.ts.map +0 -1
- package/dist/memento/state.js +0 -156
- package/dist/memento/state.js.map +0 -1
- package/dist/migrations/versions/v1.4.0-rfc2119-skills.d.ts +0 -18
- package/dist/migrations/versions/v1.4.0-rfc2119-skills.d.ts.map +0 -1
- package/dist/migrations/versions/v1.4.0-rfc2119-skills.js +0 -207
- package/dist/migrations/versions/v1.4.0-rfc2119-skills.js.map +0 -1
|
@@ -1 +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,
|
|
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"}
|
package/dist/memento/prompts.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Prompts for Memento Loop
|
|
3
3
|
*
|
|
4
|
-
* System prompts and user prompts for navigator and
|
|
4
|
+
* System prompts and user prompts for navigator and implementer agents.
|
|
5
5
|
* Uses shared Agent Identity Protocol from communication-layer.
|
|
6
6
|
*
|
|
7
|
-
* Design principle: The
|
|
7
|
+
* Design principle: The IMPLEMENTER forgets between iterations (memento pattern).
|
|
8
8
|
* The NAVIGATOR maintains its own memory and knowledge base - we just provide
|
|
9
|
-
* git history as context about what the
|
|
9
|
+
* git history as context about what the implementer has accomplished so far.
|
|
10
10
|
*/
|
|
11
11
|
import { buildAgentIdentityProtocol, } from "@autonav/communication-layer";
|
|
12
12
|
/**
|
|
13
13
|
* Build the prompt for the navigator to provide an implementation plan
|
|
14
14
|
*
|
|
15
15
|
* Uses Agent Identity Protocol when navigator identity is available.
|
|
16
|
-
* Git history is provided as context about what the
|
|
16
|
+
* Git history is provided as context about what the implementer has done,
|
|
17
17
|
* but the navigator maintains its own knowledge and memory.
|
|
18
18
|
*/
|
|
19
19
|
export function buildNavPlanPrompt(context, gitLog, navigatorIdentity) {
|
|
@@ -39,9 +39,9 @@ ${context.task}
|
|
|
39
39
|
- **Code Directory:** ${context.codeDirectory}
|
|
40
40
|
- **Branch:** ${context.branch || "(default branch)"}
|
|
41
41
|
|
|
42
|
-
## Recent Git History (
|
|
42
|
+
## Recent Git History (Implementer's Progress)
|
|
43
43
|
|
|
44
|
-
The
|
|
44
|
+
The implementer agent has made the following commits. Use this to understand what has been implemented so far:
|
|
45
45
|
|
|
46
46
|
\`\`\`
|
|
47
47
|
${gitLog || "(No commits yet)"}
|
|
@@ -56,12 +56,12 @@ ${gitLog || "(No commits yet)"}
|
|
|
56
56
|
|
|
57
57
|
### About the Memento Loop
|
|
58
58
|
|
|
59
|
-
- The **
|
|
59
|
+
- The **implementer agent forgets** between iterations (it has no memory of previous work)
|
|
60
60
|
- **You** (the navigator) maintain continuity - use your knowledge and judgment
|
|
61
|
-
- The git history shows what the
|
|
62
|
-
- Keep plans focused and incremental - the
|
|
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
63
|
- Set \`isComplete: true\` when the entire task is done
|
|
64
|
-
- The
|
|
64
|
+
- The implementer agent will implement your plan, not you
|
|
65
65
|
|
|
66
66
|
Submit your implementation plan now using the \`submit_implementation_plan\` tool.`;
|
|
67
67
|
}
|
|
@@ -91,17 +91,14 @@ You do NOT implement code yourself. You provide plans for the worker agent.
|
|
|
91
91
|
- Use conventional commit style for plan summaries (e.g., "feat: add user auth", "fix: resolve login bug")`;
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
|
-
* Build the prompt for the
|
|
94
|
+
* Build the prompt for the implementer agent to implement a plan
|
|
95
95
|
*/
|
|
96
|
-
export function
|
|
96
|
+
export function buildImplementerPrompt(codeDirectory, plan) {
|
|
97
97
|
const stepsText = plan.steps
|
|
98
98
|
.map((step, i) => `### Step ${i + 1}: ${step.description}
|
|
99
99
|
${step.files?.length ? `- Files: ${step.files.join(", ")}` : ""}
|
|
100
100
|
${step.commands?.length ? `- Commands: ${step.commands.join(", ")}` : ""}`)
|
|
101
101
|
.join("\n\n");
|
|
102
|
-
const validationText = plan.validationCriteria
|
|
103
|
-
.map((c, i) => `${i + 1}. ${c}`)
|
|
104
|
-
.join("\n");
|
|
105
102
|
return `# Implementation Task
|
|
106
103
|
|
|
107
104
|
## Plan Summary
|
|
@@ -112,34 +109,20 @@ ${plan.summary}
|
|
|
112
109
|
|
|
113
110
|
${stepsText}
|
|
114
111
|
|
|
115
|
-
## Validation Criteria
|
|
116
|
-
|
|
117
|
-
After implementation, verify:
|
|
118
|
-
${validationText}
|
|
119
|
-
|
|
120
112
|
## Instructions
|
|
121
113
|
|
|
122
114
|
1. Implement each step in order
|
|
123
|
-
2.
|
|
124
|
-
3. **Review your code** - read through what you wrote and check for:
|
|
125
|
-
- Bugs or logic errors
|
|
126
|
-
- Missing error handling
|
|
127
|
-
- Code style issues
|
|
128
|
-
- Incomplete implementations
|
|
129
|
-
4. Fix any issues before finishing
|
|
130
|
-
5. Report what you accomplished
|
|
131
|
-
|
|
132
|
-
**Important:** Your changes will be committed automatically after you finish. Make sure the code is ready for commit - review and fix before completing.
|
|
115
|
+
2. Report what you accomplished
|
|
133
116
|
|
|
134
117
|
**Working Directory:** ${codeDirectory}
|
|
135
118
|
|
|
136
119
|
Begin implementation now.`;
|
|
137
120
|
}
|
|
138
121
|
/**
|
|
139
|
-
* Build the system prompt for the
|
|
122
|
+
* Build the system prompt for the implementer agent
|
|
140
123
|
*/
|
|
141
|
-
export function
|
|
142
|
-
return `You are
|
|
124
|
+
export function buildImplementerSystemPrompt(codeDirectory) {
|
|
125
|
+
return `You are an **Implementer Agent** implementing code changes.
|
|
143
126
|
|
|
144
127
|
## Your Role
|
|
145
128
|
|
|
@@ -148,10 +131,7 @@ You receive implementation plans from the Navigator and execute them precisely.
|
|
|
148
131
|
## Guidelines
|
|
149
132
|
|
|
150
133
|
1. **Execute** each step in the plan
|
|
151
|
-
2. **
|
|
152
|
-
3. **Review** your code before finishing - check for bugs, missing error handling, style issues
|
|
153
|
-
4. **Fix** any issues you find
|
|
154
|
-
5. **Report** what you accomplished
|
|
134
|
+
2. **Report** what you accomplished
|
|
155
135
|
|
|
156
136
|
## Working Directory
|
|
157
137
|
|
|
@@ -162,7 +142,67 @@ All file paths are relative to: ${codeDirectory}
|
|
|
162
142
|
- Focus on implementing the plan, not redesigning it
|
|
163
143
|
- If something is unclear, make reasonable assumptions
|
|
164
144
|
- Report any blockers or issues clearly
|
|
165
|
-
- Do not add features beyond what the plan specifies
|
|
166
|
-
|
|
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`;
|
|
167
207
|
}
|
|
168
208
|
//# sourceMappingURL=prompts.js.map
|
|
@@ -1 +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,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EAAE,IAAI,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC;IAE5E,OAAO;;;;;;;;;;;;;EAaP,aAAa;OACR,CAAC;AACR,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,aAAqB,EACrB,YAAoB;IAEpB,OAAO;;;;EAIP,YAAY;;;;;;;yBAOW,aAAa;;kBAEpB,CAAC;AACnB,CAAC;AAED;;GAEG;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/r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B,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAC1B,CAAC;AACJ,CAAC;AAED,2EAA2E;AAC3E,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,CAAC,EAAK,YAAY;IAClB,EAAE,EAAI,aAAa;IACnB,EAAE,EAAI,aAAa;IACnB,EAAE,EAAI,WAAW;IACjB,GAAG,EAAG,YAAY;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACrD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,uBAAuB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACpE,OAAO,uBAAuB,CAAC,KAAK,CAAE,CAAC;AACzC,CAAC"}
|
package/dist/memento/types.d.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Memento Loop Types
|
|
3
3
|
*
|
|
4
4
|
* Core type definitions for the context-clearing iterative development loop
|
|
5
|
-
* that coordinates navigator (planning) and
|
|
5
|
+
* that coordinates navigator (planning) and implementer (implementation) agents.
|
|
6
6
|
*
|
|
7
|
-
* Design principle: The
|
|
8
|
-
* The NAVIGATOR maintains its own memory. Git commits track
|
|
7
|
+
* Design principle: The IMPLEMENTER forgets between iterations (memento pattern).
|
|
8
|
+
* The NAVIGATOR maintains its own memory. Git commits track implementer progress.
|
|
9
9
|
* All types here are for in-memory use during loop execution.
|
|
10
10
|
*/
|
|
11
11
|
import { z } from "zod";
|
|
@@ -70,10 +70,10 @@ export declare const ImplementationPlanSchema: z.ZodObject<{
|
|
|
70
70
|
export type ImplementationStep = z.infer<typeof ImplementationStepSchema>;
|
|
71
71
|
export type ImplementationPlan = z.infer<typeof ImplementationPlanSchema>;
|
|
72
72
|
/**
|
|
73
|
-
* Result from
|
|
73
|
+
* Result from implementer agent execution
|
|
74
74
|
*/
|
|
75
|
-
export interface
|
|
76
|
-
/** Whether the
|
|
75
|
+
export interface ImplementerResult {
|
|
76
|
+
/** Whether the implementer completed successfully */
|
|
77
77
|
success: boolean;
|
|
78
78
|
/** Summary of what was done */
|
|
79
79
|
summary: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/memento/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;EAInC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/memento/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;EAInC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IAEjB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAEhB,+BAA+B;IAC/B,aAAa,EAAE,MAAM,EAAE,CAAC;IAExB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,EAAE,CAAC,EAAE,OAAO,CAAC;IAEb,yCAAyC;IACzC,aAAa,EAAE,MAAM,CAAC;IAEtB,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAEhB,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,4BAA4B;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;IAEjB,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IAEnB,kCAAkC;IAClC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IAEnB,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB"}
|
package/dist/memento/types.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Memento Loop Types
|
|
3
3
|
*
|
|
4
4
|
* Core type definitions for the context-clearing iterative development loop
|
|
5
|
-
* that coordinates navigator (planning) and
|
|
5
|
+
* that coordinates navigator (planning) and implementer (implementation) agents.
|
|
6
6
|
*
|
|
7
|
-
* Design principle: The
|
|
8
|
-
* The NAVIGATOR maintains its own memory. Git commits track
|
|
7
|
+
* Design principle: The IMPLEMENTER forgets between iterations (memento pattern).
|
|
8
|
+
* The NAVIGATOR maintains its own memory. Git commits track implementer progress.
|
|
9
9
|
* All types here are for in-memory use during loop execution.
|
|
10
10
|
*/
|
|
11
11
|
import { z } from "zod";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Worker Agent for Memento Loop
|
|
3
3
|
*
|
|
4
|
-
* Executes implementation plans
|
|
4
|
+
* Executes implementation plans via the harness adapter.
|
|
5
5
|
*/
|
|
6
6
|
import type { ImplementationPlan, WorkerResult } from "./types.js";
|
|
7
|
+
import { type Harness } from "../harness/index.js";
|
|
7
8
|
/**
|
|
8
9
|
* Minimal context for worker (no persisted state)
|
|
9
10
|
*/
|
|
@@ -21,6 +22,8 @@ export interface WorkerAgentOptions {
|
|
|
21
22
|
model?: string;
|
|
22
23
|
/** Maximum turns for worker agent */
|
|
23
24
|
maxTurns?: number;
|
|
25
|
+
/** Harness to use (defaults to ClaudeCodeHarness) */
|
|
26
|
+
harness?: Harness;
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
29
|
* Run the worker agent to implement a plan
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-agent.d.ts","sourceRoot":"","sources":["../../src/memento/worker-agent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"worker-agent.d.ts","sourceRoot":"","sources":["../../src/memento/worker-agent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEnE,OAAO,EAAE,KAAK,OAAO,EAAqB,MAAM,qBAAqB,CAAC;AAEtE;;GAEG;AACH,UAAU,aAAa;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,4BAA4B;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,qDAAqD;IACrD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,kBAAkB,EACxB,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,YAAY,CAAC,CAoGvB"}
|