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,176 @@
|
|
|
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.planStore = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
// Serialises concurrent writes to the same memory file so parallel steps
|
|
40
|
+
// cannot clobber each other's entries (read-modify-write race condition).
|
|
41
|
+
const writeLocks = new Map();
|
|
42
|
+
/**
|
|
43
|
+
* On-disk persistence for execution plans and orchestration memory.
|
|
44
|
+
*
|
|
45
|
+
* Plans are stored as individual JSON files under ~/.aura/plans/{id}.json
|
|
46
|
+
* so they survive process restarts and can be inspected or replayed.
|
|
47
|
+
*
|
|
48
|
+
* Per-project memory is appended to {projectRoot}/.aura/memory.json and
|
|
49
|
+
* keyed by a string so specialists can share facts across steps.
|
|
50
|
+
*/
|
|
51
|
+
exports.planStore = {
|
|
52
|
+
/** Returns the directory where plan files are stored. */
|
|
53
|
+
plansDir() {
|
|
54
|
+
return path.join(process.env.HOME ?? '/tmp', '.aura', 'plans');
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Persists an execution plan to ~/.aura/plans/{id}.json.
|
|
58
|
+
* Uses a .tmp rename to avoid corrupt files on crash.
|
|
59
|
+
*/
|
|
60
|
+
async save(plan) {
|
|
61
|
+
const dir = this.plansDir();
|
|
62
|
+
if (!fs.existsSync(dir))
|
|
63
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
64
|
+
const filePath = path.join(dir, `${plan.id}.json`);
|
|
65
|
+
const tmp = filePath + '.tmp';
|
|
66
|
+
await fs.promises.writeFile(tmp, JSON.stringify(plan, null, 2), 'utf8');
|
|
67
|
+
await fs.promises.rename(tmp, filePath);
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* Loads a plan by id.
|
|
71
|
+
* Returns `null` if the file does not exist or cannot be parsed.
|
|
72
|
+
*/
|
|
73
|
+
async load(id) {
|
|
74
|
+
const filePath = path.join(this.plansDir(), `${id}.json`);
|
|
75
|
+
if (!fs.existsSync(filePath))
|
|
76
|
+
return null;
|
|
77
|
+
const raw = await fs.promises.readFile(filePath, 'utf8');
|
|
78
|
+
try {
|
|
79
|
+
return JSON.parse(raw);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* Returns all saved plans, most recently created first.
|
|
87
|
+
* Silently skips files that cannot be parsed.
|
|
88
|
+
*/
|
|
89
|
+
async list() {
|
|
90
|
+
const dir = this.plansDir();
|
|
91
|
+
if (!fs.existsSync(dir))
|
|
92
|
+
return [];
|
|
93
|
+
const files = fs.readdirSync(dir).filter(f => f.endsWith('.json'));
|
|
94
|
+
const plans = [];
|
|
95
|
+
for (const file of files) {
|
|
96
|
+
const raw = await fs.promises.readFile(path.join(dir, file), 'utf8');
|
|
97
|
+
try {
|
|
98
|
+
plans.push(JSON.parse(raw));
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
/* skip corrupt file */
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return plans.sort((a, b) => b.created - a.created);
|
|
105
|
+
},
|
|
106
|
+
/**
|
|
107
|
+
* Removes a plan file from disk.
|
|
108
|
+
* Resolves silently if the file does not exist.
|
|
109
|
+
*/
|
|
110
|
+
async delete(id) {
|
|
111
|
+
const filePath = path.join(this.plansDir(), `${id}.json`);
|
|
112
|
+
if (!fs.existsSync(filePath))
|
|
113
|
+
return;
|
|
114
|
+
await fs.promises.unlink(filePath);
|
|
115
|
+
},
|
|
116
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
117
|
+
// Per-project orchestration memory
|
|
118
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
119
|
+
/** Returns the path to the memory file for a given project root. */
|
|
120
|
+
memoryPath(projectRoot) {
|
|
121
|
+
return path.join(projectRoot, '.aura', 'memory.json');
|
|
122
|
+
},
|
|
123
|
+
/**
|
|
124
|
+
* Appends a memory entry to {projectRoot}/.aura/memory.json.
|
|
125
|
+
* Creates the file (and parent directory) if they do not yet exist.
|
|
126
|
+
* Uses a .tmp rename to avoid corrupt files on crash.
|
|
127
|
+
*/
|
|
128
|
+
async saveMemory(projectRoot, entry) {
|
|
129
|
+
const filePath = this.memoryPath(projectRoot);
|
|
130
|
+
const existing = writeLocks.get(filePath) ?? Promise.resolve();
|
|
131
|
+
const next = existing.then(async () => {
|
|
132
|
+
const dir = path.dirname(filePath);
|
|
133
|
+
if (!fs.existsSync(dir))
|
|
134
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
135
|
+
const entries = await this.listMemory(projectRoot);
|
|
136
|
+
entries.push(entry);
|
|
137
|
+
const tmp = filePath + '.tmp';
|
|
138
|
+
await fs.promises.writeFile(tmp, JSON.stringify(entries, null, 2), 'utf8');
|
|
139
|
+
await fs.promises.rename(tmp, filePath);
|
|
140
|
+
});
|
|
141
|
+
writeLocks.set(filePath, next);
|
|
142
|
+
return next;
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* Returns the most recent memory entry matching `key`, or `null` if none
|
|
146
|
+
* exists. When multiple entries share the same key, the latest timestamp
|
|
147
|
+
* wins.
|
|
148
|
+
*/
|
|
149
|
+
async getMemory(projectRoot, key) {
|
|
150
|
+
const all = await this.listMemory(projectRoot);
|
|
151
|
+
const matches = all.filter(e => e.key === key);
|
|
152
|
+
if (matches.length === 0)
|
|
153
|
+
return null;
|
|
154
|
+
return matches.reduce((best, e) => (e.timestamp > best.timestamp ? e : best));
|
|
155
|
+
},
|
|
156
|
+
/**
|
|
157
|
+
* Returns all memory entries for a project, sorted newest-first.
|
|
158
|
+
* Returns an empty array if the memory file does not exist.
|
|
159
|
+
*/
|
|
160
|
+
async listMemory(projectRoot) {
|
|
161
|
+
const filePath = this.memoryPath(projectRoot);
|
|
162
|
+
if (!fs.existsSync(filePath))
|
|
163
|
+
return [];
|
|
164
|
+
const raw = await fs.promises.readFile(filePath, 'utf8');
|
|
165
|
+
try {
|
|
166
|
+
const parsed = JSON.parse(raw);
|
|
167
|
+
return Array.isArray(parsed)
|
|
168
|
+
? parsed.sort((a, b) => b.timestamp - a.timestamp)
|
|
169
|
+
: [];
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
return [];
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
//# sourceMappingURL=plan-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-store.js","sourceRoot":"","sources":["../../src/orchestration/plan-store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAG7B,yEAAyE;AACzE,0EAA0E;AAC1E,MAAM,UAAU,GAAG,IAAI,GAAG,EAAyB,CAAC;AAEpD;;;;;;;;GAQG;AACU,QAAA,SAAS,GAAG;IACvB,yDAAyD;IACzD,QAAQ;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,IAAmB;QAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC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AAC,UAAU,CAAC,WAAmB;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC9C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,OAAO,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACzD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAY,CAAC;YAC1C,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBAC1B,CAAC,CAAE,MAAgC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;gBAC7E,CAAC,CAAC,EAAE,CAAC;QACT,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System prompt injected when the router asks a model to decide whether a
|
|
3
|
+
* task should be decomposed into a multi-agent plan or handled by a single
|
|
4
|
+
* agent. The model must respond with a single JSON object and nothing else.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ROUTER_SYSTEM_PROMPT = "You are the orchestration router for Aura, a multi-agent coding system.\n\nYour sole job is to analyse an incoming coding task and decide whether it should be:\n A) Handled by a SINGLE agent in one continuous session, or\n B) DECOMPOSED into a structured multi-agent execution plan.\n\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\nDECOMPOSE the task (shouldDecompose: true) ONLY when ALL of the following hold:\n \u2022 The task contains genuinely independent subtasks that can proceed in parallel\n or must be handed off between specialist roles (researcher \u2192 coder \u2192 reviewer).\n \u2022 It requires BOTH deep research/exploration AND non-trivial implementation.\n \u2022 It spans multiple unrelated modules that have no shared context requirements.\n \u2022 The generated code would meaningfully benefit from a dedicated review pass\n that could catch issues a single-agent loop would miss.\n\nSTAY SINGLE AGENT (shouldDecompose: false) when ANY of the following applies:\n \u2022 The task is focused on one file, function, or tightly coupled area.\n \u2022 Continuous rolling context is essential (refactors, bug hunts, exploratory work).\n \u2022 The task is exploratory or the scope is unclear \u2014 decomposition would be premature.\n \u2022 The task is simple enough to complete in a handful of tool calls.\n \u2022 The overhead of coordinating multiple agents would exceed the benefit.\n\nWhen in doubt, default to SINGLE AGENT. Decomposition adds coordination cost;\nonly choose it when the parallelism or specialisation gain is obvious.\n\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\nOUTPUT FORMAT \u2014 respond with ONLY valid JSON, no prose, no markdown fences:\n\n{\n \"shouldDecompose\": boolean,\n \"reason\": string,\n \"confidence\": number,\n \"estimatedSteps\": number\n}\n\nField rules:\n \u2022 \"shouldDecompose\" \u2014 true or false.\n \u2022 \"reason\" \u2014 one concise sentence explaining the decision.\n \u2022 \"confidence\" \u2014 your certainty in [0.0, 1.0]; use 0.5 when genuinely uncertain.\n \u2022 \"estimatedSteps\" \u2014 ONLY include this key when shouldDecompose is true;\n omit it entirely when shouldDecompose is false.\n\nDo NOT include any text, explanation, or formatting outside the JSON object.";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3
|
+
// System prompts used by the orchestration router
|
|
4
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ROUTER_SYSTEM_PROMPT = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* System prompt injected when the router asks a model to decide whether a
|
|
9
|
+
* task should be decomposed into a multi-agent plan or handled by a single
|
|
10
|
+
* agent. The model must respond with a single JSON object and nothing else.
|
|
11
|
+
*/
|
|
12
|
+
exports.ROUTER_SYSTEM_PROMPT = `You are the orchestration router for Aura, a multi-agent coding system.
|
|
13
|
+
|
|
14
|
+
Your sole job is to analyse an incoming coding task and decide whether it should be:
|
|
15
|
+
A) Handled by a SINGLE agent in one continuous session, or
|
|
16
|
+
B) DECOMPOSED into a structured multi-agent execution plan.
|
|
17
|
+
|
|
18
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
19
|
+
DECOMPOSE the task (shouldDecompose: true) ONLY when ALL of the following hold:
|
|
20
|
+
• The task contains genuinely independent subtasks that can proceed in parallel
|
|
21
|
+
or must be handed off between specialist roles (researcher → coder → reviewer).
|
|
22
|
+
• It requires BOTH deep research/exploration AND non-trivial implementation.
|
|
23
|
+
• It spans multiple unrelated modules that have no shared context requirements.
|
|
24
|
+
• The generated code would meaningfully benefit from a dedicated review pass
|
|
25
|
+
that could catch issues a single-agent loop would miss.
|
|
26
|
+
|
|
27
|
+
STAY SINGLE AGENT (shouldDecompose: false) when ANY of the following applies:
|
|
28
|
+
• The task is focused on one file, function, or tightly coupled area.
|
|
29
|
+
• Continuous rolling context is essential (refactors, bug hunts, exploratory work).
|
|
30
|
+
• The task is exploratory or the scope is unclear — decomposition would be premature.
|
|
31
|
+
• The task is simple enough to complete in a handful of tool calls.
|
|
32
|
+
• The overhead of coordinating multiple agents would exceed the benefit.
|
|
33
|
+
|
|
34
|
+
When in doubt, default to SINGLE AGENT. Decomposition adds coordination cost;
|
|
35
|
+
only choose it when the parallelism or specialisation gain is obvious.
|
|
36
|
+
|
|
37
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
38
|
+
OUTPUT FORMAT — respond with ONLY valid JSON, no prose, no markdown fences:
|
|
39
|
+
|
|
40
|
+
{
|
|
41
|
+
"shouldDecompose": boolean,
|
|
42
|
+
"reason": string,
|
|
43
|
+
"confidence": number,
|
|
44
|
+
"estimatedSteps": number
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
Field rules:
|
|
48
|
+
• "shouldDecompose" — true or false.
|
|
49
|
+
• "reason" — one concise sentence explaining the decision.
|
|
50
|
+
• "confidence" — your certainty in [0.0, 1.0]; use 0.5 when genuinely uncertain.
|
|
51
|
+
• "estimatedSteps" — ONLY include this key when shouldDecompose is true;
|
|
52
|
+
omit it entirely when shouldDecompose is false.
|
|
53
|
+
|
|
54
|
+
Do NOT include any text, explanation, or formatting outside the JSON object.`;
|
|
55
|
+
//# sourceMappingURL=router-prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-prompts.js","sourceRoot":"","sources":["../../src/orchestration/router-prompts.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,kDAAkD;AAClD,gFAAgF;;;AAEhF;;;;GAIG;AACU,QAAA,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6EA0CyC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { LLMProvider } from '../providers/types.js';
|
|
2
|
+
import type { ProjectContext } from '../agent/context.js';
|
|
3
|
+
import type { ProjectPerception } from '../perception/types.js';
|
|
4
|
+
import type { RouterDecision } from './types.js';
|
|
5
|
+
/** Inputs required to route a task through the orchestrator. */
|
|
6
|
+
export interface RouterOptions {
|
|
7
|
+
/** Provider used to call the routing model. */
|
|
8
|
+
provider: LLMProvider;
|
|
9
|
+
/** Loaded project context (name, language, framework, tree, …). */
|
|
10
|
+
context: ProjectContext;
|
|
11
|
+
/** The raw user task string to be routed. */
|
|
12
|
+
task: string;
|
|
13
|
+
/** Optional perception snapshot; risk areas are surfaced to the router when present. */
|
|
14
|
+
perception?: ProjectPerception;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Asks the model to decide whether `task` should be decomposed into a
|
|
18
|
+
* multi-agent plan or handled by a single agent.
|
|
19
|
+
*
|
|
20
|
+
* Never throws — any parse or provider error returns a safe default that keeps
|
|
21
|
+
* execution on the single-agent path.
|
|
22
|
+
*/
|
|
23
|
+
export declare function routeTask(opts: RouterOptions): Promise<RouterDecision>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.routeTask = routeTask;
|
|
4
|
+
const router_prompts_js_1 = require("./router-prompts.js");
|
|
5
|
+
/**
|
|
6
|
+
* Asks the model to decide whether `task` should be decomposed into a
|
|
7
|
+
* multi-agent plan or handled by a single agent.
|
|
8
|
+
*
|
|
9
|
+
* Never throws — any parse or provider error returns a safe default that keeps
|
|
10
|
+
* execution on the single-agent path.
|
|
11
|
+
*/
|
|
12
|
+
async function routeTask(opts) {
|
|
13
|
+
const { provider, context, task, perception } = opts;
|
|
14
|
+
const userMessage = buildUserMessage(context, task, perception);
|
|
15
|
+
const history = [{ role: 'user', content: userMessage }];
|
|
16
|
+
let rawText = '';
|
|
17
|
+
try {
|
|
18
|
+
const response = await provider.complete(router_prompts_js_1.ROUTER_SYSTEM_PROMPT, history, []);
|
|
19
|
+
rawText = response.text.trim();
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return safeDefault('Provider error — defaulting to single agent');
|
|
23
|
+
}
|
|
24
|
+
return parseDecision(rawText);
|
|
25
|
+
}
|
|
26
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
27
|
+
// Internal helpers
|
|
28
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
29
|
+
function buildUserMessage(context, task, perception) {
|
|
30
|
+
const lines = [
|
|
31
|
+
`Project: ${context.name}`,
|
|
32
|
+
`Language: ${context.language}`,
|
|
33
|
+
`Framework: ${context.framework}`,
|
|
34
|
+
];
|
|
35
|
+
if (perception && perception.constraints.riskAreas.length > 0) {
|
|
36
|
+
lines.push(`Risk areas: ${perception.constraints.riskAreas.join(', ')}`);
|
|
37
|
+
}
|
|
38
|
+
lines.push('', `Task: ${task}`);
|
|
39
|
+
return lines.join('\n');
|
|
40
|
+
}
|
|
41
|
+
function parseDecision(raw) {
|
|
42
|
+
let parsed;
|
|
43
|
+
try {
|
|
44
|
+
// Strip accidental markdown fences the model might emit despite instructions
|
|
45
|
+
const cleaned = raw.replace(/^```(?:json)?\s*/i, '').replace(/\s*```\s*$/, '').trim();
|
|
46
|
+
parsed = JSON.parse(cleaned);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return safeDefault('Parse failed — defaulting to single agent');
|
|
50
|
+
}
|
|
51
|
+
if (typeof parsed !== 'object' || parsed === null) {
|
|
52
|
+
return safeDefault('Unexpected response shape — defaulting to single agent');
|
|
53
|
+
}
|
|
54
|
+
const r = parsed;
|
|
55
|
+
const shouldDecompose = typeof r.shouldDecompose === 'boolean' ? r.shouldDecompose : false;
|
|
56
|
+
const reason = typeof r.reason === 'string' && r.reason.length > 0
|
|
57
|
+
? r.reason
|
|
58
|
+
: 'No reason provided';
|
|
59
|
+
const rawConf = typeof r.confidence === 'number' && Number.isFinite(r.confidence) ? r.confidence : 0;
|
|
60
|
+
const confidence = Math.min(1, Math.max(0, rawConf));
|
|
61
|
+
const decision = { shouldDecompose, reason, confidence };
|
|
62
|
+
if (shouldDecompose && typeof r.estimatedSteps === 'number' && r.estimatedSteps > 0) {
|
|
63
|
+
decision.estimatedSteps = Math.round(r.estimatedSteps);
|
|
64
|
+
}
|
|
65
|
+
return decision;
|
|
66
|
+
}
|
|
67
|
+
function safeDefault(reason) {
|
|
68
|
+
return { shouldDecompose: false, reason, confidence: 0 };
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/orchestration/router.ts"],"names":[],"mappings":";;AA6BA,8BAeC;AAxCD,2DAA2D;AAkB3D;;;;;;GAMG;AACI,KAAK,UAAU,SAAS,CAAC,IAAmB;IACjD,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IAErD,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;IAChE,MAAM,OAAO,GAAqB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;IAE3E,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,wCAAoB,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;QAC5E,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,WAAW,CAAC,6CAA6C,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,SAAS,gBAAgB,CACvB,OAAuB,EACvB,IAAY,EACZ,UAAyC;IAEzC,MAAM,KAAK,GAAa;QACtB,YAAY,OAAO,CAAC,IAAI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QAChE,CAAC,CAAC,CAAC,CAAC,MAAM;QACV,CAAC,CAAC,oBAAoB,CAAC;IACzB,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACrG,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAErD,MAAM,QAAQ,GAAmB,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;IAEzE,IAAI,eAAe,IAAI,OAAO,CAAC,CAAC,cAAc,KAAK,QAAQ,IAAI,CAAC,CAAC,cAAc,GAAG,CAAC,EAAE,CAAC;QACpF,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,WAAW,CAAC,MAAc;IACjC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RubyProjectContext } from './ruby-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Builds a RubyProjectContext from on-disk signals (Gemfile, layout, etc.).
|
|
4
|
+
* Safe to call on non-Ruby trees — returns `framework: 'unknown'` with empty entrypoints.
|
|
5
|
+
*/
|
|
6
|
+
export declare function detectRubyProject(projectRoot: string): RubyProjectContext;
|
|
@@ -0,0 +1,130 @@
|
|
|
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.detectRubyProject = detectRubyProject;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
function readTextIfExists(filePath) {
|
|
40
|
+
try {
|
|
41
|
+
if (!fs.existsSync(filePath))
|
|
42
|
+
return undefined;
|
|
43
|
+
return fs.readFileSync(filePath, 'utf8');
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function detectRubyVersion(projectRoot) {
|
|
50
|
+
const dotRuby = readTextIfExists(path.join(projectRoot, '.ruby-version'));
|
|
51
|
+
if (dotRuby?.trim())
|
|
52
|
+
return dotRuby.trim();
|
|
53
|
+
const gemfile = readTextIfExists(path.join(projectRoot, 'Gemfile'));
|
|
54
|
+
if (!gemfile)
|
|
55
|
+
return undefined;
|
|
56
|
+
const m = gemfile.match(/^\s*ruby\s+['"]([^'"]+)['"]/m);
|
|
57
|
+
return m?.[1];
|
|
58
|
+
}
|
|
59
|
+
function detectFramework(projectRoot, gemfile) {
|
|
60
|
+
if (fs.existsSync(path.join(projectRoot, 'config', 'application.rb')))
|
|
61
|
+
return 'rails';
|
|
62
|
+
if (gemfile?.includes("'rails'") || gemfile?.includes('"rails"'))
|
|
63
|
+
return 'rails';
|
|
64
|
+
if (gemfile?.includes("'sinatra'") || gemfile?.includes('"sinatra"'))
|
|
65
|
+
return 'sinatra';
|
|
66
|
+
if (gemfile?.includes("'rack'") || gemfile?.includes('"rack"'))
|
|
67
|
+
return 'rack';
|
|
68
|
+
if (fs.existsSync(path.join(projectRoot, 'lib')) && fs.existsSync(path.join(projectRoot, 'Gemfile'))) {
|
|
69
|
+
return 'plain';
|
|
70
|
+
}
|
|
71
|
+
const rbFiles = fs.readdirSync(projectRoot).filter(f => f.endsWith('.rb'));
|
|
72
|
+
if (rbFiles.length > 0)
|
|
73
|
+
return 'plain';
|
|
74
|
+
return 'unknown';
|
|
75
|
+
}
|
|
76
|
+
function detectTestFramework(gemfile) {
|
|
77
|
+
if (!gemfile)
|
|
78
|
+
return 'unknown';
|
|
79
|
+
if (gemfile.includes('rspec'))
|
|
80
|
+
return 'rspec';
|
|
81
|
+
if (gemfile.includes('minitest'))
|
|
82
|
+
return 'minitest';
|
|
83
|
+
if (gemfile.includes('test-unit'))
|
|
84
|
+
return 'test-unit';
|
|
85
|
+
return 'unknown';
|
|
86
|
+
}
|
|
87
|
+
function detectEntrypoints(projectRoot, framework) {
|
|
88
|
+
const candidates = [
|
|
89
|
+
'config.ru',
|
|
90
|
+
'app.rb',
|
|
91
|
+
'main.rb',
|
|
92
|
+
'bin/rails',
|
|
93
|
+
'lib/application.rb',
|
|
94
|
+
'Rakefile',
|
|
95
|
+
];
|
|
96
|
+
const found = [];
|
|
97
|
+
for (const rel of candidates) {
|
|
98
|
+
const full = path.join(projectRoot, rel);
|
|
99
|
+
if (fs.existsSync(full))
|
|
100
|
+
found.push(rel);
|
|
101
|
+
}
|
|
102
|
+
if (framework === 'rails' && !found.includes('config.ru')) {
|
|
103
|
+
const ru = path.join(projectRoot, 'config.ru');
|
|
104
|
+
if (fs.existsSync(ru))
|
|
105
|
+
found.push('config.ru');
|
|
106
|
+
}
|
|
107
|
+
return found;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Builds a RubyProjectContext from on-disk signals (Gemfile, layout, etc.).
|
|
111
|
+
* Safe to call on non-Ruby trees — returns `framework: 'unknown'` with empty entrypoints.
|
|
112
|
+
*/
|
|
113
|
+
function detectRubyProject(projectRoot) {
|
|
114
|
+
const gemfilePath = path.join(projectRoot, 'Gemfile');
|
|
115
|
+
const hasGemfile = fs.existsSync(gemfilePath);
|
|
116
|
+
const hasGemfileLock = fs.existsSync(path.join(projectRoot, 'Gemfile.lock'));
|
|
117
|
+
const gemfile = hasGemfile ? readTextIfExists(gemfilePath) : undefined;
|
|
118
|
+
const framework = detectFramework(projectRoot, gemfile);
|
|
119
|
+
return {
|
|
120
|
+
projectRoot,
|
|
121
|
+
framework,
|
|
122
|
+
hasGemfile,
|
|
123
|
+
hasGemfileLock,
|
|
124
|
+
rubyVersion: detectRubyVersion(projectRoot),
|
|
125
|
+
testFramework: detectTestFramework(gemfile),
|
|
126
|
+
entrypoints: detectEntrypoints(projectRoot, framework),
|
|
127
|
+
capturedAt: Date.now(),
|
|
128
|
+
};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AmB,CAAC,OAAO,CAAC;QAC3C,WAAW,EAAE,iBAAiB,CAAC,WAAW,EAAE,SAAS,CAAC;QACtD,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;KACvB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** Detected application framework for a Ruby codebase. */
|
|
2
|
+
export type RubyFramework = 'rails' | 'sinatra' | 'rack' | 'plain' | 'unknown';
|
|
3
|
+
/** Test runner commonly used in Ruby projects. */
|
|
4
|
+
export type RubyTestFramework = 'rspec' | 'minitest' | 'test-unit' | 'unknown';
|
|
5
|
+
/**
|
|
6
|
+
* Snapshot of Ruby-specific project metadata used by the orchestrator when
|
|
7
|
+
* routing goals and assigning specialists to gem- or Rails-aware work.
|
|
8
|
+
*/
|
|
9
|
+
export interface RubyProjectContext {
|
|
10
|
+
/** Absolute path to the project root. */
|
|
11
|
+
projectRoot: string;
|
|
12
|
+
/** Inferred framework from Gemfile / directory layout. */
|
|
13
|
+
framework: RubyFramework;
|
|
14
|
+
/** Whether a Gemfile exists at the project root. */
|
|
15
|
+
hasGemfile: boolean;
|
|
16
|
+
/** Whether a Gemfile.lock is present (dependency graph is pinned). */
|
|
17
|
+
hasGemfileLock: boolean;
|
|
18
|
+
/** Parsed `.ruby-version` or Gemfile `ruby` directive, if found. */
|
|
19
|
+
rubyVersion?: string;
|
|
20
|
+
/** Detected test framework, if any. */
|
|
21
|
+
testFramework: RubyTestFramework;
|
|
22
|
+
/** Top-level entry files the orchestrator should treat as significant. */
|
|
23
|
+
entrypoints: string[];
|
|
24
|
+
/** Unix timestamp (ms) when this context was captured. */
|
|
25
|
+
capturedAt: number;
|
|
26
|
+
}
|
|
27
|
+
/** Identifies which Ruby Diamond surface produced or consumes orchestration data. */
|
|
28
|
+
export type RubyDiamondSurface = 'aura-code' | 'ruby-diamond-client' | 'harness' | 'unknown';
|
|
29
|
+
/**
|
|
30
|
+
* Cross-surface envelope for passing orchestration payloads between Aura CLI,
|
|
31
|
+
* Ruby Diamond desktop, and Python harness generators.
|
|
32
|
+
*/
|
|
33
|
+
export interface RubyDiamondEnvelope<T = unknown> {
|
|
34
|
+
/** Schema version for forward-compatible deserialization. */
|
|
35
|
+
version: 1;
|
|
36
|
+
/** Originating or target surface. */
|
|
37
|
+
surface: RubyDiamondSurface;
|
|
38
|
+
/** Logical message kind (e.g. plan_created, step_done). */
|
|
39
|
+
kind: string;
|
|
40
|
+
/** Unix timestamp (ms). */
|
|
41
|
+
timestamp: number;
|
|
42
|
+
/** Typed payload. */
|
|
43
|
+
payload: T;
|
|
44
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3
|
+
// Ruby language / Ruby Diamond project context
|
|
4
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
//# sourceMappingURL=ruby-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruby-types.js","sourceRoot":"","sources":["../../src/orchestration/ruby-types.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,gFAAgF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PlanStep, OrchestrationMemory } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* System prompt for the researcher specialist.
|
|
4
|
+
* The researcher is read-only: it gathers context, identifies patterns, and
|
|
5
|
+
* produces structured summaries. It must never write or modify files.
|
|
6
|
+
*/
|
|
7
|
+
export declare const RESEARCHER_SYSTEM_PROMPT = "You are the Research specialist for Aura \u2014 a multi-agent coding system.\n\n## Your role\nYou gather context, read code, and produce structured analysis. You have only\nread-only tools. You never create, edit, or delete files.\n\n## Your process\n1. READ everything relevant to the task \u2014 do not guess or assume.\n2. FOLLOW import chains and dependency graphs to understand relationships.\n3. IDENTIFY patterns, conventions, and constraints in the codebase.\n4. OUTPUT a structured summary in the exact format below.\n\n## Output format\nAfter you have gathered sufficient information, ouput ONLY the following\nstructured summary. No markdown fences, no extra prose \u2014 just the raw sections:\n\n---\nKEY FILES FOUND\n- path/to/file.ts \u2014 brief description of what it contains and why it matters\n- path/to/another.ts \u2014 brief description\n...\n\nIMPORTANT PATTERNS\n- pattern description (e.g. \"all middleware exports a factory function\")\n...\n\nDEPENDENCIES DISCOVERED\n- file-a.ts depends on file-b.ts (via import of X)\n- external: package-name (used in N files)\n...\n\nRISKS IDENTIFIED\n- risk description (e.g. \"auth.ts has no error boundaries on line 42\")\n...\n\n---\n\n## Rules\n- NEVER write, edit, or delete files.\n- Always read files before reporting on them.\n- If a file is large, use line ranges to focus on the relevant sections.\n- Prefer search_code to find patterns across the codebase.\n- If you cannot find enough information, say so explicitly rather than guessing.\n- Keep your analysis focused on the task at hand \u2014 don't wander.\n- Spend at most 2 turns reading/gathering, then produce your summary.";
|
|
8
|
+
/**
|
|
9
|
+
* System prompt for the reviewer specialist.
|
|
10
|
+
* The reviewer checks correctness, security, style, and test coverage. It is
|
|
11
|
+
* read-only and MUST output issues in a structured JSON format.
|
|
12
|
+
*/
|
|
13
|
+
export declare const REVIEWER_SYSTEM_PROMPT = "You are the Review specialist for Aura \u2014 a multi-agent coding system.\n\n## Your role\nYou review code changes for correctness, security, test coverage, and style\nconsistency. You have only read-only tools. You never create, edit, or delete files.\n\n## Your process\n1. READ the files that were modified \u2014 check the diff with git_diff.\n2. READ related files that may be impacted.\n3. CHECK for:\n - Correctness: logic errors, edge cases, off-by-one errors.\n - Security: injection risks, leaked secrets, unsafe input handling.\n - Test coverage: are new paths tested? Do existing tests still pass?\n - Style consistency: does the change follow existing conventions?\n4. OUTPUT a structured issues list.\n\n## Output format\nAfter you have completed your review, output ONLY a valid JSON object:\n\n{\n \"issues\": [\n {\n \"severity\": \"critical\" | \"major\" | \"minor\",\n \"description\": \"What the issue is\",\n \"location\": \"file.ts:line-number\"\n }\n ]\n}\n\nIf you find no issues, output exactly:\n{ \"issues\": [] }\nand then clearly state: \"No issues found.\"\n\n## Severity guide\n- critical \u2014 security vulnerability, data loss, or crash-on-start\n- major \u2014 incorrect behaviour, missing error handling, broken test\n- minor \u2014 style drift, missing comment, unnecessary verbosity\n\n## Rules\n- NEVER write, edit, or delete files.\n- Never approve code that introduces security vulnerabilities.\n- If you find a critical issue, state it first and be explicit about the risk.\n- Do not flag issues you cannot verify \u2014 if unsure, omit it rather than misattribute.\n- Each issue must include a specific file path and line number.";
|
|
14
|
+
/**
|
|
15
|
+
* Builds the context block injected into the coder's task description.
|
|
16
|
+
* Includes step-specific scope, relevant memory from prior steps, and an
|
|
17
|
+
* explicit instruction to stay focused on the assigned task.
|
|
18
|
+
*/
|
|
19
|
+
export declare function CODER_CONTEXT_TEMPLATE(step: PlanStep, memory: OrchestrationMemory[]): string;
|