aven-ai 0.0.1 → 0.0.3

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 (112) hide show
  1. package/README.md +55 -131
  2. package/dist/index.js +9 -2
  3. package/dist/index.js.map +1 -1
  4. package/dist/libs/lexa/index.d.ts +2 -0
  5. package/dist/libs/lexa/index.d.ts.map +1 -0
  6. package/dist/libs/lexa/index.js +2 -0
  7. package/dist/libs/lexa/index.js.map +1 -0
  8. package/dist/libs/lexa/lexa-runtime.d.ts +17 -0
  9. package/dist/libs/lexa/lexa-runtime.d.ts.map +1 -0
  10. package/dist/libs/lexa/lexa-runtime.js +66 -0
  11. package/dist/libs/lexa/lexa-runtime.js.map +1 -0
  12. package/dist/libs/pty/index.d.ts +1 -1
  13. package/dist/libs/pty/index.d.ts.map +1 -1
  14. package/dist/libs/pty/index.js +1 -1
  15. package/dist/libs/pty/index.js.map +1 -1
  16. package/dist/libs/pty/pty-runner.d.ts +5 -1
  17. package/dist/libs/pty/pty-runner.d.ts.map +1 -1
  18. package/dist/libs/pty/pty-runner.js +16 -5
  19. package/dist/libs/pty/pty-runner.js.map +1 -1
  20. package/dist/modules/agent/core.d.ts +3 -1
  21. package/dist/modules/agent/core.d.ts.map +1 -1
  22. package/dist/modules/agent/core.js +4 -3
  23. package/dist/modules/agent/core.js.map +1 -1
  24. package/dist/modules/agent/events/tool-message-adapter.d.ts +1 -0
  25. package/dist/modules/agent/events/tool-message-adapter.d.ts.map +1 -1
  26. package/dist/modules/agent/events/tool-message-adapter.js +30 -0
  27. package/dist/modules/agent/events/tool-message-adapter.js.map +1 -1
  28. package/dist/modules/agent/index.d.ts +1 -1
  29. package/dist/modules/agent/index.d.ts.map +1 -1
  30. package/dist/modules/agent/index.js.map +1 -1
  31. package/dist/modules/agent/prompts/identity.d.ts +1 -1
  32. package/dist/modules/agent/prompts/identity.d.ts.map +1 -1
  33. package/dist/modules/agent/prompts/identity.js +1 -4
  34. package/dist/modules/agent/prompts/identity.js.map +1 -1
  35. package/dist/modules/agent/prompts/project-instructions.d.ts +19 -0
  36. package/dist/modules/agent/prompts/project-instructions.d.ts.map +1 -0
  37. package/dist/modules/agent/prompts/project-instructions.js +121 -0
  38. package/dist/modules/agent/prompts/project-instructions.js.map +1 -0
  39. package/dist/modules/agent/prompts/system.d.ts +12 -1
  40. package/dist/modules/agent/prompts/system.d.ts.map +1 -1
  41. package/dist/modules/agent/prompts/system.js +54 -1
  42. package/dist/modules/agent/prompts/system.js.map +1 -1
  43. package/dist/modules/agent/prompts/workflow.d.ts +2 -0
  44. package/dist/modules/agent/prompts/workflow.d.ts.map +1 -0
  45. package/dist/modules/agent/prompts/workflow.js +12 -0
  46. package/dist/modules/agent/prompts/workflow.js.map +1 -0
  47. package/dist/modules/agent/services/agent-recovery.d.ts +16 -0
  48. package/dist/modules/agent/services/agent-recovery.d.ts.map +1 -0
  49. package/dist/modules/agent/services/agent-recovery.js +143 -0
  50. package/dist/modules/agent/services/agent-recovery.js.map +1 -0
  51. package/dist/modules/agent/services/prompt-turn-executor.d.ts +4 -2
  52. package/dist/modules/agent/services/prompt-turn-executor.d.ts.map +1 -1
  53. package/dist/modules/agent/services/prompt-turn-executor.js +21 -3
  54. package/dist/modules/agent/services/prompt-turn-executor.js.map +1 -1
  55. package/dist/modules/agent/tools/exec-command.d.ts +1 -0
  56. package/dist/modules/agent/tools/exec-command.d.ts.map +1 -1
  57. package/dist/modules/agent/tools/files/contracts.d.ts +12 -0
  58. package/dist/modules/agent/tools/files/contracts.d.ts.map +1 -1
  59. package/dist/modules/agent/tools/files/contracts.js +6 -0
  60. package/dist/modules/agent/tools/files/contracts.js.map +1 -1
  61. package/dist/modules/agent/tools/files/create-file-tools.d.ts +7 -0
  62. package/dist/modules/agent/tools/files/create-file-tools.d.ts.map +1 -1
  63. package/dist/modules/app/cli.d.ts +1 -0
  64. package/dist/modules/app/cli.d.ts.map +1 -1
  65. package/dist/modules/app/cli.js +5 -1
  66. package/dist/modules/app/cli.js.map +1 -1
  67. package/dist/modules/app/components/app.d.ts +2 -1
  68. package/dist/modules/app/components/app.d.ts.map +1 -1
  69. package/dist/modules/app/components/app.js +4 -4
  70. package/dist/modules/app/components/app.js.map +1 -1
  71. package/dist/modules/app/index.d.ts +1 -1
  72. package/dist/modules/app/index.d.ts.map +1 -1
  73. package/dist/modules/app/index.js +1 -1
  74. package/dist/modules/app/index.js.map +1 -1
  75. package/dist/modules/app/input/use-overlay-controller.d.ts.map +1 -1
  76. package/dist/modules/app/input/use-overlay-controller.js +1 -7
  77. package/dist/modules/app/input/use-overlay-controller.js.map +1 -1
  78. package/dist/modules/app/services/use-app-input.d.ts.map +1 -1
  79. package/dist/modules/app/services/use-app-input.js +0 -4
  80. package/dist/modules/app/services/use-app-input.js.map +1 -1
  81. package/dist/modules/commands/registry.d.ts +1 -1
  82. package/dist/modules/commands/registry.d.ts.map +1 -1
  83. package/dist/modules/commands/registry.js +0 -1
  84. package/dist/modules/commands/registry.js.map +1 -1
  85. package/dist/modules/composer/components/composer.d.ts +2 -1
  86. package/dist/modules/composer/components/composer.d.ts.map +1 -1
  87. package/dist/modules/composer/components/composer.js +4 -12
  88. package/dist/modules/composer/components/composer.js.map +1 -1
  89. package/dist/modules/conversation/components/virtual-transcript.d.ts.map +1 -1
  90. package/dist/modules/conversation/components/virtual-transcript.js +1 -10
  91. package/dist/modules/conversation/components/virtual-transcript.js.map +1 -1
  92. package/dist/modules/conversation/services/use-transcript-controller.d.ts +0 -3
  93. package/dist/modules/conversation/services/use-transcript-controller.d.ts.map +1 -1
  94. package/dist/modules/conversation/services/use-transcript-controller.js +3 -21
  95. package/dist/modules/conversation/services/use-transcript-controller.js.map +1 -1
  96. package/dist/modules/overlays/components/overlay.d.ts.map +1 -1
  97. package/dist/modules/overlays/components/overlay.js +1 -5
  98. package/dist/modules/overlays/components/overlay.js.map +1 -1
  99. package/dist/modules/overlays/services/overlay-items.d.ts +0 -1
  100. package/dist/modules/overlays/services/overlay-items.d.ts.map +1 -1
  101. package/dist/modules/overlays/services/overlay-items.js +0 -3
  102. package/dist/modules/overlays/services/overlay-items.js.map +1 -1
  103. package/dist/modules/overlays/services/overlay-registry.d.ts.map +1 -1
  104. package/dist/modules/overlays/services/overlay-registry.js +0 -3
  105. package/dist/modules/overlays/services/overlay-registry.js.map +1 -1
  106. package/dist/modules/overlays/services/overlay-selection.d.ts +0 -3
  107. package/dist/modules/overlays/services/overlay-selection.d.ts.map +1 -1
  108. package/dist/modules/overlays/services/overlay-selection.js +0 -2
  109. package/dist/modules/overlays/services/overlay-selection.js.map +1 -1
  110. package/dist/modules/overlays/types.d.ts +1 -1
  111. package/dist/modules/overlays/types.d.ts.map +1 -1
  112. package/package.json +78 -71
