academic-army 0.1.3 → 0.2.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 (62) hide show
  1. package/README.md +4 -4
  2. package/README.zh-CN.md +4 -4
  3. package/agent-forge.yaml +30 -0
  4. package/dist/cli.js +3 -44
  5. package/dist/cli.js.map +1 -1
  6. package/dist/evolve-skill/pipeline.d.ts +48 -3
  7. package/dist/evolve-skill/pipeline.d.ts.map +1 -1
  8. package/dist/evolve-skill/pipeline.js +44 -35
  9. package/dist/evolve-skill/pipeline.js.map +1 -1
  10. package/metaskills/academic-army-coding-style/METASKILL.md +38 -5
  11. package/package.json +3 -10
  12. package/runs/develop-skill.sh +4 -5
  13. package/runs/develop.sh +4 -5
  14. package/skills/academic-army-coding-style/SKILL.md +705 -806
  15. package/dist/developing/agents/developer.d.ts +0 -9
  16. package/dist/developing/agents/developer.d.ts.map +0 -1
  17. package/dist/developing/agents/developer.js +0 -34
  18. package/dist/developing/agents/developer.js.map +0 -1
  19. package/dist/developing/agents/factory.d.ts +0 -3
  20. package/dist/developing/agents/factory.d.ts.map +0 -1
  21. package/dist/developing/agents/factory.js +0 -9
  22. package/dist/developing/agents/factory.js.map +0 -1
  23. package/dist/developing/agents/index.d.ts +0 -6
  24. package/dist/developing/agents/index.d.ts.map +0 -1
  25. package/dist/developing/agents/index.js +0 -6
  26. package/dist/developing/agents/index.js.map +0 -1
  27. package/dist/developing/agents/manager.d.ts +0 -19
  28. package/dist/developing/agents/manager.d.ts.map +0 -1
  29. package/dist/developing/agents/manager.js +0 -56
  30. package/dist/developing/agents/manager.js.map +0 -1
  31. package/dist/developing/agents/prompts.d.ts +0 -3
  32. package/dist/developing/agents/prompts.d.ts.map +0 -1
  33. package/dist/developing/agents/prompts.js +0 -12
  34. package/dist/developing/agents/prompts.js.map +0 -1
  35. package/dist/developing/agents/reviewer.d.ts +0 -10
  36. package/dist/developing/agents/reviewer.d.ts.map +0 -1
  37. package/dist/developing/agents/reviewer.js +0 -35
  38. package/dist/developing/agents/reviewer.js.map +0 -1
  39. package/dist/developing/agents/trajectory-optimizer.d.ts +0 -19
  40. package/dist/developing/agents/trajectory-optimizer.d.ts.map +0 -1
  41. package/dist/developing/agents/trajectory-optimizer.js +0 -51
  42. package/dist/developing/agents/trajectory-optimizer.js.map +0 -1
  43. package/dist/developing/agents/types.d.ts +0 -19
  44. package/dist/developing/agents/types.d.ts.map +0 -1
  45. package/dist/developing/agents/types.js +0 -21
  46. package/dist/developing/agents/types.js.map +0 -1
  47. package/dist/developing/index.d.ts +0 -3
  48. package/dist/developing/index.d.ts.map +0 -1
  49. package/dist/developing/index.js +0 -3
  50. package/dist/developing/index.js.map +0 -1
  51. package/dist/developing/pipeline.d.ts +0 -31
  52. package/dist/developing/pipeline.d.ts.map +0 -1
  53. package/dist/developing/pipeline.js +0 -174
  54. package/dist/developing/pipeline.js.map +0 -1
  55. package/dist/developing/pipelineskill.d.ts +0 -15
  56. package/dist/developing/pipelineskill.d.ts.map +0 -1
  57. package/dist/developing/pipelineskill.js +0 -110
  58. package/dist/developing/pipelineskill.js.map +0 -1
  59. package/dist/pipeline.d.ts +0 -13
  60. package/dist/pipeline.d.ts.map +0 -1
  61. package/dist/pipeline.js +0 -24
  62. package/dist/pipeline.js.map +0 -1
