aura-code 0.3.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/LICENSE +21 -0
- package/README.md +137 -0
- package/dist/agent/context.d.ts +13 -0
- package/dist/agent/context.js +183 -0
- package/dist/agent/context.js.map +1 -0
- package/dist/agent/loop.d.ts +60 -0
- package/dist/agent/loop.js +228 -0
- package/dist/agent/loop.js.map +1 -0
- package/dist/agent/session-store.d.ts +30 -0
- package/dist/agent/session-store.js +178 -0
- package/dist/agent/session-store.js.map +1 -0
- package/dist/agent/spawner.d.ts +57 -0
- package/dist/agent/spawner.js +112 -0
- package/dist/agent/spawner.js.map +1 -0
- package/dist/agent/system-prompt.d.ts +3 -0
- package/dist/agent/system-prompt.js +100 -0
- package/dist/agent/system-prompt.js.map +1 -0
- package/dist/architect/engine.d.ts +47 -0
- package/dist/architect/engine.js +217 -0
- package/dist/architect/engine.js.map +1 -0
- package/dist/architect/types.d.ts +61 -0
- package/dist/architect/types.js +6 -0
- package/dist/architect/types.js.map +1 -0
- package/dist/cli/diamond.d.ts +1 -0
- package/dist/cli/diamond.js +23 -0
- package/dist/cli/diamond.js.map +1 -0
- package/dist/cli/display.d.ts +44 -0
- package/dist/cli/display.js +234 -0
- package/dist/cli/display.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +1734 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/config/defaults.d.ts +46 -0
- package/dist/config/defaults.js +106 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/project-config.d.ts +90 -0
- package/dist/config/project-config.js +141 -0
- package/dist/config/project-config.js.map +1 -0
- package/dist/harness/proposer.d.ts +26 -0
- package/dist/harness/proposer.js +204 -0
- package/dist/harness/proposer.js.map +1 -0
- package/dist/harness/weakness-miner.d.ts +28 -0
- package/dist/harness/weakness-miner.js +359 -0
- package/dist/harness/weakness-miner.js.map +1 -0
- package/dist/integrations/harnesses.d.ts +23 -0
- package/dist/integrations/harnesses.js +161 -0
- package/dist/integrations/harnesses.js.map +1 -0
- package/dist/orchestration/competence.d.ts +53 -0
- package/dist/orchestration/competence.js +181 -0
- package/dist/orchestration/competence.js.map +1 -0
- package/dist/orchestration/executor.d.ts +42 -0
- package/dist/orchestration/executor.js +206 -0
- package/dist/orchestration/executor.js.map +1 -0
- package/dist/orchestration/index.d.ts +20 -0
- package/dist/orchestration/index.js +39 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/orchestrator-prompts.d.ts +11 -0
- package/dist/orchestration/orchestrator-prompts.js +153 -0
- package/dist/orchestration/orchestrator-prompts.js.map +1 -0
- package/dist/orchestration/orchestrator.d.ts +27 -0
- package/dist/orchestration/orchestrator.js +169 -0
- package/dist/orchestration/orchestrator.js.map +1 -0
- package/dist/orchestration/plan-store.d.ts +53 -0
- package/dist/orchestration/plan-store.js +176 -0
- package/dist/orchestration/plan-store.js.map +1 -0
- package/dist/orchestration/router-prompts.d.ts +6 -0
- package/dist/orchestration/router-prompts.js +55 -0
- package/dist/orchestration/router-prompts.js.map +1 -0
- package/dist/orchestration/router.d.ts +23 -0
- package/dist/orchestration/router.js +70 -0
- package/dist/orchestration/router.js.map +1 -0
- package/dist/orchestration/ruby-detect.d.ts +6 -0
- package/dist/orchestration/ruby-detect.js +130 -0
- package/dist/orchestration/ruby-detect.js.map +1 -0
- package/dist/orchestration/ruby-types.d.ts +44 -0
- package/dist/orchestration/ruby-types.js +6 -0
- package/dist/orchestration/ruby-types.js.map +1 -0
- package/dist/orchestration/specialist-prompts.d.ts +19 -0
- package/dist/orchestration/specialist-prompts.js +143 -0
- package/dist/orchestration/specialist-prompts.js.map +1 -0
- package/dist/orchestration/specialists.d.ts +66 -0
- package/dist/orchestration/specialists.js +175 -0
- package/dist/orchestration/specialists.js.map +1 -0
- package/dist/orchestration/types.d.ts +82 -0
- package/dist/orchestration/types.js +6 -0
- package/dist/orchestration/types.js.map +1 -0
- package/dist/perception/extractor.d.ts +7 -0
- package/dist/perception/extractor.js +521 -0
- package/dist/perception/extractor.js.map +1 -0
- package/dist/perception/graph-store.d.ts +25 -0
- package/dist/perception/graph-store.js +117 -0
- package/dist/perception/graph-store.js.map +1 -0
- package/dist/perception/index.d.ts +4 -0
- package/dist/perception/index.js +18 -0
- package/dist/perception/index.js.map +1 -0
- package/dist/perception/queries.d.ts +29 -0
- package/dist/perception/queries.js +354 -0
- package/dist/perception/queries.js.map +1 -0
- package/dist/perception/types.d.ts +103 -0
- package/dist/perception/types.js +6 -0
- package/dist/perception/types.js.map +1 -0
- package/dist/providers/anthropic.d.ts +11 -0
- package/dist/providers/anthropic.js +172 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/factory.d.ts +58 -0
- package/dist/providers/factory.js +354 -0
- package/dist/providers/factory.js.map +1 -0
- package/dist/providers/fallback.d.ts +24 -0
- package/dist/providers/fallback.js +72 -0
- package/dist/providers/fallback.js.map +1 -0
- package/dist/providers/google.d.ts +11 -0
- package/dist/providers/google.js +129 -0
- package/dist/providers/google.js.map +1 -0
- package/dist/providers/openai-compatible.d.ts +24 -0
- package/dist/providers/openai-compatible.js +216 -0
- package/dist/providers/openai-compatible.js.map +1 -0
- package/dist/providers/resilient-factory.d.ts +24 -0
- package/dist/providers/resilient-factory.js +57 -0
- package/dist/providers/resilient-factory.js.map +1 -0
- package/dist/providers/resilient.d.ts +63 -0
- package/dist/providers/resilient.js +145 -0
- package/dist/providers/resilient.js.map +1 -0
- package/dist/providers/types.d.ts +84 -0
- package/dist/providers/types.js +6 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/ruby/alternator.d.ts +40 -0
- package/dist/ruby/alternator.js +233 -0
- package/dist/ruby/alternator.js.map +1 -0
- package/dist/ruby/competence.d.ts +34 -0
- package/dist/ruby/competence.js +264 -0
- package/dist/ruby/competence.js.map +1 -0
- package/dist/ruby/episode-capture.d.ts +56 -0
- package/dist/ruby/episode-capture.js +193 -0
- package/dist/ruby/episode-capture.js.map +1 -0
- package/dist/ruby/fine-tune.d.ts +16 -0
- package/dist/ruby/fine-tune.js +253 -0
- package/dist/ruby/fine-tune.js.map +1 -0
- package/dist/ruby/index.d.ts +10 -0
- package/dist/ruby/index.js +26 -0
- package/dist/ruby/index.js.map +1 -0
- package/dist/ruby/ruby-model.d.ts +36 -0
- package/dist/ruby/ruby-model.js +81 -0
- package/dist/ruby/ruby-model.js.map +1 -0
- package/dist/ruby/training-data.d.ts +11 -0
- package/dist/ruby/training-data.js +107 -0
- package/dist/ruby/training-data.js.map +1 -0
- package/dist/ruby/types.d.ts +136 -0
- package/dist/ruby/types.js +20 -0
- package/dist/ruby/types.js.map +1 -0
- package/dist/safety/permissions.d.ts +32 -0
- package/dist/safety/permissions.js +304 -0
- package/dist/safety/permissions.js.map +1 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +342 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/session.d.ts +22 -0
- package/dist/server/session.js +16 -0
- package/dist/server/session.js.map +1 -0
- package/dist/setup/first-run.d.ts +41 -0
- package/dist/setup/first-run.js +386 -0
- package/dist/setup/first-run.js.map +1 -0
- package/dist/setup/global-config.d.ts +19 -0
- package/dist/setup/global-config.js +97 -0
- package/dist/setup/global-config.js.map +1 -0
- package/dist/tools/audio-transcribe.d.ts +8 -0
- package/dist/tools/audio-transcribe.js +156 -0
- package/dist/tools/audio-transcribe.js.map +1 -0
- package/dist/tools/browser.d.ts +15 -0
- package/dist/tools/browser.js +241 -0
- package/dist/tools/browser.js.map +1 -0
- package/dist/tools/calendar.d.ts +12 -0
- package/dist/tools/calendar.js +196 -0
- package/dist/tools/calendar.js.map +1 -0
- package/dist/tools/clipboard.d.ts +7 -0
- package/dist/tools/clipboard.js +90 -0
- package/dist/tools/clipboard.js.map +1 -0
- package/dist/tools/cron.d.ts +10 -0
- package/dist/tools/cron.js +167 -0
- package/dist/tools/cron.js.map +1 -0
- package/dist/tools/edit-file.d.ts +6 -0
- package/dist/tools/edit-file.js +98 -0
- package/dist/tools/edit-file.js.map +1 -0
- package/dist/tools/email.d.ts +11 -0
- package/dist/tools/email.js +153 -0
- package/dist/tools/email.js.map +1 -0
- package/dist/tools/git.d.ts +1 -0
- package/dist/tools/git.js +7 -0
- package/dist/tools/git.js.map +1 -0
- package/dist/tools/http-request.d.ts +12 -0
- package/dist/tools/http-request.js +91 -0
- package/dist/tools/http-request.js.map +1 -0
- package/dist/tools/image-read.d.ts +7 -0
- package/dist/tools/image-read.js +125 -0
- package/dist/tools/image-read.js.map +1 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.js +201 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-dir.d.ts +1 -0
- package/dist/tools/list-dir.js +6 -0
- package/dist/tools/list-dir.js.map +1 -0
- package/dist/tools/mcp.d.ts +11 -0
- package/dist/tools/mcp.js +356 -0
- package/dist/tools/mcp.js.map +1 -0
- package/dist/tools/memory.d.ts +9 -0
- package/dist/tools/memory.js +124 -0
- package/dist/tools/memory.js.map +1 -0
- package/dist/tools/notify.d.ts +9 -0
- package/dist/tools/notify.js +40 -0
- package/dist/tools/notify.js.map +1 -0
- package/dist/tools/read-file.d.ts +6 -0
- package/dist/tools/read-file.js +76 -0
- package/dist/tools/read-file.js.map +1 -0
- package/dist/tools/run-shell.d.ts +1 -0
- package/dist/tools/run-shell.js +6 -0
- package/dist/tools/run-shell.js.map +1 -0
- package/dist/tools/run-tests.d.ts +1 -0
- package/dist/tools/run-tests.js +6 -0
- package/dist/tools/run-tests.js.map +1 -0
- package/dist/tools/search-code.d.ts +1 -0
- package/dist/tools/search-code.js +6 -0
- package/dist/tools/search-code.js.map +1 -0
- package/dist/tools/telegram-bot.d.ts +2 -0
- package/dist/tools/telegram-bot.js +693 -0
- package/dist/tools/telegram-bot.js.map +1 -0
- package/dist/tools/telegram-safety.d.ts +52 -0
- package/dist/tools/telegram-safety.js +189 -0
- package/dist/tools/telegram-safety.js.map +1 -0
- package/dist/tools/telegram.d.ts +16 -0
- package/dist/tools/telegram.js +227 -0
- package/dist/tools/telegram.js.map +1 -0
- package/dist/tools/tools.d.ts +48 -0
- package/dist/tools/tools.js +328 -0
- package/dist/tools/tools.js.map +1 -0
- package/dist/tools/web-fetch.d.ts +11 -0
- package/dist/tools/web-fetch.js +119 -0
- package/dist/tools/web-fetch.js.map +1 -0
- package/dist/tools/web-search.d.ts +8 -0
- package/dist/tools/web-search.js +81 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/tools/whatsapp.d.ts +10 -0
- package/dist/tools/whatsapp.js +222 -0
- package/dist/tools/whatsapp.js.map +1 -0
- package/dist/tools/write-file.d.ts +1 -0
- package/dist/tools/write-file.js +6 -0
- package/dist/tools/write-file.js.map +1 -0
- package/dist/tools/youtube-transcript.d.ts +9 -0
- package/dist/tools/youtube-transcript.js +200 -0
- package/dist/tools/youtube-transcript.js.map +1 -0
- package/dist/util/circuit-breaker.d.ts +44 -0
- package/dist/util/circuit-breaker.js +78 -0
- package/dist/util/circuit-breaker.js.map +1 -0
- package/dist/util/env.d.ts +18 -0
- package/dist/util/env.js +39 -0
- package/dist/util/env.js.map +1 -0
- package/dist/util/errors.d.ts +42 -0
- package/dist/util/errors.js +121 -0
- package/dist/util/errors.js.map +1 -0
- package/dist/util/rate-limiter.d.ts +71 -0
- package/dist/util/rate-limiter.js +141 -0
- package/dist/util/rate-limiter.js.map +1 -0
- package/dist/util/retry.d.ts +30 -0
- package/dist/util/retry.js +57 -0
- package/dist/util/retry.js.map +1 -0
- package/dist/util/sanitize.d.ts +16 -0
- package/dist/util/sanitize.js +255 -0
- package/dist/util/sanitize.js.map +1 -0
- package/dist/verify/checks.d.ts +21 -0
- package/dist/verify/checks.js +311 -0
- package/dist/verify/checks.js.map +1 -0
- package/dist/verify/index.d.ts +33 -0
- package/dist/verify/index.js +127 -0
- package/dist/verify/index.js.map +1 -0
- package/dist/verify/types.d.ts +20 -0
- package/dist/verify/types.js +3 -0
- package/dist/verify/types.js.map +1 -0
- package/dist/versioncheck.d.ts +22 -0
- package/dist/versioncheck.js +203 -0
- package/dist/versioncheck.js.map +1 -0
- package/dist/viz/index.d.ts +2 -0
- package/dist/viz/index.js +733 -0
- package/dist/viz/index.js.map +1 -0
- package/dist/workflows/engine.d.ts +46 -0
- package/dist/workflows/engine.js +320 -0
- package/dist/workflows/engine.js.map +1 -0
- package/dist/workflows/types.d.ts +92 -0
- package/dist/workflows/types.js +6 -0
- package/dist/workflows/types.js.map +1 -0
- package/package.json +86 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.proposalsDir = proposalsDir;
|
|
37
|
+
exports.generateProposals = generateProposals;
|
|
38
|
+
exports.listProposals = listProposals;
|
|
39
|
+
exports.defaultSystemPromptPath = defaultSystemPromptPath;
|
|
40
|
+
exports.applyHarnessProposal = applyHarnessProposal;
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
const child_process_1 = require("child_process");
|
|
44
|
+
const weakness_miner_js_1 = require("./weakness-miner.js");
|
|
45
|
+
const PATCH_REGISTRY = {
|
|
46
|
+
'no-tool-calls': {
|
|
47
|
+
section: '## How you operate',
|
|
48
|
+
anchor: '- When done, summarize exactly what you changed and why.',
|
|
49
|
+
patch: '- Never respond to a task with only prose. Always begin by using at least one tool (search_code, read_file, or list_dir) to investigate the codebase before summarizing or concluding. A response with zero tool calls is almost always incomplete.',
|
|
50
|
+
},
|
|
51
|
+
'file-not-created': {
|
|
52
|
+
section: '## How you operate',
|
|
53
|
+
anchor: '- If a tool returns an error, read the error carefully and adjust.',
|
|
54
|
+
patch: '- After calling write_file, verify the file exists by reading it back or checking with list_dir. If write_file fails, diagnose the error (permission, missing parent dir) and retry with the fix. Never move on after a failed write without attempting recovery.',
|
|
55
|
+
},
|
|
56
|
+
'explored-not-executed': {
|
|
57
|
+
section: '## How you operate',
|
|
58
|
+
anchor: '- When done, summarize exactly what you changed and why.',
|
|
59
|
+
patch: '- If the task requires a code change, you must eventually call write_file or edit_file to apply it. Do not spend all turns on read_file and search_code — at some point you must commit to making the change. Aim for a 2:1 ratio of reads to writes, not 100% reads.',
|
|
60
|
+
},
|
|
61
|
+
'test-regression': {
|
|
62
|
+
section: '## How you operate',
|
|
63
|
+
anchor: '- After making changes, run_tests to verify nothing broke.',
|
|
64
|
+
patch: '- When run_tests reports new failures you did not expect, immediately investigate and fix them before proceeding. Never leave the codebase in a state with more test failures than you started with. If you introduced a regression, roll back your change or fix it before moving on.',
|
|
65
|
+
},
|
|
66
|
+
'loop-exhausted': {
|
|
67
|
+
section: '## How you operate',
|
|
68
|
+
anchor: '- When done, summarize exactly what you changed and why.',
|
|
69
|
+
patch: '- Work efficiently. Do not repeat the same tool calls. If you have made 3+ attempts at the same approach without progress, try a fundamentally different strategy. Prioritize completing the task over perfect completion — a working partial solution is better than an exhausted loop.',
|
|
70
|
+
},
|
|
71
|
+
'safety-false-positive': {
|
|
72
|
+
section: '## Safety',
|
|
73
|
+
anchor: '- If a command seems destructive, explain what it does and ask for confirmation.',
|
|
74
|
+
patch: '- The safety system may occasionally block harmless commands (mkdir, ls, touch, cp, etc.). If a common file-manipulation command is blocked, try using write_file or edit_file as an alternative, or explain in your response that the safety layer is being overly cautious.',
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
78
|
+
// Paths
|
|
79
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
80
|
+
function proposalsDir() {
|
|
81
|
+
return path.join(process.env.HOME ?? '/tmp', '.aura', 'harness', 'proposals');
|
|
82
|
+
}
|
|
83
|
+
function proposalPath(id) {
|
|
84
|
+
return path.join(proposalsDir(), `${id}.json`);
|
|
85
|
+
}
|
|
86
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
87
|
+
// Generate proposals
|
|
88
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
89
|
+
function generateProposals(reportPath) {
|
|
90
|
+
const report = (0, weakness_miner_js_1.loadReport)(reportPath);
|
|
91
|
+
if (!report)
|
|
92
|
+
return [];
|
|
93
|
+
const proposals = [];
|
|
94
|
+
for (const p of report.patterns) {
|
|
95
|
+
const entry = PATCH_REGISTRY[p.pattern];
|
|
96
|
+
if (!entry)
|
|
97
|
+
continue;
|
|
98
|
+
const id = `patch-${Date.now()}-${p.pattern}`;
|
|
99
|
+
const proposal = {
|
|
100
|
+
id,
|
|
101
|
+
pattern: p.pattern,
|
|
102
|
+
description: p.description,
|
|
103
|
+
targetSection: entry.section,
|
|
104
|
+
patchText: entry.patch,
|
|
105
|
+
anchorText: entry.anchor,
|
|
106
|
+
createdAt: new Date().toISOString(),
|
|
107
|
+
status: 'proposed',
|
|
108
|
+
};
|
|
109
|
+
const outDir = proposalsDir();
|
|
110
|
+
if (!fs.existsSync(outDir))
|
|
111
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
112
|
+
fs.writeFileSync(proposalPath(id), JSON.stringify(proposal, null, 2), 'utf8');
|
|
113
|
+
proposals.push(proposal);
|
|
114
|
+
}
|
|
115
|
+
return proposals;
|
|
116
|
+
}
|
|
117
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
118
|
+
// List proposals
|
|
119
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
120
|
+
function listProposals() {
|
|
121
|
+
const dir = proposalsDir();
|
|
122
|
+
if (!fs.existsSync(dir))
|
|
123
|
+
return [];
|
|
124
|
+
const files = fs.readdirSync(dir).filter(f => f.endsWith('.json'));
|
|
125
|
+
const proposals = [];
|
|
126
|
+
for (const f of files) {
|
|
127
|
+
try {
|
|
128
|
+
const raw = fs.readFileSync(path.join(dir, f), 'utf8');
|
|
129
|
+
proposals.push(JSON.parse(raw));
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
// Skip malformed files
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return proposals;
|
|
136
|
+
}
|
|
137
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
138
|
+
// Apply a proposal (with rollback on test failure)
|
|
139
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
140
|
+
function defaultSystemPromptPath() {
|
|
141
|
+
return path.join(process.cwd(), 'src', 'agent', 'system-prompt.ts');
|
|
142
|
+
}
|
|
143
|
+
function applyHarnessProposal(id, opts = {}) {
|
|
144
|
+
const dir = opts.proposalsDir ?? proposalsDir();
|
|
145
|
+
const filePath = path.join(dir, `${id}.json`);
|
|
146
|
+
// 1. Load proposal
|
|
147
|
+
if (!fs.existsSync(filePath)) {
|
|
148
|
+
return { success: false, message: `Proposal not found: ${id}` };
|
|
149
|
+
}
|
|
150
|
+
let proposal;
|
|
151
|
+
try {
|
|
152
|
+
proposal = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return { success: false, message: `Invalid proposal file: ${filePath}` };
|
|
156
|
+
}
|
|
157
|
+
// 2. Read system-prompt.ts
|
|
158
|
+
const promptPath = opts.systemPromptPath ?? defaultSystemPromptPath();
|
|
159
|
+
if (!fs.existsSync(promptPath)) {
|
|
160
|
+
return { success: false, message: `System prompt not found: ${promptPath}` };
|
|
161
|
+
}
|
|
162
|
+
const original = fs.readFileSync(promptPath, 'utf8');
|
|
163
|
+
// 3. Find the anchor and insert the patch after it
|
|
164
|
+
const anchorIdx = original.indexOf(proposal.anchorText);
|
|
165
|
+
if (anchorIdx === -1) {
|
|
166
|
+
return { success: false, message: `Anchor text not found in system prompt: "${proposal.anchorText.slice(0, 60)}..."` };
|
|
167
|
+
}
|
|
168
|
+
const insertPos = anchorIdx + proposal.anchorText.length;
|
|
169
|
+
const patched = original.slice(0, insertPos) + '\n' + proposal.patchText + original.slice(insertPos);
|
|
170
|
+
// 4. Write patched file
|
|
171
|
+
fs.writeFileSync(promptPath, patched, 'utf8');
|
|
172
|
+
// 5. Update proposal status
|
|
173
|
+
proposal.status = 'applied';
|
|
174
|
+
fs.writeFileSync(filePath, JSON.stringify(proposal, null, 2), 'utf8');
|
|
175
|
+
// 6. Run tests
|
|
176
|
+
const testCmd = opts.testCommand ?? 'npm test 2>&1';
|
|
177
|
+
let testsPassed = false;
|
|
178
|
+
try {
|
|
179
|
+
const output = (0, child_process_1.execSync)(testCmd, {
|
|
180
|
+
encoding: 'utf8',
|
|
181
|
+
timeout: 120_000,
|
|
182
|
+
cwd: process.cwd(),
|
|
183
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
184
|
+
});
|
|
185
|
+
// Check for failures in output — look for non-zero failure counts
|
|
186
|
+
const hasFailure = /[1-9]\d* tests? (fail|failed|failing)/i.test(output) ||
|
|
187
|
+
/FAIL\s/i.test(output) ||
|
|
188
|
+
/Tests:.*\s[1-9]\d*\s+failed/i.test(output);
|
|
189
|
+
testsPassed = !hasFailure;
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
// Non-zero exit code = test failure
|
|
193
|
+
testsPassed = false;
|
|
194
|
+
}
|
|
195
|
+
// 7. Revert if tests failed
|
|
196
|
+
if (!testsPassed) {
|
|
197
|
+
fs.writeFileSync(promptPath, original, 'utf8');
|
|
198
|
+
proposal.status = 'reverted';
|
|
199
|
+
fs.writeFileSync(filePath, JSON.stringify(proposal, null, 2), 'utf8');
|
|
200
|
+
return { success: false, message: 'Tests failed after patch — reverted.' };
|
|
201
|
+
}
|
|
202
|
+
return { success: true, message: `Patch applied: ${proposal.pattern} → ${proposal.targetSection}` };
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=proposer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proposer.js","sourceRoot":"","sources":["../../src/harness/proposer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,oCAEC;AAUD,8CA6BC;AAMD,sCAiBC;AAMD,0DAEC;AAED,oDAwEC;AAzND,uCAAyB;AACzB,2CAA6B;AAC7B,iDAAyC;AACzC,2DAAiD;AA+BjD,MAAM,cAAc,GAA6C;IAC/D,eAAe,EAAE;QACf,OAAO,EAAE,oBAAoB;QAC7B,MAAM,EAAE,0DAA0D;QAClE,KAAK,EAAE,qPAAqP;KA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AG,KAAK,CAAC;IACxB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,OAAO,EAAE;YAC/B,QAAQ,EAAE,MAAM;YAChB,OAAO,EAAE,OAAO;YAChB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;YAClB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC;QACH,kEAAkE;QAClE,MAAM,UAAU,GAAG,wCAAwC,CAAC,IAAI,CAAC,MAAM,CAAC;YACtE,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;YACtB,8BAA8B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9C,WAAW,GAAG,CAAC,UAAU,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,oCAAoC;QACpC,WAAW,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC/C,QAAQ,CAAC,MAAM,GAAG,UAAU,CAAC;QAC7B,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QACtE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,sCAAsC,EAAE,CAAC;IAC7E,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,QAAQ,CAAC,OAAO,MAAM,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC;AACtG,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type PatternName = 'no-tool-calls' | 'file-not-created' | 'explored-not-executed' | 'test-regression' | 'loop-exhausted' | 'safety-false-positive';
|
|
2
|
+
export interface WeaknessOccurrence {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
sessionTitle: string;
|
|
5
|
+
/** The user task that triggered this pattern */
|
|
6
|
+
exampleTask: string;
|
|
7
|
+
/** Brief description of the failure */
|
|
8
|
+
exampleFailure: string;
|
|
9
|
+
timestamp: string;
|
|
10
|
+
}
|
|
11
|
+
export interface PatternReport {
|
|
12
|
+
pattern: PatternName;
|
|
13
|
+
frequency: number;
|
|
14
|
+
description: string;
|
|
15
|
+
occurrences: WeaknessOccurrence[];
|
|
16
|
+
promptPatch: string;
|
|
17
|
+
}
|
|
18
|
+
export interface WeaknessReport {
|
|
19
|
+
generatedAt: string;
|
|
20
|
+
sessionsAnalyzed: number;
|
|
21
|
+
patterns: PatternReport[];
|
|
22
|
+
summary: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function sessionDir(): string;
|
|
25
|
+
export declare function mineWeaknesses(customDir?: string): WeaknessReport;
|
|
26
|
+
export declare function reportPath(): string;
|
|
27
|
+
export declare function saveReport(report: WeaknessReport, customPath?: string): string;
|
|
28
|
+
export declare function loadReport(customPath?: string): WeaknessReport | null;
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.sessionDir = sessionDir;
|
|
37
|
+
exports.mineWeaknesses = mineWeaknesses;
|
|
38
|
+
exports.reportPath = reportPath;
|
|
39
|
+
exports.saveReport = saveReport;
|
|
40
|
+
exports.loadReport = loadReport;
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
// Harmless commands that should not be blocked by the safety layer
|
|
44
|
+
const HARMLESS_COMMANDS = [
|
|
45
|
+
'mkdir', 'ls', 'cat', 'echo', 'pwd', 'touch', 'cp', 'mv',
|
|
46
|
+
'git status', 'git log', 'git diff', 'git show', 'git add', 'git commit',
|
|
47
|
+
'npm test', 'npm run', 'npx', 'node', 'tsc',
|
|
48
|
+
'which', 'find', 'grep', 'rg',
|
|
49
|
+
];
|
|
50
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
51
|
+
// Session file reading
|
|
52
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
53
|
+
function sessionDir() {
|
|
54
|
+
return process.env.AURA_SESSION_DIR ?? path.join(process.env.HOME ?? '/tmp', '.aura', 'sessions');
|
|
55
|
+
}
|
|
56
|
+
function loadAllSessions(baseDir) {
|
|
57
|
+
const sessions = [];
|
|
58
|
+
if (!fs.existsSync(baseDir))
|
|
59
|
+
return sessions;
|
|
60
|
+
const entries = fs.readdirSync(baseDir, { withFileTypes: true });
|
|
61
|
+
for (const entry of entries) {
|
|
62
|
+
const fullPath = path.join(baseDir, entry.name);
|
|
63
|
+
if (entry.isDirectory()) {
|
|
64
|
+
// Project subdirectory — scan for session files inside
|
|
65
|
+
const subFiles = fs.readdirSync(fullPath).filter(f => f.endsWith('.json') && !f.endsWith('.tmp'));
|
|
66
|
+
for (const f of subFiles) {
|
|
67
|
+
const session = parseSessionFile(path.join(fullPath, f));
|
|
68
|
+
if (session)
|
|
69
|
+
sessions.push(session);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else if (entry.isFile() && entry.name.endsWith('.json') && !entry.name.endsWith('.tmp')) {
|
|
73
|
+
const session = parseSessionFile(fullPath);
|
|
74
|
+
if (session)
|
|
75
|
+
sessions.push(session);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return sessions;
|
|
79
|
+
}
|
|
80
|
+
function parseSessionFile(filePath) {
|
|
81
|
+
try {
|
|
82
|
+
const raw = fs.readFileSync(filePath, 'utf8');
|
|
83
|
+
const parsed = JSON.parse(raw);
|
|
84
|
+
if (!Array.isArray(parsed.history) || parsed.history.length === 0)
|
|
85
|
+
return null;
|
|
86
|
+
// Derive id from filename if missing
|
|
87
|
+
if (!parsed.id)
|
|
88
|
+
parsed.id = path.basename(filePath, '.json');
|
|
89
|
+
return parsed;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function getUserTask(history) {
|
|
96
|
+
const first = history.find(m => m.role === 'user');
|
|
97
|
+
if (!first)
|
|
98
|
+
return '(unknown task)';
|
|
99
|
+
return typeof first.content === 'string' ? first.content.slice(0, 120) : '(unknown task)';
|
|
100
|
+
}
|
|
101
|
+
function getTimestamp(session) {
|
|
102
|
+
return session.updatedAt ?? session.savedAt ?? session.createdAt ?? '(unknown time)';
|
|
103
|
+
}
|
|
104
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
105
|
+
// Pattern detectors
|
|
106
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
107
|
+
function collectToolCalls(history) {
|
|
108
|
+
const calls = [];
|
|
109
|
+
for (const msg of history) {
|
|
110
|
+
if (msg.role === 'assistant' && 'toolCalls' in msg && msg.toolCalls) {
|
|
111
|
+
calls.push(...msg.toolCalls);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return calls;
|
|
115
|
+
}
|
|
116
|
+
function collectToolResults(history) {
|
|
117
|
+
const results = [];
|
|
118
|
+
for (const msg of history) {
|
|
119
|
+
if (msg.role === 'tool_result' && 'results' in msg) {
|
|
120
|
+
results.push(...msg.results);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return results;
|
|
124
|
+
}
|
|
125
|
+
function hasAssistantProse(history) {
|
|
126
|
+
return history.some(m => m.role === 'assistant' && 'content' in m && typeof m.content === 'string' && m.content.trim().length > 20);
|
|
127
|
+
}
|
|
128
|
+
/** no-tool-calls: assistant responded with prose but zero tool invocations */
|
|
129
|
+
function detectNoToolCalls(session) {
|
|
130
|
+
const calls = collectToolCalls(session.history);
|
|
131
|
+
if (calls.length > 0)
|
|
132
|
+
return null;
|
|
133
|
+
if (!hasAssistantProse(session.history))
|
|
134
|
+
return null;
|
|
135
|
+
return {
|
|
136
|
+
sessionId: session.id ?? '(unknown)',
|
|
137
|
+
sessionTitle: session.title ?? '(untitled)',
|
|
138
|
+
exampleTask: getUserTask(session.history),
|
|
139
|
+
exampleFailure: 'Agent responded with prose only — no tool calls were made to investigate or solve the task.',
|
|
140
|
+
timestamp: getTimestamp(session),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** file-not-created: write_file was called but the target file doesn't exist on disk */
|
|
144
|
+
function detectFileNotCreated(session) {
|
|
145
|
+
const calls = collectToolCalls(session.history);
|
|
146
|
+
const results = collectToolResults(session.history);
|
|
147
|
+
const occurrences = [];
|
|
148
|
+
for (const call of calls) {
|
|
149
|
+
if (call.name !== 'write_file')
|
|
150
|
+
continue;
|
|
151
|
+
const filePath = String(call.input.path ?? '');
|
|
152
|
+
if (!filePath)
|
|
153
|
+
continue;
|
|
154
|
+
// Check if the corresponding tool result indicates an error
|
|
155
|
+
const matchingResult = results.find(r => r.id === call.id);
|
|
156
|
+
if (matchingResult?.isError) {
|
|
157
|
+
occurrences.push({
|
|
158
|
+
sessionId: session.id ?? '(unknown)',
|
|
159
|
+
sessionTitle: session.title ?? '(untitled)',
|
|
160
|
+
exampleTask: getUserTask(session.history),
|
|
161
|
+
exampleFailure: `write_file called for "${filePath}" but the operation reported an error: ${matchingResult.content.slice(0, 100)}`,
|
|
162
|
+
timestamp: getTimestamp(session),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return occurrences;
|
|
167
|
+
}
|
|
168
|
+
/** explored-not-executed: only read operations (read_file, search_code, list_dir), no writes */
|
|
169
|
+
function detectExploredNotExecuted(session) {
|
|
170
|
+
const calls = collectToolCalls(session.history);
|
|
171
|
+
if (calls.length === 0)
|
|
172
|
+
return null;
|
|
173
|
+
const readOnlyTools = ['read_file', 'search_code', 'list_dir', 'git_status', 'git_diff'];
|
|
174
|
+
const writeTools = ['write_file', 'edit_file', 'run_shell', 'run_tests', 'spawn_task'];
|
|
175
|
+
const hasOnlyReadOnly = calls.every(c => readOnlyTools.includes(c.name));
|
|
176
|
+
const hasWriteAttempt = calls.some(c => writeTools.includes(c.name));
|
|
177
|
+
if (!hasOnlyReadOnly || hasWriteAttempt)
|
|
178
|
+
return null;
|
|
179
|
+
return {
|
|
180
|
+
sessionId: session.id ?? '(unknown)',
|
|
181
|
+
sessionTitle: session.title ?? '(untitled)',
|
|
182
|
+
exampleTask: getUserTask(session.history),
|
|
183
|
+
exampleFailure: `Agent made ${calls.length} read-only calls (${Array.from(new Set(calls.map(c => c.name))).join(', ')}) but never attempted to write or execute anything.`,
|
|
184
|
+
timestamp: getTimestamp(session),
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
/** test-regression: run_tests was called and the result indicates new failures */
|
|
188
|
+
function detectTestRegression(session) {
|
|
189
|
+
const results = collectToolResults(session.history);
|
|
190
|
+
const calls = collectToolCalls(session.history);
|
|
191
|
+
// Only flag if run_tests was actually called
|
|
192
|
+
const testCalls = calls.filter(c => c.name === 'run_tests');
|
|
193
|
+
if (testCalls.length === 0)
|
|
194
|
+
return null;
|
|
195
|
+
// Look for test results with errors
|
|
196
|
+
const testResults = results.filter(r => r.name === 'run_tests' || r.name === 'run_shell');
|
|
197
|
+
const failedResult = testResults.find(r => {
|
|
198
|
+
if (r.isError)
|
|
199
|
+
return true;
|
|
200
|
+
const content = r.content.toLowerCase();
|
|
201
|
+
return content.includes('failed') || content.includes('failing') || content.includes('error') ||
|
|
202
|
+
content.includes('FAIL ') || content.includes('✗') || content.includes('❌');
|
|
203
|
+
});
|
|
204
|
+
if (!failedResult)
|
|
205
|
+
return null;
|
|
206
|
+
return {
|
|
207
|
+
sessionId: session.id ?? '(unknown)',
|
|
208
|
+
sessionTitle: session.title ?? '(untitled)',
|
|
209
|
+
exampleTask: getUserTask(session.history),
|
|
210
|
+
exampleFailure: `Tests showed failures: ${failedResult.content.slice(0, 150)}`,
|
|
211
|
+
timestamp: getTimestamp(session),
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/** loop-exhausted: the session ended with the "Loop ended after N turns" message */
|
|
215
|
+
function detectLoopExhausted(session) {
|
|
216
|
+
const lastAssistant = [...session.history].reverse().find(m => m.role === 'assistant');
|
|
217
|
+
if (!lastAssistant || !('content' in lastAssistant))
|
|
218
|
+
return null;
|
|
219
|
+
const content = String(lastAssistant.content ?? '');
|
|
220
|
+
if (!content.includes('Loop ended after') && !content.includes('maxTurns'))
|
|
221
|
+
return null;
|
|
222
|
+
return {
|
|
223
|
+
sessionId: session.id ?? '(unknown)',
|
|
224
|
+
sessionTitle: session.title ?? '(untitled)',
|
|
225
|
+
exampleTask: getUserTask(session.history),
|
|
226
|
+
exampleFailure: `Loop exhausted: ${content.slice(0, 150)}`,
|
|
227
|
+
timestamp: getTimestamp(session),
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
/** safety-false-positive: run_shell was blocked on a harmless command */
|
|
231
|
+
function detectSafetyFalsePositive(session) {
|
|
232
|
+
const results = collectToolResults(session.history);
|
|
233
|
+
const calls = collectToolCalls(session.history);
|
|
234
|
+
const occurrences = [];
|
|
235
|
+
for (const result of results) {
|
|
236
|
+
if (!result.isError)
|
|
237
|
+
continue;
|
|
238
|
+
const content = result.content.toLowerCase();
|
|
239
|
+
if (!content.includes('blocked') && !content.includes('dangerous') && !content.includes('not allowed'))
|
|
240
|
+
continue;
|
|
241
|
+
// Find the matching call to get the command
|
|
242
|
+
const matchingCall = calls.find(c => c.id === result.id);
|
|
243
|
+
if (!matchingCall || matchingCall.name !== 'run_shell')
|
|
244
|
+
continue;
|
|
245
|
+
const cmd = String(matchingCall.input.command ?? '');
|
|
246
|
+
const isHarmless = HARMLESS_COMMANDS.some(h => cmd.toLowerCase().trim().startsWith(h));
|
|
247
|
+
if (isHarmless) {
|
|
248
|
+
occurrences.push({
|
|
249
|
+
sessionId: session.id ?? '(unknown)',
|
|
250
|
+
sessionTitle: session.title ?? '(untitled)',
|
|
251
|
+
exampleTask: getUserTask(session.history),
|
|
252
|
+
exampleFailure: `Harmless command "${cmd.slice(0, 80)}" was blocked by safety system: ${result.content.slice(0, 100)}`,
|
|
253
|
+
timestamp: getTimestamp(session),
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return occurrences;
|
|
258
|
+
}
|
|
259
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
260
|
+
// Prompt patch suggestions
|
|
261
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
262
|
+
const PROMPT_PATCHES = {
|
|
263
|
+
'no-tool-calls': 'PATCH: Add to system prompt — "Never respond to a task with only prose. Always begin by using at least one tool (search_code, read_file, or list_dir) to investigate the codebase before summarizing or concluding. A response with zero tool calls is almost always incomplete."',
|
|
264
|
+
'file-not-created': 'PATCH: Add to system prompt — "After calling write_file, verify the file exists by reading it back or checking with list_dir. If write_file fails, diagnose the error (permission, missing parent dir) and retry with the fix. Never move on after a failed write without attempting recovery."',
|
|
265
|
+
'explored-not-executed': 'PATCH: Add to system prompt — "If the task requires a code change, you must eventually call write_file or edit_file to apply it. Do not spend all turns on read_file and search_code — at some point you must commit to making the change. Aim for a 2:1 ratio of reads to writes, not 100% reads."',
|
|
266
|
+
'test-regression': 'PATCH: Add to system prompt — "When run_tests reports new failures you did not expect, immediately investigate and fix them before proceeding. Never leave the codebase in a state with more test failures than you started with. If you introduced a regression, roll back your change or fix it before moving on."',
|
|
267
|
+
'loop-exhausted': 'PATCH: Add to system prompt — "Work efficiently. Do not repeat the same tool calls. If you have made 3+ attempts at the same approach without progress, try a fundamentally different strategy. Prioritize completing the task over perfect completion — a working partial solution is better than an exhausted loop."',
|
|
268
|
+
'safety-false-positive': 'PATCH: Review DANGEROUS_PATTERNS and SAFE_SHELL_COMMANDS in config/defaults.ts. The safety system is blocking commands that are harmless. Add the blocked command prefix to SAFE_SHELL_COMMANDS, or refine the regex in DANGEROUS_PATTERNS to avoid over-matching. Consider allowing mkdir, touch, and other common file-manipulation commands without confirmation.',
|
|
269
|
+
};
|
|
270
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
271
|
+
// Main miner
|
|
272
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
273
|
+
function mineWeaknesses(customDir) {
|
|
274
|
+
const dir = customDir ?? sessionDir();
|
|
275
|
+
const sessions = loadAllSessions(dir);
|
|
276
|
+
const rawOccurrences = {
|
|
277
|
+
'no-tool-calls': [],
|
|
278
|
+
'file-not-created': [],
|
|
279
|
+
'explored-not-executed': [],
|
|
280
|
+
'test-regression': [],
|
|
281
|
+
'loop-exhausted': [],
|
|
282
|
+
'safety-false-positive': [],
|
|
283
|
+
};
|
|
284
|
+
for (const session of sessions) {
|
|
285
|
+
const noTool = detectNoToolCalls(session);
|
|
286
|
+
if (noTool)
|
|
287
|
+
rawOccurrences['no-tool-calls'].push(noTool);
|
|
288
|
+
rawOccurrences['file-not-created'].push(...detectFileNotCreated(session));
|
|
289
|
+
const explored = detectExploredNotExecuted(session);
|
|
290
|
+
if (explored)
|
|
291
|
+
rawOccurrences['explored-not-executed'].push(explored);
|
|
292
|
+
const regression = detectTestRegression(session);
|
|
293
|
+
if (regression)
|
|
294
|
+
rawOccurrences['test-regression'].push(regression);
|
|
295
|
+
const exhausted = detectLoopExhausted(session);
|
|
296
|
+
if (exhausted)
|
|
297
|
+
rawOccurrences['loop-exhausted'].push(exhausted);
|
|
298
|
+
rawOccurrences['safety-false-positive'].push(...detectSafetyFalsePositive(session));
|
|
299
|
+
}
|
|
300
|
+
// Only include patterns with 2+ occurrences
|
|
301
|
+
const patterns = [];
|
|
302
|
+
for (const [name, occurrences] of Object.entries(rawOccurrences)) {
|
|
303
|
+
if (occurrences.length < 2)
|
|
304
|
+
continue;
|
|
305
|
+
patterns.push({
|
|
306
|
+
pattern: name,
|
|
307
|
+
frequency: occurrences.length,
|
|
308
|
+
description: PATTERN_DESCRIPTIONS[name],
|
|
309
|
+
occurrences,
|
|
310
|
+
promptPatch: PROMPT_PATCHES[name],
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
// Sort by frequency descending
|
|
314
|
+
patterns.sort((a, b) => b.frequency - a.frequency);
|
|
315
|
+
const totalWeaknesses = patterns.reduce((sum, p) => sum + p.frequency, 0);
|
|
316
|
+
const summary = patterns.length === 0
|
|
317
|
+
? 'No recurring weakness patterns detected across all sessions. Agent behavior looks healthy.'
|
|
318
|
+
: `Found ${patterns.length} recurring pattern(s) across ${sessions.length} session(s) with ${totalWeaknesses} total occurrences. Top issue: ${patterns[0]?.pattern} (${patterns[0]?.frequency}x).`;
|
|
319
|
+
return {
|
|
320
|
+
generatedAt: new Date().toISOString(),
|
|
321
|
+
sessionsAnalyzed: sessions.length,
|
|
322
|
+
patterns,
|
|
323
|
+
summary,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
const PATTERN_DESCRIPTIONS = {
|
|
327
|
+
'no-tool-calls': 'Agent responded with prose only — no tool calls were made to investigate or solve the task.',
|
|
328
|
+
'file-not-created': 'Agent called write_file but the operation failed (file not created on disk).',
|
|
329
|
+
'explored-not-executed': 'Agent only performed read operations (read_file, search_code, list_dir) without writing or executing anything.',
|
|
330
|
+
'test-regression': 'Agent introduced new test failures during the session.',
|
|
331
|
+
'loop-exhausted': 'Agent loop hit the max turn limit without completing the task.',
|
|
332
|
+
'safety-false-positive': 'Safety system blocked a harmless shell command, preventing the agent from working.',
|
|
333
|
+
};
|
|
334
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
335
|
+
// Report persistence
|
|
336
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
337
|
+
function reportPath() {
|
|
338
|
+
return path.join(process.env.HOME ?? '/tmp', '.aura', 'harness', 'weakness-report.json');
|
|
339
|
+
}
|
|
340
|
+
function saveReport(report, customPath) {
|
|
341
|
+
const filePath = customPath ?? reportPath();
|
|
342
|
+
const dir = path.dirname(filePath);
|
|
343
|
+
if (!fs.existsSync(dir))
|
|
344
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
345
|
+
fs.writeFileSync(filePath, JSON.stringify(report, null, 2), 'utf8');
|
|
346
|
+
return filePath;
|
|
347
|
+
}
|
|
348
|
+
function loadReport(customPath) {
|
|
349
|
+
const filePath = customPath ?? reportPath();
|
|
350
|
+
if (!fs.existsSync(filePath))
|
|
351
|
+
return null;
|
|
352
|
+
try {
|
|
353
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
354
|
+
}
|
|
355
|
+
catch {
|
|
356
|
+
return null;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
//# sourceMappingURL=weakness-miner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"weakness-miner.js","sourceRoot":"","sources":["../../src/harness/weakness-miner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,gCAEC;AA4PD,wCA0DC;AAeD,gCAEC;AAED,gCAMC;AAED,gCAQC;AAhZD,uCAAyB;AACzB,2CAA6B;AAwC7B,mEAAmE;AACnE,MAAM,iBAAiB,GAAG;IACxB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI;IACxD,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY;IACxE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK;IAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI;CAC9B,CAAC;AAEF,gFAAgF;AAChF,uBAAuB;AACvB,gFAAgF;AAEhF,SAAgB,UAAU;IACxB,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AACpG,CAAC;AAYD,SAAS,eAAe,CAAC,OAAe;IACtC,MAAM,QAAQ,GAAiB,EAAE,CAAC;IAClC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,QAAQ,CAAC;IAE7C,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,KAAK,MAAM,KAAK,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;CAC9G,CAAC;AAEF,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF;AAEhF,SAAgB,UAAU;IACxB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,sBAAsB,CAAC,CAAC;AAC3F,CAAC;AAED,SAAgB,UAAU,CAAC,MAAsB,EAAE,UAAmB;IACpE,MAAM,QAAQ,GAAG,UAAU,IAAI,UAAU,EAAE,CAAC;IAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACpE,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAgB,UAAU,CAAC,UAAmB;IAC5C,MAAM,QAAQ,GAAG,UAAU,IAAI,UAAU,EAAE,CAAC;IAC5C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1C,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAmB,CAAC;IACzE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface ExternalHarness {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
command: string;
|
|
5
|
+
role: string;
|
|
6
|
+
status: 'available' | 'missing' | 'partial';
|
|
7
|
+
path?: string;
|
|
8
|
+
version?: string;
|
|
9
|
+
notes: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface HermesStatus {
|
|
12
|
+
home: string;
|
|
13
|
+
workspace: string;
|
|
14
|
+
homeExists: boolean;
|
|
15
|
+
workspaceExists: boolean;
|
|
16
|
+
scripts: string[];
|
|
17
|
+
skills: string[];
|
|
18
|
+
skillCount: number;
|
|
19
|
+
processStateExists: boolean;
|
|
20
|
+
gatewayStateExists: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function getHarnessStatus(): ExternalHarness[];
|
|
23
|
+
export declare function getHermesStatus(): HermesStatus;
|