@@ -9,7 +9,16 @@ export const execResultSchema = z.object({
9
9
  timedOut: z.boolean(),
10
10
  truncated: z.boolean(),
11
11
  output: z.string(),
12
+ agent_guidance: z.string().optional(),
12
13
  });
14
+ const genericToolFailureSchema = z
15
+ .object({
16
+ status: z.literal('error'),
17
+ tool: z.string(),
18
+ error: z.string(),
19
+ agent_guidance: z.string().optional(),
20
+ })
21
+ .strict();
13
22
  export const safeJson = (value) => {
14
23
  try {
15
24
  return JSON.stringify(value) ?? String(value);
@@ -58,6 +67,15 @@ export const parseFileResult = (value) => {
58
67
  return undefined;
59
68
  }
60
69
  };
70
+ const parseGenericToolFailure = (value) => {
71
+ try {
72
+ const parsed = genericToolFailureSchema.safeParse(JSON.parse(value));
73
+ return parsed.success ? parsed.data : undefined;
74
+ }
75
+ catch {
76
+ return undefined;
77
+ }
78
+ };
61
79
  export const toolMessageFromResult = (id, result) => ({
62
80
  id,
63
81
  kind: 'tool',
@@ -110,6 +128,18 @@ export const toolMessageFromSerializedResult = (id, name, serializedResult, summ
110
128
  const fileResult = parseFileResult(serializedResult);
111
129
  if (fileResult)
112
130
  return fileToolMessageFromResult(id, fileResult);
131
+ const genericFailure = parseGenericToolFailure(serializedResult);
132
+ if (genericFailure) {
133
+ return {
134
+ id,
135
+ kind: 'tool',
136
+ name: genericFailure.tool,
137
+ status: 'error',
138
+ summary,
139
+ detail: genericFailure.error,
140
+ group: groupForTool(genericFailure.tool),
141
+ };
142
+ }
113
143
  return {
114
144
  id,
115
145
  kind: 'tool',
@@ -1 +1 @@
1
- {"version":3,"file":"tool-message-adapter.js","sourceRoot":"","sources":["../../../../src/modules/agent/events/tool-message-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,oBAAoB,EAAsB,MAAM,6BAA6B,CAAC;AACtF,OAAO,EAAC,mBAAmB,EAAyB,MAAM,4BAA4B,CAAC;AAEvF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACrC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACnC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAU,EAAE;IAClD,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAE,KAAc,EAAU,EAAE;IAC5E,IAAI,O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AS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;QAC3I,OAAO;YACN,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,MAAM,CAAC,SAAS;YACzB,MAAM;YACN,KAAK,EAAE,MAAM;SACb,CAAC;IACH,CAAC;IACD,OAAO;QACN,EAAE;QACF,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,MAAM,CAAC,SAAS;QACzB,MAAM,EAAE,MAAM,CAAC,OAAO;QACtB,KAAK,EAAE,MAAM;KACb,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC9C,EAAU,EACV,IAAY,EACZ,gBAAwB,EACxB,OAAe,EACD,EAAE;IAChB,MAAM,UAAU,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC;IACrD,IAAI,UAAU;QAAE,OAAO,qBAAqB,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IAC7D,MAAM,UAAU,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC;IACrD,IAAI,UAAU;QAAE,OAAO,yBAAyB,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IACjE,OAAO;QACN,EAAE;QACF,IAAI,EAAE,MAAM;QACZ,IAAI;QACJ,MAAM,EAAE,OAAO;QACf,OAAO;QACP,MAAM,EAAE,gBAAgB;QACxB,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC;KACzB,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":3,"file":"tool-message-adapter.js","sourceRoot":"","sources":["../../../../src/modules/agent/events/tool-message-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,oBAAoB,EAAsB,MAAM,6B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AAgB,CAAC,CAAC;IACjE,IAAI,cAAc,EAAE,CAAC;QACpB,OAAO;YACN,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,cAAc,CAAC,IAAI;YACzB,MAAM,EAAE,OAAO;YACf,OAAO;YACP,MAAM,EAAE,cAAc,CAAC,KAAK;YAC5B,KAAK,EAAE,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC;SACxC,CAAC;IACH,CAAC;IACD,OAAO;QACN,EAAE;QACF,IAAI,EAAE,MAAM;QACZ,IAAI;QACJ,MAAM,EAAE,OAAO;QACf,OAAO;QACP,MAAM,EAAE,gBAAgB;QACxB,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC;KACzB,CAAC;AACH,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export { AnviaAgentRuntime, type AnviaRuntimeOptions } from './core.js';
2
2
  export { MockRuntime } from './mock.js';
3
- export { buildSystemPrompt } from './prompts/system.js';
3
+ export { buildSystemPrompt, type SystemPromptContext } from './prompts/system.js';
4
4
  export { isConfigurableRuntime, isProjectSessionRuntime, type AgentRuntime, type AgentStatus, type ConfigurableAgentRuntime, type ConnectionState, type InputMode, type ModelStatus, type ProjectSessionRuntime, type ProjectSessionSwitch, type ProviderCredentials, type ProviderStatus, type RuntimeEvent, type SubmitRequest, } from './types.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,KAAK,mBAAmB,EAAC,MAAM,WAAW,CAAC;AACtE,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACN,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,aAAa,GAClB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,KAAK,mBAAmB,EAAC,MAAM,WAAW,CAAC;AACtE,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,iBAAiB,EAAE,KAAK,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AAChF,OAAO,EACN,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,aAAa,GAClB,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAA2B,MAAM,WAAW,CAAC;AACtE,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACN,qBAAqB,EACrB,uBAAuB,GAavB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAA2B,MAAM,WAAW,CAAC;AACtE,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,iBAAiB,EAA2B,MAAM,qBAAqB,CAAC;AAChF,OAAO,EACN,qBAAqB,EACrB,uBAAuB,GAavB,MAAM,YAAY,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const identityInstructions: (projectRoot: string) => readonly string[];
1
+ export declare const identityInstructions: readonly string[];
2
2
  //# sourceMappingURL=identity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../src/modules/agent/prompts/identity.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,gBAAiB,MAAM,KAAG,SAAS,MAAM,EAGzE,CAAC"}
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../src/modules/agent/prompts/identity.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAAqE,CAAC"}
@@ -1,5 +1,2 @@
1
- export const identityInstructions = (projectRoot) => [
2
- 'You are Aven, a concise terminal coding assistant.',
3
- `The project root and command working directory is ${JSON.stringify(projectRoot)}.`,
4
- ];
1
+ export const identityInstructions = ['You are Aven, a concise terminal software-engineering agent.'];
5
2
  //# sourceMappingURL=identity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../../src/modules/agent/prompts/identity.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,WAAmB,EAAqB,EAAE,CAAC;IAC/E,oDAAoD;IACpD,qDAAqD,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG;CACnF,CAAC"}
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../../src/modules/agent/prompts/identity.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAsB,CAAC,8DAA8D,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ export type ProjectInstruction = {
2
+ path: string;
3
+ scope: string;
4
+ content: string;
5
+ truncated: boolean;
6
+ };
7
+ export type ProjectInstructionBundle = {
8
+ files: ProjectInstruction[];
9
+ omittedPaths: string[];
10
+ warnings: string[];
11
+ };
12
+ export type ProjectInstructionLimits = {
13
+ maxFiles: number;
14
+ maxFileBytes: number;
15
+ maxTotalBytes: number;
16
+ };
17
+ export declare const defaultProjectInstructionLimits: ProjectInstructionLimits;
18
+ export declare const loadProjectInstructions: (projectRoot: string, overrides?: Partial<ProjectInstructionLimits>) => Promise<ProjectInstructionBundle>;
19
+ //# sourceMappingURL=project-instructions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-instructions.d.ts","sourceRoot":"","sources":["../../../../src/modules/agent/prompts/project-instructions.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACtC,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,wBAI7C,CAAC;AA8FF,eAAO,MAAM,uBAAuB,gBACtB,MAAM,cACR,OAAO,CAAC,wBAAwB,CAAC,KAC1C,OAAO,CAAC,wBAAwB,CAqClC,CAAC"}
@@ -0,0 +1,121 @@
1
+ import { open, readdir } from 'node:fs/promises';
2
+ import { relative, resolve, sep } from 'node:path';
3
+ import { StringDecoder } from 'node:string_decoder';
4
+ export const defaultProjectInstructionLimits = {
5
+ maxFiles: 32,
6
+ maxFileBytes: 16 * 1024,
7
+ maxTotalBytes: 64 * 1024,
8
+ };
9
+ const maxReportedOmittedPaths = 32;
10
+ const ignoredDirectories = new Set([
11
+ '.cache',
12
+ '.git',
13
+ '.next',
14
+ 'build',
15
+ 'coverage',
16
+ 'dist',
17
+ 'node_modules',
18
+ 'target',
19
+ 'vendor',
20
+ ]);
21
+ const displayPath = (projectRoot, path) => {
22
+ const value = relative(projectRoot, path).split(sep).join('/');
23
+ return value || 'AGENTS.md';
24
+ };
25
+ const instructionScope = (path) => {
26
+ const parts = path.split('/');
27
+ parts.pop();
28
+ return parts.length === 0 ? '.' : parts.join('/');
29
+ };
30
+ const pathDepth = (path) => path.split('/').length;
31
+ const positiveLimit = (value, fallback) => Number.isSafeInteger(value) && value > 0 ? value : fallback;
32
+ const resolveLimits = (limits) => ({
33
+ maxFiles: positiveLimit(limits.maxFiles ?? 0, defaultProjectInstructionLimits.maxFiles),
34
+ maxFileBytes: positiveLimit(limits.maxFileBytes ?? 0, defaultProjectInstructionLimits.maxFileBytes),
35
+ maxTotalBytes: positiveLimit(limits.maxTotalBytes ?? 0, defaultProjectInstructionLimits.maxTotalBytes),
36
+ });
37
+ const utf8Prefix = (buffer, maximum) => {
38
+ const decoder = new StringDecoder('utf8');
39
+ return decoder.write(buffer.subarray(0, maximum));
40
+ };
41
+ const readPrefix = async (path, maximum) => {
42
+ const handle = await open(path, 'r');
43
+ try {
44
+ const buffer = Buffer.alloc(maximum + 1);
45
+ const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
46
+ const truncated = bytesRead > maximum;
47
+ return {
48
+ content: truncated ? utf8Prefix(buffer, maximum) : buffer.subarray(0, bytesRead).toString('utf8'),
49
+ truncated,
50
+ };
51
+ }
52
+ finally {
53
+ await handle.close();
54
+ }
55
+ };
56
+ const discoverInstructionPaths = async (projectRoot, warnings) => {
57
+ const discovered = [];
58
+ const visit = async (directory) => {
59
+ let entries;
60
+ try {
61
+ entries = await readdir(directory, { withFileTypes: true });
62
+ }
63
+ catch (error) {
64
+ warnings.push(`Could not inspect ${displayPath(projectRoot, directory)}: ${error instanceof Error ? error.message : String(error)}`);
65
+ return;
66
+ }
67
+ entries.sort((left, right) => left.name.localeCompare(right.name));
68
+ for (const entry of entries) {
69
+ if (entry.isSymbolicLink())
70
+ continue;
71
+ const path = resolve(directory, entry.name);
72
+ if (entry.isDirectory()) {
73
+ if (!ignoredDirectories.has(entry.name))
74
+ await visit(path);
75
+ continue;
76
+ }
77
+ if (entry.isFile() && entry.name === 'AGENTS.md') {
78
+ discovered.push({ absolute: path, display: displayPath(projectRoot, path) });
79
+ }
80
+ }
81
+ };
82
+ await visit(projectRoot);
83
+ return discovered.sort((left, right) => pathDepth(left.display) - pathDepth(right.display) || left.display.localeCompare(right.display));
84
+ };
85
+ export const loadProjectInstructions = async (projectRoot, overrides = {}) => {
86
+ const limits = resolveLimits(overrides);
87
+ const warnings = [];
88
+ const candidates = await discoverInstructionPaths(projectRoot, warnings);
89
+ const files = [];
90
+ const omittedPaths = [];
91
+ let totalBytes = 0;
92
+ for (const [index, candidate] of candidates.entries()) {
93
+ if (files.length >= limits.maxFiles || totalBytes >= limits.maxTotalBytes) {
94
+ const omittedCandidates = candidates.slice(index);
95
+ omittedPaths.push(...omittedCandidates.slice(0, maxReportedOmittedPaths).map((item) => item.display));
96
+ const additionalCount = omittedCandidates.length - omittedPaths.length;
97
+ if (additionalCount > 0) {
98
+ warnings.push(`${additionalCount} additional AGENTS.md files were omitted from the prompt.`);
99
+ }
100
+ break;
101
+ }
102
+ try {
103
+ const remaining = limits.maxTotalBytes - totalBytes;
104
+ const maximum = Math.min(limits.maxFileBytes, remaining);
105
+ const result = await readPrefix(candidate.absolute, maximum);
106
+ const contentBytes = Buffer.byteLength(result.content);
107
+ files.push({
108
+ path: candidate.display,
109
+ scope: instructionScope(candidate.display),
110
+ content: result.content,
111
+ truncated: result.truncated,
112
+ });
113
+ totalBytes += contentBytes;
114
+ }
115
+ catch (error) {
116
+ warnings.push(`Could not read ${candidate.display}: ${error instanceof Error ? error.message : String(error)}`);
117
+ }
118
+ }
119
+ return { files, omittedPaths, warnings };
120
+ };
121
+ //# sourceMappingURL=project-instructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-instructions.js","sourceRoot":"","sources":["../../../../src/modules/agent/prompts/project-instructions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAC,MAAM,WAAW,CAAC;AACjD,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAqBlD,MAAM,CAAC,MAAM,+BAA+B,GAA6B;IACxE,QAAQ,EAAE,EAAE;IACZ,YAAY,EAAE,EAAE,GAAG,IAAI;IACvB,aAAa,EAAE,EAAE,GAAG,IAAI;CACxB,CAAC;AAEF,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IAClC,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;IACP,UAAU;IACV,MAAM;IACN,cAAc;IACd,QAAQ;IACR,QAAQ;CACR,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,CAAC,WAAmB,EAAE,IAAY,EAAU,EAAE;IACjE,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/D,OAAO,KAAK,IAAI,WAAW,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAU,EAAE;IACjD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,KAAK,CAAC,GAAG,EAAE,CAAC;IACZ,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI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QAAQ,CAAC,IAAI,CAAC,kBAAkB,SAAS,CAAC,OAAO,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACjH,CAAC;IACF,CAAC;IAED,OAAO,EAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAC,CAAC;AACxC,CAAC,CAAC"}
@@ -1,2 +1,13 @@
1
- export declare const buildSystemPrompt: (projectRoot: string) => string;
1
+ import type { ProjectInstructionBundle } from './project-instructions.js';
2
+ export type SystemPromptContext = {
3
+ lexa: {
4
+ skill: string;
5
+ version: string;
6
+ };
7
+ projectRoot: string;
8
+ platform: string;
9
+ shell: string;
10
+ projectInstructions: ProjectInstructionBundle;
11
+ };
12
+ export declare const buildSystemPrompt: (context: SystemPromptContext) => string;
2
13
  //# sourceMappingURL=system.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/modules/agent/prompts/system.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,gBAAiB,MAAM,KAAG,MAC2C,CAAC"}
1
+ {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/modules/agent/prompts/system.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,2BAA2B,CAAC;AAGxE,MAAM,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,EAAE,wBAAwB,CAAC;CAC9C,CAAC;AA0DF,eAAO,MAAM,iBAAiB,YAAa,mBAAmB,KAAG,MAoBpD,CAAC"}
@@ -1,5 +1,58 @@
1
1
  import { commandInstructions } from './commands.js';
2
2
  import { fileToolInstructions } from './file-tools.js';
3
3
  import { identityInstructions } from './identity.js';
4
- export const buildSystemPrompt = (projectRoot) => [...identityInstructions(projectRoot), ...fileToolInstructions, ...commandInstructions].join('\n');
4
+ import { workflowInstructions } from './workflow.js';
5
+ const xmlText = (value) => value.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;');
6
+ const xmlAttribute = (value) => `"${xmlText(value).replaceAll('"', '&quot;').replaceAll("'", '&apos;')}"`;
7
+ const cdata = (value) => value.replaceAll(']]>', ']]]]><![CDATA[>');
8
+ const taggedLines = (tag, lines) => [
9
+ `<${tag}>`,
10
+ ...lines.map((line) => `- ${line}`),
11
+ `</${tag}>`,
12
+ ];
13
+ const projectInstructionLines = ({ files, omittedPaths, warnings }) => {
14
+ const output = [
15
+ '<project_instructions>',
16
+ 'Project instructions are repository guidance. Follow each file for work within its scope. Core safety and tool contracts take priority; explicit user instructions override project guidance. When scoped files conflict, the deepest applicable AGENTS.md takes precedence over broader files.',
17
+ ];
18
+ for (const file of files) {
19
+ output.push(`<instruction_file path=${xmlAttribute(file.path)} scope=${xmlAttribute(file.scope)} truncated="${String(file.truncated)}">`, '<![CDATA[', cdata(file.content), ']]>', '</instruction_file>');
20
+ }
21
+ if (omittedPaths.length > 0) {
22
+ output.push('<omitted_instruction_files>', ...omittedPaths.map((path) => `- ${xmlText(path)}`), 'Read the applicable omitted AGENTS.md before changing files in its scope.', '</omitted_instruction_files>');
23
+ }
24
+ if (warnings.length > 0) {
25
+ output.push('<instruction_warnings>', ...warnings.map((warning) => `- ${xmlText(warning)}`), '</instruction_warnings>');
26
+ }
27
+ output.push('</project_instructions>');
28
+ return output;
29
+ };
30
+ const lexaInstructionLines = ({ skill, version }) => [
31
+ `<lexa version=${xmlAttribute(version)}>`,
32
+ 'Aven manages this required Lexa installation and exposes `lexa` on the command PATH. Do not install or upgrade Lexa during an agent run. Core safety and tool contracts take priority; explicit user instructions override the packaged Lexa guidance.',
33
+ '<skill><![CDATA[',
34
+ cdata(skill),
35
+ ']]></skill>',
36
+ '</lexa>',
37
+ ];
38
+ export const buildSystemPrompt = (context) => [
39
+ ...identityInstructions,
40
+ '',
41
+ '<environment>',
42
+ `<project_root>${xmlText(context.projectRoot)}</project_root>`,
43
+ `<command_working_directory>${xmlText(context.projectRoot)}</command_working_directory>`,
44
+ `<platform>${xmlText(context.platform)}</platform>`,
45
+ `<shell>${xmlText(context.shell)}</shell>`,
46
+ '</environment>',
47
+ '',
48
+ ...taggedLines('working_principles', workflowInstructions),
49
+ '',
50
+ ...taggedLines('file_tool_rules', fileToolInstructions),
51
+ '',
52
+ ...taggedLines('command_rules', commandInstructions),
53
+ '',
54
+ ...lexaInstructionLines(context.lexa),
55
+ '',
56
+ ...projectInstructionLines(context.projectInstructions),
57
+ ].join('\n');
5
58
  //# sourceMappingURL=system.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"system.js","sourceRoot":"","sources":["../../../../src/modules/agent/prompts/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAAmB,EAAU,EAAE,CAChE,CAAC,GAAG,oBAAoB,CAAC,WAAW,CAAC,EAAE,GAAG,oBAAoB,EAAE,GAAG,mBAAmB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"system.js","sourceRoot":"","sources":["../../../../src/modules/agent/prompts/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAEnD,OAAO,EAA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,iBAAiB,EAAE,oBAAoB,CAAC;IACvD,EAAE;IACF,GAAG,WAAW,CAAC,eAAe,EAAE,mBAAmB,CAAC;IACpD,EAAE;IACF,GAAG,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC;IACrC,EAAE;IACF,GAAG,uBAAuB,CAAC,OAAO,CAAC,mBAAmB,CAAC;CACvD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const workflowInstructions: readonly string[];
2
+ //# sourceMappingURL=workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../../../src/modules/agent/prompts/workflow.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAUjD,CAAC"}
@@ -0,0 +1,12 @@
1
+ export const workflowInstructions = [
2
+ 'Ground statements about the repository in inspected files or command results.',
3
+ 'Follow the user-requested scope and preserve unrelated existing changes.',
4
+ 'For explanation, review, or status requests, inspect and report without modifying files unless the user also requests a change.',
5
+ 'For diagnosis requests, determine and explain the root cause before proposing or implementing a fix.',
6
+ 'For implementation requests, inspect the relevant code, implement the complete scoped change, and verify it proportionally.',
7
+ 'Prefer established project patterns and existing files over unnecessary abstractions or new files.',
8
+ 'When an operation fails, use the returned error and agent guidance to change the approach; do not repeat an unchanged failing operation.',
9
+ 'Do not claim success unless relevant tool and command results confirm it.',
10
+ 'Keep the final response concise and state what changed and how it was verified.',
11
+ ];
12
+ //# sourceMappingURL=workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../../../src/modules/agent/prompts/workflow.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAsB;IACtD,+EAA+E;IAC/E,0EAA0E;IAC1E,iIAAiI;IACjI,sGAAsG;IACtG,6HAA6H;IAC7H,oGAAoG;IACpG,0IAA0I;IAC1I,2EAA2E;IAC3E,iFAAiF;CACjF,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const FAILURE_WARNING_THRESHOLD = 3;
2
+ export declare const FAILURE_STOP_THRESHOLD = 5;
3
+ export declare const LOOP_WARNING_THRESHOLD = 3;
4
+ export declare const LOOP_STOP_THRESHOLD = 5;
5
+ type LoopMatch = {
6
+ patternLength: number;
7
+ repetitions: number;
8
+ };
9
+ export declare const canonicalToolSignature: (toolName: string, args: string) => string;
10
+ export declare const repeatingSuffix: (sequence: readonly string[]) => LoopMatch | undefined;
11
+ export declare const createAgentRecovery: () => {
12
+ hook: import("@anvia/core/hooks").PromptHook<unknown>;
13
+ middleware: import("@anvia/core").AgentMiddleware<unknown>;
14
+ };
15
+ export {};
16
+ //# sourceMappingURL=agent-recovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-recovery.d.ts","sourceRoot":"","sources":["../../../../src/modules/agent/services/agent-recovery.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAIrC,KAAK,SAAS,GAAG;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACpB,CAAC;AA+BF,eAAO,MAAM,sBAAsB,aAAc,MAAM,QAAQ,MAAM,KAAG,MAQvE,CAAC;AAEF,eAAO,MAAM,eAAe,aAAc,SAAS,MAAM,EAAE,KAAG,SAAS,GAAG,SAqBzE,CAAC;AA2CF,eAAO,MAAM,mBAAmB;;;CAgD/B,CAAC"}
@@ -0,0 +1,143 @@
1
+ import { createHook, createMiddleware } from '@anvia/core';
2
+ export const FAILURE_WARNING_THRESHOLD = 3;
3
+ export const FAILURE_STOP_THRESHOLD = 5;
4
+ export const LOOP_WARNING_THRESHOLD = 3;
5
+ export const LOOP_STOP_THRESHOLD = 5;
6
+ const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
7
+ const parseRecord = (value) => {
8
+ try {
9
+ const parsed = JSON.parse(value);
10
+ return isRecord(parsed) ? parsed : undefined;
11
+ }
12
+ catch {
13
+ return undefined;
14
+ }
15
+ };
16
+ const canonicalValue = (value) => {
17
+ if (Array.isArray(value))
18
+ return value.map(canonicalValue);
19
+ if (!isRecord(value))
20
+ return value;
21
+ return Object.fromEntries(Object.keys(value)
22
+ .sort()
23
+ .map((key) => [key, canonicalValue(value[key])]));
24
+ };
25
+ export const canonicalToolSignature = (toolName, args) => {
26
+ let normalized = args.trim();
27
+ try {
28
+ normalized = canonicalValue(JSON.parse(args));
29
+ }
30
+ catch {
31
+ // Malformed arguments still need a stable signature for repetition checks.
32
+ }
33
+ return `${toolName}:${typeof normalized === 'string' ? normalized : JSON.stringify(normalized)}`;
34
+ };
35
+ export const repeatingSuffix = (sequence) => {
36
+ let best;
37
+ for (let patternLength = 1; patternLength <= Math.floor(sequence.length / LOOP_WARNING_THRESHOLD); patternLength++) {
38
+ const patternStart = sequence.length - patternLength;
39
+ const pattern = sequence.slice(patternStart);
40
+ let repetitions = 1;
41
+ for (let end = patternStart; end >= patternLength; end -= patternLength) {
42
+ const candidate = sequence.slice(end - patternLength, end);
43
+ if (!candidate.every((item, index) => item === pattern[index]))
44
+ break;
45
+ repetitions += 1;
46
+ }
47
+ if (repetitions >= LOOP_WARNING_THRESHOLD &&
48
+ (!best ||
49
+ repetitions > best.repetitions ||
50
+ (repetitions === best.repetitions && patternLength < best.patternLength))) {
51
+ best = { patternLength, repetitions };
52
+ }
53
+ }
54
+ return best;
55
+ };
56
+ const failureReason = (toolName, result) => {
57
+ const parsed = parseRecord(result);
58
+ if (!parsed)
59
+ return 'The tool returned an unstructured or malformed result.';
60
+ if (parsed.status === 'error')
61
+ return typeof parsed.error === 'string' ? parsed.error : 'The tool reported an error.';
62
+ if (toolName === 'ExecCommand') {
63
+ if (parsed.timedOut === true)
64
+ return 'The command timed out.';
65
+ if (typeof parsed.signal === 'number' && parsed.signal !== 0)
66
+ return `The command exited after signal ${parsed.signal}.`;
67
+ if (typeof parsed.exitCode !== 'number')
68
+ return 'The command result did not include a valid exit code.';
69
+ if (parsed.exitCode !== 0)
70
+ return `The command exited with code ${parsed.exitCode}.`;
71
+ return undefined;
72
+ }
73
+ if (toolName === 'Read') {
74
+ return parsed.status === 'success' || parsed.status === 'unchanged'
75
+ ? undefined
76
+ : 'Read returned an unexpected result shape.';
77
+ }
78
+ if (toolName === 'Edit' || toolName === 'Write') {
79
+ return parsed.status === 'success' ? undefined : `${toolName} returned an unexpected result shape.`;
80
+ }
81
+ return undefined;
82
+ };
83
+ const failureGuidance = (toolName, reason, failureCount) => {
84
+ const attemptsRemaining = Math.max(0, FAILURE_STOP_THRESHOLD - failureCount);
85
+ const warning = failureCount >= FAILURE_WARNING_THRESHOLD
86
+ ? 'Do not repeat the same call unchanged; inspect the error and choose a materially different approach.'
87
+ : 'Inspect the error, correct the arguments or approach, and retry only when there is a concrete reason it should succeed.';
88
+ return `${toolName} failed (${failureCount}/${FAILURE_STOP_THRESHOLD}): ${reason} ${warning} Attempts remaining before this run stops: ${attemptsRemaining}.`;
89
+ };
90
+ const loopGuidance = ({ patternLength, repetitions }) => `A repeating tool-call pattern of length ${patternLength} has occurred ${repetitions} times. The repeated call was skipped. Change tools, arguments, or strategy before continuing.`;
91
+ const guidedResult = (toolName, result, guidance) => {
92
+ const parsed = parseRecord(result);
93
+ if (parsed)
94
+ return JSON.stringify({ ...parsed, agent_guidance: guidance });
95
+ return JSON.stringify({ status: 'error', tool: toolName, error: result, agent_guidance: guidance });
96
+ };
97
+ export const createAgentRecovery = () => {
98
+ const state = {
99
+ failures: new Map(),
100
+ toolCalls: [],
101
+ loopsByCall: new Map(),
102
+ };
103
+ const middleware = createMiddleware({
104
+ onToolOutput: ({ toolName, result, internalCallId }) => {
105
+ const loop = state.loopsByCall.get(internalCallId);
106
+ state.loopsByCall.delete(internalCallId);
107
+ const reason = failureReason(toolName, result);
108
+ if (!reason && !loop) {
109
+ state.failures.delete(toolName);
110
+ return undefined;
111
+ }
112
+ const failureCount = (state.failures.get(toolName) ?? 0) + 1;
113
+ state.failures.set(toolName, failureCount);
114
+ if (failureCount >= FAILURE_STOP_THRESHOLD && !state.stopReason) {
115
+ state.stopReason = `${toolName} failed ${failureCount} consecutive times.`;
116
+ }
117
+ const guidance = [
118
+ loop ? loopGuidance(loop) : '',
119
+ failureGuidance(toolName, reason ?? 'The repeated call was skipped.', failureCount),
120
+ ]
121
+ .filter(Boolean)
122
+ .join(' ');
123
+ return guidedResult(toolName, result, guidance);
124
+ },
125
+ });
126
+ const hook = createHook({
127
+ onTurnStart: ({ run }) => (state.stopReason ? run.cancel(state.stopReason) : undefined),
128
+ onToolCall: ({ toolName, args, internalCallId, tool }) => {
129
+ const signature = canonicalToolSignature(toolName, args);
130
+ state.toolCalls.push(signature);
131
+ const loop = repeatingSuffix(state.toolCalls);
132
+ if (!loop)
133
+ return undefined;
134
+ state.loopsByCall.set(internalCallId, loop);
135
+ if (loop.repetitions >= LOOP_STOP_THRESHOLD && !state.stopReason) {
136
+ state.stopReason = `A repeating tool-call pattern occurred ${loop.repetitions} times.`;
137
+ }
138
+ return tool.skip(loopGuidance(loop));
139
+ },
140
+ });
141
+ return { hook, middleware };
142
+ };
143
+ //# sourceMappingURL=agent-recovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-recovery.js","sourceRoot":"","sources":["../../../../src/modules/agent/services/agent-recovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AA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C,CAAC,CAAC,SAAS,CAAC;QACrF,UAAU,EAAE,CAAC,EAAC,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAC,EAAE,EAAE;YACtD,MAAM,SAAS,GAAG,sBAAsB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACzD,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAChC,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC9C,IAAI,CAAC,IAAI;gBAAE,OAAO,SAAS,CAAC;YAC5B,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;YAC5C,IAAI,IAAI,CAAC,WAAW,IAAI,mBAAmB,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;gBAClE,KAAK,CAAC,UAAU,GAAG,0CAA0C,IAAI,CAAC,WAAW,SAAS,CAAC;YACxF,CAAC;YACD,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QACtC,CAAC;KACD,CAAC,CAAC;IAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,CAAC;AAC3B,CAAC,CAAC"}
@@ -3,10 +3,12 @@ import type { SqliteMemoryStore } from '@anvia/memory-sqlite';
3
3
  import type { RuntimeEvent } from '../types.js';
4
4
  import type { SubmitRequest } from '../types.js';
5
5
  import type { FileToolService } from '../tools/files/file-tool-service.js';
6
- import type { PtyRunner } from '../../../libs/pty/index.js';
6
+ import { type PtyRunner } from '../../../libs/pty/index.js';
7
+ import type { LexaRuntime } from '../../../libs/lexa/index.js';
8
+ export declare const MAX_AGENT_TURNS = 50;
7
9
  export declare class PromptTurnExecutor {
8
10
  #private;
9
- constructor(projectRoot: string, memory: SqliteMemoryStore, pty: PtyRunner, files: FileToolService);
11
+ constructor(projectRoot: string, memory: SqliteMemoryStore, pty: PtyRunner, files: FileToolService, lexa: LexaRuntime);
10
12
  run(request: SubmitRequest, signal: AbortSignal, model: CompletionModel, sessionId: string): AsyncIterable<RuntimeEvent>;
11
13
  }
12
14
  //# sourceMappingURL=prompt-turn-executor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-turn-executor.d.ts","sourceRoot":"","sources":["../../../../src/modules/agent/services/prompt-turn-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,eAAe,EAAC,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAG/C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,qCAAqC,CAAC;AACzE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,4BAA4B,CAAC;AAK1D,qBAAa,kBAAkB;;IAM9B,YAAY,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAKjG;IAEM,GAAG,CACT,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,eAAe,EACtB,SAAS,EAAE,MAAM,GACf,aAAa,CAAC,YAAY,CAAC,CA6D7B;CACD"}
1
+ {"version":3,"file":"prompt-turn-executor.d.ts","sourceRoot":"","sources":["../../../../src/modules/agent/services/prompt-turn-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,eAAe,EAAC,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAG/C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAc,KAAK,SAAS,EAAC,MAAM,4BAA4B,CAAC;AAMvE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AAE7D,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,qBAAa,kBAAkB;;IAO9B,YACC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,eAAe,EACtB,IAAI,EAAE,WAAW,EAOjB;IAEM,GAAG,CACT,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,eAAe,EACtB,SAAS,EAAE,MAAM,GACf,aAAa,CAAC,YAAY,CAAC,CA0E7B;CACD"}