@@ -1,9 +0,0 @@
1
- import { DevelopingAgent, type DevelopingAgentVariables } from "./types.js";
2
- export type DeveloperVariables = DevelopingAgentVariables & {
3
- currentTask: string;
4
- reviewerReport?: string;
5
- };
6
- export declare class DeveloperAgent extends DevelopingAgent<DeveloperVariables> {
7
- protected buildPrompt(variables: Readonly<DeveloperVariables>): string;
8
- }
9
- //# sourceMappingURL=developer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"developer.d.ts","sourceRoot":"","sources":["../../../src/developing/agents/developer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,KAAK,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,GAAG;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,qBAAa,cAAe,SAAQ,eAAe,CAAC,kBAAkB,CAAC;IACrE,SAAS,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GAAG,MAAM;CA8BvE"}
@@ -1,34 +0,0 @@
1
- import { codingStyleSkillInstruction } from "./prompts.js";
2
- import { DevelopingAgent } from "./types.js";
3
- export class DeveloperAgent extends DevelopingAgent {
4
- buildPrompt(variables) {
5
- const codingStyleSkillPath = this.workspaceRelativePath(variables.codingStyleSkillPath);
6
- const targetPath = this.workspaceRelativePath(variables.targetPath);
7
- const paperBlueprintPath = this.workspaceRelativePath(variables.paperBlueprintPath);
8
- const experimentPlanPath = this.workspaceRelativePath(variables.experimentPlanPath);
9
- const codingPlanPath = this.workspaceRelativePath(variables.codingPlanPath);
10
- const reviewerReport = variables.reviewerReport ?? "(none)";
11
- const codingStyleSkillInstructionText = codingStyleSkillInstruction(codingStyleSkillPath);
12
- return `
13
- ${codingStyleSkillInstructionText}
14
-
15
- Work only in the target repository at ${targetPath}/.
16
-
17
- Read:
18
- - paper blueprint: ${paperBlueprintPath}
19
- - experiment plan: ${experimentPlanPath}
20
- - coding plan: ${codingPlanPath}
21
-
22
- Current developer task:
23
- ${variables.currentTask}
24
-
25
- Reviewer report:
26
- ${reviewerReport}
27
-
28
- Modify the target repository code for the current task. If a reviewer report is present, update the code according to that report.
29
-
30
- Output a concise developer report with the main changes.
31
- `;
32
- }
33
- }
34
- //# sourceMappingURL=developer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"developer.js","sourceRoot":"","sources":["../../../src/developing/agents/developer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAiC,MAAM,YAAY,CAAC;AAO5E,MAAM,OAAO,cAAe,SAAQ,eAAmC;IAC3D,WAAW,CAAC,SAAuC;QAC3D,MAAM,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;QACxF,MAAM,UAAU,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACpE,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACpF,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACpF,MAAM,cAAc,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC5E,MAAM,cAAc,GAAG,SAAS,CAAC,cAAc,IAAI,QAAQ,CAAC;QAC5D,MAAM,+BAA+B,GAAG,2BAA2B,CAAC,oBAAoB,CAAC,CAAC;QAE1F,OAAO;EACT,+BAA+B;;wCAEO,UAAU;;;qBAG7B,kBAAkB;qBAClB,kBAAkB;iBACtB,cAAc;;;EAG7B,SAAS,CAAC,WAAW;;;EAGrB,cAAc;;;;;CAKf,CAAC;IACA,CAAC;CACF"}
@@ -1,3 +0,0 @@
1
- import type { AgentFactoryMap } from "coding-agent-forge";
2
- export declare const agentFactories: AgentFactoryMap;
3
- //# sourceMappingURL=factory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/developing/agents/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAM1D,eAAO,MAAM,cAAc,EAAE,eAI5B,CAAC"}
@@ -1,9 +0,0 @@
1
- import { DeveloperAgent } from "./developer.js";
2
- import { CodingManagerAgent } from "./manager.js";
3
- import { CodeReviewerAgent } from "./reviewer.js";
4
- export const agentFactories = {
5
- "coding-manager": (thread, constants) => new CodingManagerAgent(thread, constants),
6
- developer: (thread, constants) => new DeveloperAgent(thread, constants),
7
- "code-reviewer": (thread, constants) => new CodeReviewerAgent(thread, constants),
8
- };
9
- //# sourceMappingURL=factory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/developing/agents/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,CAAC,MAAM,cAAc,GAAoB;IAC7C,gBAAgB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,MAAM,EAAE,SAAS,CAAC;IAClF,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,IAAI,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC;IACvE,eAAe,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC;CACjF,CAAC"}
@@ -1,6 +0,0 @@
1
- export { CodingManagerAgent, type CodingManagerVariables } from "./manager.js";
2
- export { DeveloperAgent, type DeveloperVariables } from "./developer.js";
3
- export { CodeReviewerAgent, type CodeReviewerVariables } from "./reviewer.js";
4
- export { TrajectoryOptimizerAgent, type TrajectoryOptimizerVariables, } from "./trajectory-optimizer.js";
5
- export { agentFactories } from "./factory.js";
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/developing/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EACL,wBAAwB,EACxB,KAAK,4BAA4B,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
@@ -1,6 +0,0 @@
1
- export { CodingManagerAgent } from "./manager.js";
2
- export { DeveloperAgent } from "./developer.js";
3
- export { CodeReviewerAgent } from "./reviewer.js";
4
- export { TrajectoryOptimizerAgent, } from "./trajectory-optimizer.js";
5
- export { agentFactories } from "./factory.js";
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/developing/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA+B,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,cAAc,EAA2B,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAA8B,MAAM,eAAe,CAAC;AAC9E,OAAO,EACL,wBAAwB,GAEzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
@@ -1,19 +0,0 @@
1
- import { DevelopingAgent, type DevelopingAgentVariables } from "./types.js";
2
- type SelectCodingManagerVariables = DevelopingAgentVariables & {
3
- todoPath: string;
4
- finishMark: string;
5
- phase: "select";
6
- };
7
- type UpdateCodingManagerVariables = DevelopingAgentVariables & {
8
- todoPath: string;
9
- finishMark: string;
10
- phase: "update";
11
- currentTask: string;
12
- revisionReport: string;
13
- };
14
- export type CodingManagerVariables = SelectCodingManagerVariables | UpdateCodingManagerVariables;
15
- export declare class CodingManagerAgent extends DevelopingAgent<CodingManagerVariables> {
16
- protected buildPrompt(variables: Readonly<CodingManagerVariables>): string;
17
- }
18
- export {};
19
- //# sourceMappingURL=manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/developing/agents/manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,KAAK,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE5E,KAAK,4BAA4B,GAAG,wBAAwB,GAAG;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC;CACjB,CAAC;AAEF,KAAK,4BAA4B,GAAG,wBAAwB,GAAG;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,4BAA4B,GAAG,4BAA4B,CAAC;AAEjG,qBAAa,kBAAmB,SAAQ,eAAe,CAAC,sBAAsB,CAAC;IAC7E,SAAS,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,sBAAsB,CAAC,GAAG,MAAM;CAqD3E"}
@@ -1,56 +0,0 @@
1
- import { codingStyleSkillInstruction, goalInstruction } from "./prompts.js";
2
- import { DevelopingAgent } from "./types.js";
3
- export class CodingManagerAgent extends DevelopingAgent {
4
- buildPrompt(variables) {
5
- const codingStyleSkillPath = this.workspaceRelativePath(variables.codingStyleSkillPath);
6
- const targetPath = this.workspaceRelativePath(variables.targetPath);
7
- const paperBlueprintPath = this.workspaceRelativePath(variables.paperBlueprintPath);
8
- const experimentPlanPath = this.workspaceRelativePath(variables.experimentPlanPath);
9
- const codingPlanPath = this.workspaceRelativePath(variables.codingPlanPath);
10
- const todoPath = this.workspaceRelativePath(variables.todoPath);
11
- const codingStyleSkillInstructionText = codingStyleSkillInstruction(codingStyleSkillPath);
12
- const goalInstructionText = goalInstruction(variables.goal);
13
- if (variables.phase === "update") {
14
- return `
15
- ${codingStyleSkillInstructionText}
16
-
17
- Update the TODO file after a developer task.
18
- Work only in the TODO file at ${todoPath}. Scan the target repository at ${targetPath}/ before editing it.
19
-
20
- Read:
21
- - paper blueprint: ${paperBlueprintPath}
22
- - experiment plan: ${experimentPlanPath}
23
- - coding plan: ${codingPlanPath}
24
- ${goalInstructionText}
25
-
26
- Current developer task:
27
- ${variables.currentTask}
28
-
29
- Revision report:
30
- ${variables.revisionReport}
31
-
32
- The revision report lists each Developer report and Reviewer report from the review loop, ending with whether the Reviewer accepted the changes or the loop reached the max revision iterations.
33
-
34
- Update the TODO so completed work and future developer tasks match the current repository. If you find a better future plan, update it too.
35
- `;
36
- }
37
- return `
38
- ${codingStyleSkillInstructionText}
39
-
40
- Select the next developer task for the target repository.
41
- Scan the target repository at ${targetPath}/ and the TODO file at ${todoPath}.
42
-
43
- Read:
44
- - paper blueprint: ${paperBlueprintPath}
45
- - experiment plan: ${experimentPlanPath}
46
- - coding plan: ${codingPlanPath}
47
- ${goalInstructionText}
48
-
49
- Choose exactly one new bounded task for the Developer.
50
-
51
- When no further developer task is needed, return exactly:
52
- ${variables.finishMark}
53
- `;
54
- }
55
- }
56
- //# sourceMappingURL=manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/developing/agents/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAiC,MAAM,YAAY,CAAC;AAkB5E,MAAM,OAAO,kBAAmB,SAAQ,eAAuC;IACnE,WAAW,CAAC,SAA2C;QAC/D,MAAM,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;QACxF,MAAM,UAAU,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACpE,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACpF,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACpF,MAAM,cAAc,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC5E,MAAM,QAAQ,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAChE,MAAM,+BAA+B,GAAG,2BAA2B,CAAC,oBAAoB,CAAC,CAAC;QAC1F,MAAM,mBAAmB,GAAG,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAE5D,IAAI,SAAS,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YACjC,OAAO;EACX,+BAA+B;;;gCAGD,QAAQ,mCAAmC,UAAU;;;qBAGhE,kBAAkB;qBAClB,kBAAkB;iBACtB,cAAc;EAC7B,mBAAmB;;;EAGnB,SAAS,CAAC,WAAW;;;EAGrB,SAAS,CAAC,cAAc;;;;;CAKzB,CAAC;QACE,CAAC;QAED,OAAO;EACT,+BAA+B;;;gCAGD,UAAU,0BAA0B,QAAQ;;;qBAGvD,kBAAkB;qBAClB,kBAAkB;iBACtB,cAAc;EAC7B,mBAAmB;;;;;EAKnB,SAAS,CAAC,UAAU;CACrB,CAAC;IACA,CAAC;CACF"}
@@ -1,3 +0,0 @@
1
- export declare function codingStyleSkillInstruction(codingStyleSkillPath: string): string;
2
- export declare function goalInstruction(goal: string): string;
3
- //# sourceMappingURL=prompts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/developing/agents/prompts.ts"],"names":[],"mappings":"AAAA,wBAAgB,2BAA2B,CAAC,oBAAoB,EAAE,MAAM,GAAG,MAAM,CAEhF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOpD"}
@@ -1,12 +0,0 @@
1
- export function codingStyleSkillInstruction(codingStyleSkillPath) {
2
- return `Load and follow the skill at ${codingStyleSkillPath}. It describes how to keep repository code concise, readable, low-friction, and easy to modify.`;
3
- }
4
- export function goalInstruction(goal) {
5
- return `
6
- Current goal:
7
- ${goal}
8
-
9
- Use this goal as the current high-level objective.
10
- `;
11
- }
12
- //# sourceMappingURL=prompts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/developing/agents/prompts.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,2BAA2B,CAAC,oBAA4B;IACtE,OAAO,gCAAgC,oBAAoB,iGAAiG,CAAC;AAC/J,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO;;EAEP,IAAI;;;CAGL,CAAC;AACF,CAAC"}
@@ -1,10 +0,0 @@
1
- import { DevelopingAgent, type DevelopingAgentVariables } from "./types.js";
2
- export type CodeReviewerVariables = DevelopingAgentVariables & {
3
- acceptMark: string;
4
- currentTask: string;
5
- developerReport: string;
6
- };
7
- export declare class CodeReviewerAgent extends DevelopingAgent<CodeReviewerVariables> {
8
- protected buildPrompt(variables: Readonly<CodeReviewerVariables>): string;
9
- }
10
- //# sourceMappingURL=reviewer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reviewer.d.ts","sourceRoot":"","sources":["../../../src/developing/agents/reviewer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,KAAK,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,MAAM,qBAAqB,GAAG,wBAAwB,GAAG;IAC7D,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,eAAe,CAAC,qBAAqB,CAAC;IAC3E,SAAS,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,qBAAqB,CAAC,GAAG,MAAM;CAiC1E"}
@@ -1,35 +0,0 @@
1
- import { codingStyleSkillInstruction } from "./prompts.js";
2
- import { DevelopingAgent } from "./types.js";
3
- export class CodeReviewerAgent extends DevelopingAgent {
4
- buildPrompt(variables) {
5
- const codingStyleSkillPath = this.workspaceRelativePath(variables.codingStyleSkillPath);
6
- const targetPath = this.workspaceRelativePath(variables.targetPath);
7
- const paperBlueprintPath = this.workspaceRelativePath(variables.paperBlueprintPath);
8
- const experimentPlanPath = this.workspaceRelativePath(variables.experimentPlanPath);
9
- const codingPlanPath = this.workspaceRelativePath(variables.codingPlanPath);
10
- const codingStyleSkillInstructionText = codingStyleSkillInstruction(codingStyleSkillPath);
11
- return (codingStyleSkillInstructionText +
12
- `
13
-
14
- Review the current developer task result. Read only.
15
-
16
- Read:
17
- - target repository: ${targetPath}
18
- - paper blueprint: ${paperBlueprintPath}
19
- - experiment plan: ${experimentPlanPath}
20
- - coding plan: ${codingPlanPath}
21
-
22
- Current developer task:
23
- ${variables.currentTask}
24
-
25
- Developer report:
26
- ${variables.developerReport}
27
-
28
- If the code for the current task is complete and needs no more changes, output exactly:
29
- ${variables.acceptMark}
30
-
31
- Otherwise output the revision feedback for the Developer.
32
- `);
33
- }
34
- }
35
- //# sourceMappingURL=reviewer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reviewer.js","sourceRoot":"","sources":["../../../src/developing/agents/reviewer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAiC,MAAM,YAAY,CAAC;AAQ5E,MAAM,OAAO,iBAAkB,SAAQ,eAAsC;IACjE,WAAW,CAAC,SAA0C;QAC9D,MAAM,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;QACxF,MAAM,UAAU,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACpE,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACpF,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;QACpF,MAAM,cAAc,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC5E,MAAM,+BAA+B,GAAG,2BAA2B,CAAC,oBAAoB,CAAC,CAAC;QAE1F,OAAO,CACL,+BAA+B;YAC/B;;;;;uBAKiB,UAAU;qBACZ,kBAAkB;qBAClB,kBAAkB;iBACtB,cAAc;;;EAG7B,SAAS,CAAC,WAAW;;;EAGrB,SAAS,CAAC,eAAe;;;EAGzB,SAAS,CAAC,UAAU;;;CAGrB,CACI,CAAC;IACJ,CAAC;CACF"}
@@ -1,19 +0,0 @@
1
- import { Agent } from "coding-agent-forge/agent";
2
- import type { DevelopingAgentVariables } from "./types.js";
3
- type ScanTrajectoryOptimizerVariables = DevelopingAgentVariables & {
4
- phase: "scan";
5
- currentTask: string;
6
- };
7
- type OptimizeTrajectoryOptimizerVariables = DevelopingAgentVariables & {
8
- phase: "optimize";
9
- currentTask: string;
10
- revisionReport: string;
11
- todoUpdateReport: string;
12
- metaskillPath: string;
13
- };
14
- export type TrajectoryOptimizerVariables = ScanTrajectoryOptimizerVariables | OptimizeTrajectoryOptimizerVariables;
15
- export declare class TrajectoryOptimizerAgent extends Agent<TrajectoryOptimizerVariables> {
16
- protected buildPrompt(variables: Readonly<TrajectoryOptimizerVariables>): string;
17
- }
18
- export {};
19
- //# sourceMappingURL=trajectory-optimizer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trajectory-optimizer.d.ts","sourceRoot":"","sources":["../../../src/developing/agents/trajectory-optimizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEjD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D,KAAK,gCAAgC,GAAG,wBAAwB,GAAG;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,oCAAoC,GAAG,wBAAwB,GAAG;IACrE,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GACpC,gCAAgC,GAChC,oCAAoC,CAAC;AAEzC,qBAAa,wBAAyB,SAAQ,KAAK,CAAC,4BAA4B,CAAC;IAC/E,SAAS,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,4BAA4B,CAAC,GAAG,MAAM;CA+CjF"}
@@ -1,51 +0,0 @@
1
- import { Agent } from "coding-agent-forge/agent";
2
- import { readFileSync } from "node:fs";
3
- export class TrajectoryOptimizerAgent extends Agent {
4
- buildPrompt(variables) {
5
- if (variables.phase === "scan") {
6
- return `
7
- Read only. Scan the target repository before the Developer starts the current task.
8
-
9
- Read:
10
- - skill: ${variables.codingStyleSkillPath}
11
- - target repository: ${variables.targetPath}
12
- - paper blueprint: ${variables.paperBlueprintPath}
13
- - experiment plan: ${variables.experimentPlanPath}
14
- - coding plan: ${variables.codingPlanPath}
15
-
16
- Current developer task:
17
- ${variables.currentTask}
18
-
19
- Output a concise baseline of the repository state relevant to this task and the main guidance the skill should provide.
20
- `;
21
- }
22
- const metaskill = readFileSync(variables.metaskillPath, "utf8");
23
- return `
24
- Revise the skill at ${variables.codingStyleSkillPath} so it produces better development trajectories.
25
-
26
- The metaskill below contains the design goals and tips of this skill:
27
-
28
- ${metaskill}
29
-
30
- Read:
31
- - target repository: ${variables.targetPath}
32
- - paper blueprint: ${variables.paperBlueprintPath}
33
- - experiment plan: ${variables.experimentPlanPath}
34
- - coding plan: ${variables.codingPlanPath}
35
-
36
- Current developer task:
37
- ${variables.currentTask}
38
-
39
- Revision report:
40
- ${variables.revisionReport}
41
-
42
- TODO update report:
43
- ${variables.todoUpdateReport}
44
-
45
- Evaluate whether the skill produced a good modification trajectory, then edit the skill directly. Focus on missing, misleading, or redundant guidance that affected task selection, coding, review, or TODO update.
46
-
47
- Output a concise optimizer report with the main skill changes.
48
- `;
49
- }
50
- }
51
- //# sourceMappingURL=trajectory-optimizer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trajectory-optimizer.js","sourceRoot":"","sources":["../../../src/developing/agents/trajectory-optimizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAoBvC,MAAM,OAAO,wBAAyB,SAAQ,KAAmC;IACrE,WAAW,CAAC,SAAiD;QACrE,IAAI,SAAS,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;YAC/B,OAAO;;;;WAIF,SAAS,CAAC,oBAAoB;uBAClB,SAAS,CAAC,UAAU;qBACtB,SAAS,CAAC,kBAAkB;qBAC5B,SAAS,CAAC,kBAAkB;iBAChC,SAAS,CAAC,cAAc;;;EAGvC,SAAS,CAAC,WAAW;;;CAGtB,CAAC;QACE,CAAC;QAED,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAChE,OAAO;sBACW,SAAS,CAAC,oBAAoB;;;;EAIlD,SAAS;;;uBAGY,SAAS,CAAC,UAAU;qBACtB,SAAS,CAAC,kBAAkB;qBAC5B,SAAS,CAAC,kBAAkB;iBAChC,SAAS,CAAC,cAAc;;;EAGvC,SAAS,CAAC,WAAW;;;EAGrB,SAAS,CAAC,cAAc;;;EAGxB,SAAS,CAAC,gBAAgB;;;;;CAK3B,CAAC;IACA,CAAC;CACF"}
@@ -1,19 +0,0 @@
1
- import type { PromptConstants, Thread } from "coding-agent-forge";
2
- import { Agent } from "coding-agent-forge/agent";
3
- export type DevelopingAgentVariables = {
4
- targetPath: string;
5
- codingStyleSkillPath: string;
6
- paperBlueprintPath: string;
7
- experimentPlanPath: string;
8
- codingPlanPath: string;
9
- goal: string;
10
- };
11
- export type DevelopingAgentConstants = {
12
- workspacePath: string;
13
- };
14
- export declare abstract class DevelopingAgent<Variables extends DevelopingAgentVariables> extends Agent<Variables, DevelopingAgentConstants> {
15
- protected readonly workspacePath: string;
16
- constructor(thread: Thread, constants: Readonly<PromptConstants>);
17
- protected workspaceRelativePath(filePath: string): string;
18
- }
19
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/developing/agents/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAIjD,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,8BAAsB,eAAe,CAAC,SAAS,SAAS,wBAAwB,CAAE,SAAQ,KAAK,CAC7F,SAAS,EACT,wBAAwB,CACzB;IACC,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;gBAE7B,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,eAAe,CAAC;IAahE,SAAS,CAAC,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAG1D"}
@@ -1,21 +0,0 @@
1
- import { Agent } from "coding-agent-forge/agent";
2
- import { statSync } from "node:fs";
3
- import path from "node:path";
4
- export class DevelopingAgent extends Agent {
5
- workspacePath;
6
- constructor(thread, constants) {
7
- if (!constants.workspacePath) {
8
- throw new Error("Developing agent constants.workspacePath must be configured.");
9
- }
10
- const workspacePath = path.resolve(constants.workspacePath);
11
- if (!statSync(workspacePath).isDirectory()) {
12
- throw new Error(`workspacePath must be a directory: ${workspacePath}`);
13
- }
14
- super(thread, { workspacePath });
15
- this.workspacePath = workspacePath;
16
- }
17
- workspaceRelativePath(filePath) {
18
- return path.relative(this.workspacePath, path.resolve(filePath)) || ".";
19
- }
20
- }
21
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/developing/agents/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,IAAI,MAAM,WAAW,CAAC;AAe7B,MAAM,OAAgB,eAA4D,SAAQ,KAGzF;IACoB,aAAa,CAAS;IAEzC,YAAY,MAAc,EAAE,SAAoC;QAC9D,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;QAClF,CAAC;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QAC5D,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,sCAAsC,aAAa,EAAE,CAAC,CAAC;QACzE,CAAC;QACD,KAAK,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAES,qBAAqB,CAAC,QAAgB;QAC9C,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,GAAG,CAAC;IAC1E,CAAC;CACF"}
@@ -1,3 +0,0 @@
1
- export * from "./pipeline.js";
2
- export * from "./pipelineskill.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/developing/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from "./pipeline.js";
2
- export * from "./pipelineskill.js";
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/developing/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
@@ -1,31 +0,0 @@
1
- import { AgentTeam } from "coding-agent-forge";
2
- import { type ParsedPipelineArgs } from "../pipeline.js";
3
- import { type CodingManagerVariables, type CodeReviewerVariables, type DeveloperVariables } from "./agents/index.js";
4
- import type { DevelopingAgentVariables } from "./agents/types.js";
5
- export type DevelopingAgentVariablesByName = {
6
- "coding-manager": CodingManagerVariables;
7
- developer: DeveloperVariables;
8
- "code-reviewer": CodeReviewerVariables;
9
- };
10
- export type DevelopingOptions = {
11
- targetPath: string;
12
- achiveDir: string;
13
- artifactPath: string;
14
- codingStyleSkillPath: string;
15
- paperBlueprintPath: string;
16
- experimentPlanPath: string;
17
- codingPlanPath: string;
18
- goalPath: string;
19
- maxIterations: number;
20
- maxRevisionIterations: number;
21
- hooks?: DevelopingHooks;
22
- };
23
- export type DevelopingHooks = {
24
- beforeRevisionLoop?: (agentVariables: DevelopingAgentVariables, currentTask: string) => Promise<void> | void;
25
- afterRevision?: (revision: number, agentVariables: DevelopingAgentVariables, currentTask: string, developerReport: string, reviewerReport: string, revisionReports: readonly string[]) => Promise<void> | void;
26
- afterTodoUpdate?: (agentVariables: DevelopingAgentVariables, currentTask: string, revisionReport: string, todoUpdateReport: string) => Promise<void> | void;
27
- };
28
- export declare function parseDevelopingArgs(args: readonly string[]): ParsedPipelineArgs<DevelopingOptions>;
29
- export declare function developing(team: AgentTeam<DevelopingAgentVariablesByName>, options: DevelopingOptions): Promise<void>;
30
- export declare const developingPipeline: import("../pipeline.js").PipelineDefinition<DevelopingAgentVariablesByName, DevelopingOptions>;
31
- //# sourceMappingURL=pipeline.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/developing/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,oBAAoB,CAAC;AAKpE,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAElE,MAAM,MAAM,8BAA8B,GAAG;IAC3C,gBAAgB,EAAE,sBAAsB,CAAC;IACzC,SAAS,EAAE,kBAAkB,CAAC;IAC9B,eAAe,EAAE,qBAAqB,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,kBAAkB,CAAC,EAAE,CACnB,cAAc,EAAE,wBAAwB,EACxC,WAAW,EAAE,MAAM,KAChB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC1B,aAAa,CAAC,EAAE,CACd,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,wBAAwB,EACxC,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,SAAS,MAAM,EAAE,KAC/B,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC1B,eAAe,CAAC,EAAE,CAChB,cAAc,EAAE,wBAAwB,EACxC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,MAAM,KACrB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC3B,CAAC;AAoBF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,kBAAkB,CAAC,iBAAiB,CAAC,CA6DvC;AAED,wBAAsB,UAAU,CAC9B,IAAI,EAAE,SAAS,CAAC,8BAA8B,CAAC,EAC/C,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CAgJf;AAeD,eAAO,MAAM,kBAAkB,gGAI7B,CAAC"}
@@ -1,174 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import { mkdir, readFile, writeFile } from "node:fs/promises";
3
- import path from "node:path";
4
- import { parseArgs } from "node:util";
5
- import { definePipeline } from "../pipeline.js";
6
- import { agentFactories, } from "./agents/index.js";
7
- const USAGE = [
8
- "Usage: npm run developing --",
9
- "--config <path>",
10
- "--target-path <folder>",
11
- "--achive-dir <folder>",
12
- "--artifact-path <folder>",
13
- "--coding-style-skill-path <path>",
14
- "--paper-blueprint-path <path>",
15
- "--experiment-plan-path <path>",
16
- "--coding-plan-path <path>",
17
- "--goal-path <path>",
18
- "[--max-iterations <positive-integer>]",
19
- "[--max-revision-iterations <positive-integer>]",
20
- ].join(" ");
21
- const FINISH_MARK = "FINISHED";
22
- const ACCEPT_MARK = "ACCEPT";
23
- export function parseDevelopingArgs(args) {
24
- const { values: { config, "target-path": targetPath, "achive-dir": achiveDir, "artifact-path": artifactPath, "coding-style-skill-path": codingStyleSkillPath, "paper-blueprint-path": paperBlueprintPath, "experiment-plan-path": experimentPlanPath, "coding-plan-path": codingPlanPath, "goal-path": goalPath, "max-iterations": maxIterations, "max-revision-iterations": maxRevisionIterations, }, } = parseArgs({
25
- args: [...args],
26
- options: {
27
- config: { type: "string", multiple: true },
28
- "target-path": { type: "string" },
29
- "achive-dir": { type: "string" },
30
- "artifact-path": { type: "string" },
31
- "coding-style-skill-path": { type: "string" },
32
- "paper-blueprint-path": { type: "string" },
33
- "experiment-plan-path": { type: "string" },
34
- "coding-plan-path": { type: "string" },
35
- "goal-path": { type: "string" },
36
- "max-iterations": { type: "string" },
37
- "max-revision-iterations": { type: "string" },
38
- },
39
- });
40
- if (config === undefined ||
41
- targetPath === undefined ||
42
- achiveDir === undefined ||
43
- artifactPath === undefined ||
44
- codingStyleSkillPath === undefined ||
45
- paperBlueprintPath === undefined ||
46
- experimentPlanPath === undefined ||
47
- codingPlanPath === undefined ||
48
- goalPath === undefined) {
49
- throw new Error(USAGE);
50
- }
51
- return {
52
- configPaths: config,
53
- runningOptions: {
54
- targetPath,
55
- achiveDir,
56
- artifactPath,
57
- codingStyleSkillPath,
58
- paperBlueprintPath,
59
- experimentPlanPath,
60
- codingPlanPath,
61
- goalPath,
62
- maxIterations: Number(maxIterations ?? 10),
63
- maxRevisionIterations: Number(maxRevisionIterations ?? 3),
64
- },
65
- };
66
- }
67
- export async function developing(team, options) {
68
- const logRecord = (thread, record) => {
69
- console.log(thread.recordToPrettyString(record));
70
- };
71
- const achiveDir = path.resolve(options.achiveDir);
72
- const artifactPath = path.resolve(options.artifactPath);
73
- const todoPath = path.join(artifactPath, "TODO.md");
74
- const goal = await readGoal(options.goalPath);
75
- const agentVariables = {
76
- targetPath: path.resolve(options.targetPath),
77
- codingStyleSkillPath: path.resolve(options.codingStyleSkillPath),
78
- paperBlueprintPath: path.resolve(options.paperBlueprintPath),
79
- experimentPlanPath: path.resolve(options.experimentPlanPath),
80
- codingPlanPath: path.resolve(options.codingPlanPath),
81
- goal,
82
- };
83
- await mkdir(achiveDir, { recursive: true });
84
- await mkdir(artifactPath, { recursive: true });
85
- if (!existsSync(todoPath)) {
86
- await writeText(todoPath, "# TODO");
87
- }
88
- await mkdir(agentVariables.targetPath, { recursive: true });
89
- for (let iteration = 1; iteration <= options.maxIterations; iteration++) {
90
- console.log(`\n# Developing iteration ${String(iteration)}\n`);
91
- const archiveDir = path.join(achiveDir, new Date().toISOString().replace(/[:.]/g, "-"));
92
- await mkdir(archiveDir, { recursive: true });
93
- const codingManager = await team.createAgent("coding-manager");
94
- const developer = await team.createAgent("developer");
95
- const codeReviewer = await team.createAgent("code-reviewer");
96
- const currentTask = (await codingManager.runStreamed({
97
- ...agentVariables,
98
- todoPath,
99
- finishMark: FINISH_MARK,
100
- phase: "select",
101
- }, logRecord)).trim();
102
- await writeText(path.join(archiveDir, "current_task.md"), currentTask);
103
- if (currentTask.trim() === FINISH_MARK) {
104
- console.log(`\n# ${FINISH_MARK}\n`);
105
- return;
106
- }
107
- let previousReviewerReport = "";
108
- const revisionReports = [];
109
- await options.hooks?.beforeRevisionLoop?.(agentVariables, currentTask);
110
- for (let revision = 1; revision <= options.maxRevisionIterations; revision++) {
111
- console.log(`\n# Review revision ${String(revision)}\n`);
112
- const developerVariables = {
113
- ...agentVariables,
114
- currentTask,
115
- };
116
- if (previousReviewerReport) {
117
- developerVariables.reviewerReport = previousReviewerReport;
118
- }
119
- const developerReport = (await developer.runStreamed(developerVariables, logRecord)).trim();
120
- await writeText(path.join(archiveDir, `developer_report_${String(revision).padStart(3, "0")}.md`), developerReport);
121
- revisionReports.push(`Developer report ${String(revision)}:\n${developerReport}`);
122
- const reviewerReport = (await codeReviewer.runStreamed({
123
- ...agentVariables,
124
- acceptMark: ACCEPT_MARK,
125
- currentTask,
126
- developerReport,
127
- }, logRecord)).trim();
128
- await writeText(path.join(archiveDir, `code_review_${String(revision).padStart(3, "0")}.md`), reviewerReport);
129
- revisionReports.push(`Reviewer report ${String(revision)}:\n${reviewerReport}`);
130
- const accepted = reviewerReport.trim() === ACCEPT_MARK;
131
- if (accepted) {
132
- revisionReports.push("Reviewer accepted the changes.");
133
- }
134
- if (!accepted && revision === options.maxRevisionIterations) {
135
- revisionReports.push("Reviewer did not accept the changes before max revision iterations.");
136
- }
137
- await options.hooks?.afterRevision?.(revision, agentVariables, currentTask, developerReport, reviewerReport, revisionReports);
138
- if (accepted) {
139
- break;
140
- }
141
- previousReviewerReport = reviewerReport;
142
- }
143
- const revisionReport = revisionReports.join("\n\n");
144
- await writeText(path.join(archiveDir, "revision_report.md"), revisionReport);
145
- const todoUpdateReport = (await codingManager.runStreamed({
146
- ...agentVariables,
147
- todoPath,
148
- finishMark: FINISH_MARK,
149
- phase: "update",
150
- currentTask,
151
- revisionReport,
152
- }, logRecord)).trim();
153
- await writeText(path.join(archiveDir, "todo_update_report.md"), todoUpdateReport);
154
- await options.hooks?.afterTodoUpdate?.(agentVariables, currentTask, revisionReport, todoUpdateReport);
155
- }
156
- throw new Error(`Reached --max-iterations ${String(options.maxIterations)} before the coding-manager returned ${FINISH_MARK}.`);
157
- }
158
- async function writeText(filePath, content) {
159
- await mkdir(path.dirname(filePath), { recursive: true });
160
- await writeFile(filePath, `${content.trimEnd()}\n`, "utf8");
161
- }
162
- async function readGoal(goalPath) {
163
- const goal = (await readFile(path.resolve(goalPath), "utf8")).trim();
164
- if (goal === "") {
165
- throw new Error(`Goal file must not be empty: ${goalPath}`);
166
- }
167
- return goal;
168
- }
169
- export const developingPipeline = definePipeline({
170
- agentFactories,
171
- parseArgs: parseDevelopingArgs,
172
- run: developing,
173
- });
174
- //# sourceMappingURL=pipeline.js.map