aura-code 0.5.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -164
- package/dist/agent/affect.d.ts +13 -0
- package/dist/agent/affect.js +34 -0
- package/dist/agent/affect.js.map +1 -0
- package/dist/agent/compactor.d.ts +27 -4
- package/dist/agent/compactor.js +185 -54
- package/dist/agent/compactor.js.map +1 -1
- package/dist/agent/confess.d.ts +35 -0
- package/dist/agent/confess.js +296 -0
- package/dist/agent/confess.js.map +1 -0
- package/dist/agent/domain-expertise.d.ts +22 -0
- package/dist/agent/domain-expertise.js +110 -0
- package/dist/agent/domain-expertise.js.map +1 -0
- package/dist/agent/executive-queue.d.ts +26 -0
- package/dist/agent/executive-queue.js +50 -0
- package/dist/agent/executive-queue.js.map +1 -0
- package/dist/agent/generational-flush.d.ts +28 -0
- package/dist/agent/generational-flush.js +48 -0
- package/dist/agent/generational-flush.js.map +1 -0
- package/dist/agent/loop-profile.d.ts +50 -0
- package/dist/agent/loop-profile.js +88 -0
- package/dist/agent/loop-profile.js.map +1 -0
- package/dist/agent/loop.d.ts +14 -5
- package/dist/agent/loop.js +167 -23
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/memory-consolidate.d.ts +14 -0
- package/dist/agent/memory-consolidate.js +141 -0
- package/dist/agent/memory-consolidate.js.map +1 -0
- package/dist/agent/mixture.d.ts +33 -0
- package/dist/agent/mixture.js +138 -0
- package/dist/agent/mixture.js.map +1 -0
- package/dist/agent/spawner.js +2 -2
- package/dist/agent/spawner.js.map +1 -1
- package/dist/agent/system-prompt.d.ts +1 -1
- package/dist/agent/system-prompt.js +49 -13
- package/dist/agent/system-prompt.js.map +1 -1
- package/dist/agent/unified-memory.d.ts +15 -0
- package/dist/agent/unified-memory.js +164 -0
- package/dist/agent/unified-memory.js.map +1 -0
- package/dist/checkpoints/engine.d.ts +44 -0
- package/dist/checkpoints/engine.js +324 -0
- package/dist/checkpoints/engine.js.map +1 -0
- package/dist/cli/command-palette.d.ts +26 -0
- package/dist/cli/command-palette.js +133 -0
- package/dist/cli/command-palette.js.map +1 -0
- package/dist/cli/context-health.d.ts +51 -0
- package/dist/cli/context-health.js +187 -0
- package/dist/cli/context-health.js.map +1 -0
- package/dist/cli/diamond.d.ts +67 -0
- package/dist/cli/diamond.js +222 -12
- package/dist/cli/diamond.js.map +1 -1
- package/dist/cli/dic.d.ts +2 -0
- package/dist/cli/dic.js +106 -0
- package/dist/cli/dic.js.map +1 -0
- package/dist/cli/diff-view.d.ts +18 -0
- package/dist/cli/diff-view.js +114 -0
- package/dist/cli/diff-view.js.map +1 -0
- package/dist/cli/display.d.ts +18 -4
- package/dist/cli/display.js +74 -146
- package/dist/cli/display.js.map +1 -1
- package/dist/cli/help-data.d.ts +7 -0
- package/dist/cli/help-data.js +80 -0
- package/dist/cli/help-data.js.map +1 -0
- package/dist/cli/index.js +1001 -788
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/markdown.d.ts +5 -0
- package/dist/cli/markdown.js +128 -0
- package/dist/cli/markdown.js.map +1 -0
- package/dist/cli/model-select.d.ts +39 -0
- package/dist/cli/model-select.js +65 -0
- package/dist/cli/model-select.js.map +1 -0
- package/dist/cli/tui.d.ts +34 -0
- package/dist/cli/tui.js +1176 -0
- package/dist/cli/tui.js.map +1 -0
- package/dist/config/defaults.d.ts +6 -17
- package/dist/config/defaults.js +25 -39
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/project-config.d.ts +2 -6
- package/dist/config/project-config.js +2 -2
- package/dist/config/project-config.js.map +1 -1
- package/dist/doctor/checks.d.ts +18 -0
- package/dist/doctor/checks.js +524 -0
- package/dist/doctor/checks.js.map +1 -0
- package/dist/doctor/index.d.ts +4 -0
- package/dist/doctor/index.js +229 -0
- package/dist/doctor/index.js.map +1 -0
- package/dist/doctor/repair.d.ts +19 -0
- package/dist/doctor/repair.js +126 -0
- package/dist/doctor/repair.js.map +1 -0
- package/dist/doctor/types.d.ts +38 -0
- package/dist/doctor/types.js +10 -0
- package/dist/doctor/types.js.map +1 -0
- package/dist/dream/dream.d.ts +79 -36
- package/dist/dream/dream.js +327 -117
- package/dist/dream/dream.js.map +1 -1
- package/dist/dream/episode.d.ts +17 -0
- package/dist/dream/episode.js +116 -0
- package/dist/dream/episode.js.map +1 -0
- package/dist/dream/okf.d.ts +10 -0
- package/dist/dream/okf.js +280 -0
- package/dist/dream/okf.js.map +1 -0
- package/dist/dream/parser.d.ts +60 -0
- package/dist/dream/parser.js +176 -0
- package/dist/dream/parser.js.map +1 -0
- package/dist/dream/reconcile.d.ts +69 -0
- package/dist/dream/reconcile.js +303 -0
- package/dist/dream/reconcile.js.map +1 -0
- package/dist/kanban/engine.d.ts +26 -0
- package/dist/kanban/engine.js +208 -0
- package/dist/kanban/engine.js.map +1 -0
- package/dist/kanban/types.d.ts +19 -0
- package/dist/kanban/types.js +9 -1
- package/dist/kanban/types.js.map +1 -1
- package/dist/machina/index.d.ts +16 -0
- package/dist/machina/index.js +61 -0
- package/dist/machina/index.js.map +1 -0
- package/dist/machina/render-html.d.ts +2 -0
- package/dist/machina/render-html.js +191 -0
- package/dist/machina/render-html.js.map +1 -0
- package/dist/machina/render-terminal.d.ts +2 -0
- package/dist/machina/render-terminal.js +99 -0
- package/dist/machina/render-terminal.js.map +1 -0
- package/dist/machina/repair.d.ts +23 -0
- package/dist/machina/repair.js +98 -0
- package/dist/machina/repair.js.map +1 -0
- package/dist/machina/spec.d.ts +61 -0
- package/dist/machina/spec.js +124 -0
- package/dist/machina/spec.js.map +1 -0
- package/dist/machina/verify.d.ts +39 -0
- package/dist/machina/verify.js +95 -0
- package/dist/machina/verify.js.map +1 -0
- package/dist/mining/extract.d.ts +34 -0
- package/dist/mining/extract.js +229 -0
- package/dist/mining/extract.js.map +1 -0
- package/dist/mining/refine.d.ts +28 -0
- package/dist/mining/refine.js +256 -0
- package/dist/mining/refine.js.map +1 -0
- package/dist/perception/extractor.js +5 -3
- package/dist/perception/extractor.js.map +1 -1
- package/dist/perception/graph-store.d.ts +0 -11
- package/dist/perception/graph-store.js +0 -33
- package/dist/perception/graph-store.js.map +1 -1
- package/dist/perception/index.d.ts +1 -1
- package/dist/perception/index.js +1 -2
- package/dist/perception/index.js.map +1 -1
- package/dist/plugins/commands.d.ts +38 -0
- package/dist/plugins/commands.js +134 -0
- package/dist/plugins/commands.js.map +1 -0
- package/dist/plugins/frontmatter.d.ts +14 -0
- package/dist/plugins/frontmatter.js +78 -0
- package/dist/plugins/frontmatter.js.map +1 -0
- package/dist/plugins/hooks.d.ts +12 -0
- package/dist/plugins/hooks.js +148 -0
- package/dist/plugins/hooks.js.map +1 -0
- package/dist/plugins/loader.d.ts +7 -0
- package/dist/plugins/loader.js +255 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/market.d.ts +23 -0
- package/dist/plugins/market.js +281 -0
- package/dist/plugins/market.js.map +1 -0
- package/dist/plugins/types.d.ts +90 -0
- package/dist/plugins/types.js +20 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/providers/anthropic-oauth-draft.d.ts +119 -0
- package/dist/providers/anthropic-oauth-draft.js +414 -0
- package/dist/providers/anthropic-oauth-draft.js.map +1 -0
- package/dist/providers/anthropic.d.ts +4 -1
- package/dist/providers/anthropic.js +34 -6
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/factory.d.ts +71 -14
- package/dist/providers/factory.js +205 -124
- package/dist/providers/factory.js.map +1 -1
- package/dist/providers/google.js +8 -21
- package/dist/providers/google.js.map +1 -1
- package/dist/providers/live-models.d.ts +23 -0
- package/dist/providers/live-models.js +145 -0
- package/dist/providers/live-models.js.map +1 -0
- package/dist/providers/openai-compatible.d.ts +1 -12
- package/dist/providers/openai-compatible.js +71 -108
- package/dist/providers/openai-compatible.js.map +1 -1
- package/dist/providers/resilient-factory.js +1 -1
- package/dist/providers/resilient-factory.js.map +1 -1
- package/dist/rem/graph.d.ts +72 -0
- package/dist/rem/graph.js +139 -0
- package/dist/rem/graph.js.map +1 -0
- package/dist/rem/index.d.ts +16 -0
- package/dist/rem/index.js +60 -0
- package/dist/rem/index.js.map +1 -0
- package/dist/rem/render-html.d.ts +2 -0
- package/dist/rem/render-html.js +189 -0
- package/dist/rem/render-html.js.map +1 -0
- package/dist/rem/render-terminal.d.ts +4 -0
- package/dist/rem/render-terminal.js +94 -0
- package/dist/rem/render-terminal.js.map +1 -0
- package/dist/repl/queue.d.ts +22 -0
- package/dist/repl/queue.js +165 -0
- package/dist/repl/queue.js.map +1 -0
- package/dist/repl/side-channel.d.ts +23 -0
- package/dist/repl/side-channel.js +63 -0
- package/dist/repl/side-channel.js.map +1 -0
- package/dist/research/council.d.ts +5 -2
- package/dist/research/council.js +73 -10
- package/dist/research/council.js.map +1 -1
- package/dist/ruby/alternator.d.ts +11 -30
- package/dist/ruby/alternator.js +59 -38
- package/dist/ruby/alternator.js.map +1 -1
- package/dist/ruby/episode-capture.d.ts +0 -10
- package/dist/ruby/episode-capture.js +0 -33
- package/dist/ruby/episode-capture.js.map +1 -1
- package/dist/ruby/types.js +1 -1
- package/dist/ruby/types.js.map +1 -1
- package/dist/safety/path-jail.d.ts +17 -0
- package/dist/safety/path-jail.js +100 -0
- package/dist/safety/path-jail.js.map +1 -0
- package/dist/safety/permissions.d.ts +12 -21
- package/dist/safety/permissions.js +81 -216
- package/dist/safety/permissions.js.map +1 -1
- package/dist/safety/ssrf.d.ts +29 -0
- package/dist/safety/ssrf.js +185 -0
- package/dist/safety/ssrf.js.map +1 -0
- package/dist/server/index.js +64 -10
- package/dist/server/index.js.map +1 -1
- package/dist/setup/first-run.d.ts +0 -24
- package/dist/setup/first-run.js +10 -344
- package/dist/setup/first-run.js.map +1 -1
- package/dist/setup/key-store.d.ts +12 -0
- package/dist/setup/key-store.js +108 -0
- package/dist/setup/key-store.js.map +1 -0
- package/dist/setup/provider-registry.js +31 -18
- package/dist/setup/provider-registry.js.map +1 -1
- package/dist/setup/provider-test.d.ts +7 -0
- package/dist/setup/provider-test.js +73 -10
- package/dist/setup/provider-test.js.map +1 -1
- package/dist/setup/provider-wizard.d.ts +4 -1
- package/dist/setup/provider-wizard.js +92 -26
- package/dist/setup/provider-wizard.js.map +1 -1
- package/dist/setup/xiaomi.d.ts +1 -1
- package/dist/setup/xiaomi.js +3 -3
- package/dist/setup/xiaomi.js.map +1 -1
- package/dist/tools/browser.js +6 -4
- package/dist/tools/browser.js.map +1 -1
- package/dist/tools/clipboard.js +7 -1
- package/dist/tools/clipboard.js.map +1 -1
- package/dist/tools/dictate.d.ts +60 -0
- package/dist/tools/dictate.js +983 -0
- package/dist/tools/dictate.js.map +1 -0
- package/dist/tools/dictate_patched.js +1057 -0
- package/dist/tools/edit-file.js +10 -2
- package/dist/tools/edit-file.js.map +1 -1
- package/dist/tools/gmail-tool.d.ts +5 -1
- package/dist/tools/gmail-tool.js +151 -11
- package/dist/tools/gmail-tool.js.map +1 -1
- package/dist/tools/http-request.js +14 -4
- package/dist/tools/http-request.js.map +1 -1
- package/dist/tools/image-read.js +34 -2
- package/dist/tools/image-read.js.map +1 -1
- package/dist/tools/index.d.ts +16 -1
- package/dist/tools/index.js +59 -8
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/mcp.js +12 -0
- package/dist/tools/mcp.js.map +1 -1
- package/dist/tools/read-file.js +10 -14
- package/dist/tools/read-file.js.map +1 -1
- package/dist/tools/telegram-audio-policy.d.ts +30 -0
- package/dist/tools/telegram-audio-policy.js +49 -0
- package/dist/tools/telegram-audio-policy.js.map +1 -0
- package/dist/tools/telegram-bot.js +1136 -539
- package/dist/tools/telegram-bot.js.map +1 -1
- package/dist/tools/telegram-voice.d.ts +18 -5
- package/dist/tools/telegram-voice.js +54 -12
- package/dist/tools/telegram-voice.js.map +1 -1
- package/dist/tools/telegram.d.ts +3 -3
- package/dist/tools/telegram.js +5 -84
- package/dist/tools/telegram.js.map +1 -1
- package/dist/tools/tools.d.ts +2 -14
- package/dist/tools/tools.js +79 -144
- package/dist/tools/tools.js.map +1 -1
- package/dist/tools/web-fetch.js +39 -7
- package/dist/tools/web-fetch.js.map +1 -1
- package/dist/tools/web-search.js +2 -3
- package/dist/tools/web-search.js.map +1 -1
- package/dist/util/errors.js +1 -15
- package/dist/util/errors.js.map +1 -1
- package/dist/util/json-repair.d.ts +11 -0
- package/dist/util/json-repair.js +31 -0
- package/dist/util/json-repair.js.map +1 -0
- package/dist/util/rate-limiter.js +2 -8
- package/dist/util/rate-limiter.js.map +1 -1
- package/dist/viz/index.js +793 -792
- package/dist/viz/index.js.map +1 -1
- package/dist/viz/reader.d.ts +33 -0
- package/dist/viz/reader.js +343 -0
- package/dist/viz/reader.js.map +1 -0
- package/package.json +13 -32
|
@@ -0,0 +1,165 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.loadQueue = loadQueue;
|
|
40
|
+
exports.addToQueue = addToQueue;
|
|
41
|
+
exports.removeFromQueue = removeFromQueue;
|
|
42
|
+
exports.clearQueue = clearQueue;
|
|
43
|
+
exports.runQueueItem = runQueueItem;
|
|
44
|
+
exports.formatQueue = formatQueue;
|
|
45
|
+
/**
|
|
46
|
+
* :q — Persistent task queue for the REPL.
|
|
47
|
+
*
|
|
48
|
+
* Stores tasks in ~/.aura/queue.jsonl (append-only, atomic .tmp+rename on mutations).
|
|
49
|
+
* Each line is a JSON object with { id, prompt, createdAt, status }.
|
|
50
|
+
*
|
|
51
|
+
* Commands (dispatched from cli/index.ts):
|
|
52
|
+
* :q add <prompt> — enqueue a task
|
|
53
|
+
* :q list — show all items with index
|
|
54
|
+
* :q run <n> — execute item n in a fresh agent loop
|
|
55
|
+
* :q drop <n> — remove item n
|
|
56
|
+
* :q clear — wipe the queue (with confirmation)
|
|
57
|
+
*/
|
|
58
|
+
const fs = __importStar(require("fs"));
|
|
59
|
+
const path = __importStar(require("path"));
|
|
60
|
+
const os = __importStar(require("os"));
|
|
61
|
+
const crypto = __importStar(require("crypto"));
|
|
62
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
63
|
+
const loop_js_1 = require("../agent/loop.js");
|
|
64
|
+
// ── Storage ─────────────────────────────────────────────────────────────────
|
|
65
|
+
function queuePath() {
|
|
66
|
+
return path.join(os.homedir(), '.aura', 'queue.jsonl');
|
|
67
|
+
}
|
|
68
|
+
function loadQueue() {
|
|
69
|
+
const p = queuePath();
|
|
70
|
+
if (!fs.existsSync(p))
|
|
71
|
+
return [];
|
|
72
|
+
const raw = fs.readFileSync(p, 'utf8').trim();
|
|
73
|
+
if (!raw)
|
|
74
|
+
return [];
|
|
75
|
+
return raw.split('\n').map(line => JSON.parse(line));
|
|
76
|
+
}
|
|
77
|
+
function saveQueue(items) {
|
|
78
|
+
const p = queuePath();
|
|
79
|
+
const tmp = p + '.tmp';
|
|
80
|
+
const data = items.map(i => JSON.stringify(i)).join('\n') + '\n';
|
|
81
|
+
fs.writeFileSync(tmp, data, 'utf8');
|
|
82
|
+
fs.renameSync(tmp, p);
|
|
83
|
+
}
|
|
84
|
+
function addToQueue(prompt) {
|
|
85
|
+
const items = loadQueue();
|
|
86
|
+
const item = {
|
|
87
|
+
id: crypto.randomUUID().slice(0, 8),
|
|
88
|
+
prompt,
|
|
89
|
+
createdAt: Date.now(),
|
|
90
|
+
status: 'pending',
|
|
91
|
+
};
|
|
92
|
+
// Append a single line (atomic enough — .tmp+rename on the whole file is done in saveQueue)
|
|
93
|
+
items.push(item);
|
|
94
|
+
saveQueue(items);
|
|
95
|
+
return item;
|
|
96
|
+
}
|
|
97
|
+
function removeFromQueue(index) {
|
|
98
|
+
const items = loadQueue();
|
|
99
|
+
if (index < 0 || index >= items.length)
|
|
100
|
+
return null;
|
|
101
|
+
const removed = items.splice(index, 1)[0];
|
|
102
|
+
saveQueue(items);
|
|
103
|
+
return removed;
|
|
104
|
+
}
|
|
105
|
+
function clearQueue() {
|
|
106
|
+
const count = loadQueue().length;
|
|
107
|
+
saveQueue([]);
|
|
108
|
+
return count;
|
|
109
|
+
}
|
|
110
|
+
async function runQueueItem(index, provider, ctx, permissions, display) {
|
|
111
|
+
const items = loadQueue();
|
|
112
|
+
if (index < 0 || index >= items.length)
|
|
113
|
+
return null;
|
|
114
|
+
const item = items[index];
|
|
115
|
+
item.status = 'running';
|
|
116
|
+
saveQueue(items);
|
|
117
|
+
try {
|
|
118
|
+
// Run a fresh agent loop for this task.
|
|
119
|
+
const result = await (0, loop_js_1.runAgentLoop)({
|
|
120
|
+
provider,
|
|
121
|
+
task: item.prompt,
|
|
122
|
+
context: ctx,
|
|
123
|
+
permissions,
|
|
124
|
+
display,
|
|
125
|
+
maxTurns: 25,
|
|
126
|
+
});
|
|
127
|
+
item.status = result.success ? 'done' : 'failed';
|
|
128
|
+
saveQueue(items);
|
|
129
|
+
return {
|
|
130
|
+
success: result.success,
|
|
131
|
+
output: result.summary,
|
|
132
|
+
turns: result.turns ?? 0,
|
|
133
|
+
toolCalls: result.toolCallCount ?? 0,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
item.status = 'failed';
|
|
138
|
+
saveQueue(items);
|
|
139
|
+
return {
|
|
140
|
+
success: false,
|
|
141
|
+
output: String(err),
|
|
142
|
+
turns: 0,
|
|
143
|
+
toolCalls: 0,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// ── Formatting (for REPL display) ───────────────────────────────────────────
|
|
148
|
+
function formatQueue(items) {
|
|
149
|
+
if (items.length === 0)
|
|
150
|
+
return chalk_1.default.hex('#8a7768')('\n Queue is empty. Use :q add <prompt> to enqueue a task.\n');
|
|
151
|
+
const lines = items.map((item, i) => {
|
|
152
|
+
const statusColor = {
|
|
153
|
+
pending: '#8a7768',
|
|
154
|
+
running: '#d4903a',
|
|
155
|
+
done: '#5a9e6e',
|
|
156
|
+
failed: '#b15439',
|
|
157
|
+
};
|
|
158
|
+
const color = statusColor[item.status] || '#8a7768';
|
|
159
|
+
const statusIcon = item.status === 'done' ? '✓' : item.status === 'running' ? '⟳' : item.status === 'failed' ? '✗' : '·';
|
|
160
|
+
const created = new Date(item.createdAt).toLocaleTimeString();
|
|
161
|
+
return ` ${chalk_1.default.hex('#cc785c')(String(i + 1).padEnd(3))} ${chalk_1.default.hex(color)(statusIcon)} ${chalk_1.default.hex('#ede0cc')(item.prompt.slice(0, 80))} ${chalk_1.default.hex('#4e3d30')(created)}`;
|
|
162
|
+
});
|
|
163
|
+
return `\n${lines.join('\n')}\n`;
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../src/repl/queue.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,8BAMC;AAUD,gCAYC;AAED,0CAMC;AAED,gCAIC;AAWD,oCA4CC;AAID,kCAgBC;AA5JD;;;;;;;;;;;;GAYG;AACH,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,+CAAiC;AACjC,kDAA0B;AAE1B,8CAAgD;AAchD,+EAA+E;AAE/E,SAAS,SAAS;IAChB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AACzD,CAAC;AAED,SAAgB,SAAS;IACvB,MAAM,CAAC,GAAG,SAAS,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9C,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAc,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,SAAS,CAAC,KA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,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* :btw — Side channel for non-blocking parallel questions.
|
|
3
|
+
*
|
|
4
|
+
* Spawns an isolated LLM call (no session history, read-only) to answer
|
|
5
|
+
* a quick question while the main task keeps running. The answer is
|
|
6
|
+
* rendered as a simple overlay and never appears in chat history.
|
|
7
|
+
*/
|
|
8
|
+
import type { LLMProvider } from '../providers/types.js';
|
|
9
|
+
import type { ProjectContext } from '../agent/context.js';
|
|
10
|
+
export interface BtwResult {
|
|
11
|
+
answer: string;
|
|
12
|
+
tokens: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Run a :btw query in the current provider but with a clean (empty) chat
|
|
16
|
+
* history — strictly a read-only knowledge question.
|
|
17
|
+
*/
|
|
18
|
+
export declare function runBtwQuery(question: string, provider: LLMProvider, ctx: ProjectContext): Promise<BtwResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Render a :btw answer as a minimalist overlay box.
|
|
21
|
+
* Returns an object with the rendered lines + a dismiss instruction.
|
|
22
|
+
*/
|
|
23
|
+
export declare function renderBtwAnswer(answer: string, tokens: number): string;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runBtwQuery = runBtwQuery;
|
|
7
|
+
exports.renderBtwAnswer = renderBtwAnswer;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const BTW_SYSTEM_PROMPT = `You are Aura's "by the way" side channel.
|
|
10
|
+
Answer the user's quick question concisely in 2-4 sentences.
|
|
11
|
+
Do NOT use tools. Do NOT write code. Just answer from knowledge.
|
|
12
|
+
If you don't know, say so briefly.`;
|
|
13
|
+
/**
|
|
14
|
+
* Run a :btw query in the current provider but with a clean (empty) chat
|
|
15
|
+
* history — strictly a read-only knowledge question.
|
|
16
|
+
*/
|
|
17
|
+
async function runBtwQuery(question, provider, ctx) {
|
|
18
|
+
const stream = provider.stream(BTW_SYSTEM_PROMPT, [
|
|
19
|
+
{ role: 'user', content: `:btw ${question}` },
|
|
20
|
+
], []);
|
|
21
|
+
let answer = '';
|
|
22
|
+
let totalTokens = 0;
|
|
23
|
+
for await (const chunk of stream) {
|
|
24
|
+
if (chunk.type === 'text') {
|
|
25
|
+
answer += chunk.text;
|
|
26
|
+
}
|
|
27
|
+
else if (chunk.type === 'done') {
|
|
28
|
+
const usage = chunk.response.usage;
|
|
29
|
+
if (usage)
|
|
30
|
+
totalTokens = usage.inputTokens + usage.outputTokens;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return { answer: answer.trim(), tokens: totalTokens };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Render a :btw answer as a minimalist overlay box.
|
|
37
|
+
* Returns an object with the rendered lines + a dismiss instruction.
|
|
38
|
+
*/
|
|
39
|
+
function renderBtwAnswer(answer, tokens) {
|
|
40
|
+
const maxWidth = 60;
|
|
41
|
+
const lines = [];
|
|
42
|
+
for (const word of answer.split(' ')) {
|
|
43
|
+
const last = lines[lines.length - 1];
|
|
44
|
+
if (!last || last.length + word.length + 1 > maxWidth) {
|
|
45
|
+
lines.push(word);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
lines[lines.length - 1] = last + ' ' + word;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const top = chalk_1.default.hex('#cc785c')(' ┌' + '─'.repeat(maxWidth + 2) + '┐');
|
|
52
|
+
const bottom = chalk_1.default.hex('#cc785c')(' └' + '─'.repeat(maxWidth + 2) + '┘');
|
|
53
|
+
const body = lines.map(l => chalk_1.default.hex('#ede0cc')(' │ ') + l.padEnd(maxWidth) + chalk_1.default.hex('#cc785c')(' │'));
|
|
54
|
+
return [
|
|
55
|
+
'',
|
|
56
|
+
top,
|
|
57
|
+
...body,
|
|
58
|
+
bottom,
|
|
59
|
+
chalk_1.default.hex('#4e3d30')(` ⚡ ${tokens} tokens — press ENTER to dismiss`),
|
|
60
|
+
'',
|
|
61
|
+
].join('\n');
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=side-channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"side-channel.js","sourceRoot":"","sources":["../../src/repl/side-channel.ts"],"names":[],"mappings":";;;;;AAyBA,kCAqBC;AAMD,0CAwBC;AAnED,kDAA0B;AAE1B,MAAM,iBAAiB,GAAG;;;mCAGS,CAAC;AAOpC;;;GAGG;AACI,KAAK,UAAU,WAAW,CAC/B,QAAgB,EAChB,QAAqB,EACrB,GAAmB;IAEnB,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,iBAAiB,EAAE;QAChD,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,QAAQ,EAAE,EAAE;KAC9C,EAAE,EAAE,CAAC,CAAC;IACP,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,WAAW,GAAG,CAAC,CAAC;IAEpB,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACjC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC;QACvB,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACjC,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;YACnC,IAAI,KAAK;gBAAE,WAAW,GAAG,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,YAAY,CAAC;QAClE,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE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AI;QACP,MAAM;QACN,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,OAAO,MAAM,kCAAkC,CAAC;QACrE,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -7,12 +7,13 @@ export interface CouncilResult {
|
|
|
7
7
|
htmlPath: string;
|
|
8
8
|
topic: string;
|
|
9
9
|
panelSize: number;
|
|
10
|
+
panelModel: string;
|
|
10
11
|
agentFailures: number;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* Run an Ecclesia: `panelSize` independent agents research the topic
|
|
14
|
-
*
|
|
15
|
-
*
|
|
15
|
+
* sequentially, then one synthesis call on the caller's active provider
|
|
16
|
+
* reconciles their findings into a verdict.
|
|
16
17
|
*/
|
|
17
18
|
export declare function runCouncil(opts: {
|
|
18
19
|
projectRoot: string;
|
|
@@ -23,4 +24,6 @@ export declare function runCouncil(opts: {
|
|
|
23
24
|
display: Display;
|
|
24
25
|
panelSize?: number;
|
|
25
26
|
panelModel?: string;
|
|
27
|
+
/** The session's configured routing model id (e.g. "deepseek/deepseek-v4-flash"). */
|
|
28
|
+
configuredModel?: string;
|
|
26
29
|
}): Promise<CouncilResult>;
|
package/dist/research/council.js
CHANGED
|
@@ -48,17 +48,28 @@ const factory_js_1 = require("../providers/factory.js");
|
|
|
48
48
|
*
|
|
49
49
|
* Cost design, deliberately conservative (see compaction/dream incidents):
|
|
50
50
|
* - The N panel agents run SEQUENTIALLY, each a short findings-only pass
|
|
51
|
-
* (not a full polished report)
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
51
|
+
* (not a full polished report). Local models produce catastrophic factual
|
|
52
|
+
* errors (e.g. hallucinated Djokovic stats), so Ollama is not a
|
|
53
|
+
* supported default.
|
|
54
|
+
* - Only the final synthesis step is reasoning-heavy; it runs as a single
|
|
55
|
+
* call on the caller's active provider.
|
|
55
56
|
* - Per-agent turns are capped well below :research's full budget.
|
|
56
57
|
*
|
|
58
|
+
* Panel model resolution (in priority order):
|
|
59
|
+
* 1. `opts.panelModel` — explicit caller override (CLI: `--panel <model>`).
|
|
60
|
+
* 2. `AURA_PANEL_MODEL` env var — global default for cheap-panel setups.
|
|
61
|
+
* 3. The synthesis provider's own model — the user's already-configured
|
|
62
|
+
* and authenticated model, whatever it is. This works for every user
|
|
63
|
+
* without assuming Xiaomi / OpenAI / any specific provider.
|
|
64
|
+
*
|
|
65
|
+
* Cost note: option 3 means a 5-agent council costs ~5× a single :research
|
|
66
|
+
* pass on whatever the user is paying for. Users who want cheaper runs can
|
|
67
|
+
* set AURA_PANEL_MODEL globally, or pass `--panel <fast-model>` per call.
|
|
68
|
+
*
|
|
57
69
|
* Output: dated `.md` + `.html` under `<projectRoot>/council/`.
|
|
58
70
|
*/
|
|
59
71
|
const COUNCIL_DIRNAME = 'council';
|
|
60
72
|
const DEFAULT_PANEL_SIZE = 5;
|
|
61
|
-
const DEFAULT_PANEL_MODEL = 'ollama/qwen2.5-coder:3b';
|
|
62
73
|
const FOOTER = '\n---\n\n*Ecclesia — five voices, one verdict. Inspired by DeerFlow.*\n';
|
|
63
74
|
function councilDir(projectRoot) {
|
|
64
75
|
return path.join(projectRoot, COUNCIL_DIRNAME);
|
|
@@ -162,15 +173,48 @@ ${bodyHtml}
|
|
|
162
173
|
</body>
|
|
163
174
|
</html>`;
|
|
164
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Pick which model the panel agents run on.
|
|
178
|
+
*
|
|
179
|
+
* Priority:
|
|
180
|
+
* 1. `override` — explicit `opts.panelModel` (set by `--panel <model>`)
|
|
181
|
+
* 2. `AURA_PANEL_MODEL` env var — global default for cheap-panel setups
|
|
182
|
+
* 3. The synthesis provider's `.model` — the user's authenticated, working
|
|
183
|
+
* model. Means the council just works for whoever ran `:provider`,
|
|
184
|
+
* without assuming any specific vendor.
|
|
185
|
+
*
|
|
186
|
+
* If none of these yield a model, throw with a clear message rather than
|
|
187
|
+
* passing `undefined` to `createProvider` (which historically produced
|
|
188
|
+
* opaque "400 Not supported model" errors).
|
|
189
|
+
*/
|
|
190
|
+
function resolvePanelModel(synthesisProvider, override, configuredModel) {
|
|
191
|
+
if (override && override.trim())
|
|
192
|
+
return override.trim();
|
|
193
|
+
const env = process.env.AURA_PANEL_MODEL;
|
|
194
|
+
if (env && env.trim())
|
|
195
|
+
return env.trim();
|
|
196
|
+
// The caller's configured routing id (e.g. "deepseek/deepseek-v4-flash").
|
|
197
|
+
// Preferred over the provider instance's `.model`, which has the provider
|
|
198
|
+
// prefix stripped ("deepseek-v4-flash") and therefore re-resolves through
|
|
199
|
+
// the generic OpenAI-compatible provider — the wrong endpoint entirely
|
|
200
|
+
// (this produced five identical 401s on the first live Ecclesia run).
|
|
201
|
+
if (configuredModel && configuredModel.trim())
|
|
202
|
+
return configuredModel.trim();
|
|
203
|
+
const fromProvider = synthesisProvider.model;
|
|
204
|
+
if (fromProvider && fromProvider.trim())
|
|
205
|
+
return fromProvider.trim();
|
|
206
|
+
throw new Error('Could not resolve a panel model. Pass --panel <model>, ' +
|
|
207
|
+
'set AURA_PANEL_MODEL, or configure a provider via :provider first.');
|
|
208
|
+
}
|
|
165
209
|
/**
|
|
166
210
|
* Run an Ecclesia: `panelSize` independent agents research the topic
|
|
167
|
-
*
|
|
168
|
-
*
|
|
211
|
+
* sequentially, then one synthesis call on the caller's active provider
|
|
212
|
+
* reconciles their findings into a verdict.
|
|
169
213
|
*/
|
|
170
214
|
async function runCouncil(opts) {
|
|
171
215
|
const { projectRoot, topic, synthesisProvider, context, permissions, display, } = opts;
|
|
172
216
|
const panelSize = Math.max(1, opts.panelSize ?? DEFAULT_PANEL_SIZE);
|
|
173
|
-
const panelModel = opts.panelModel
|
|
217
|
+
const panelModel = resolvePanelModel(synthesisProvider, opts.panelModel, opts.configuredModel);
|
|
174
218
|
const findings = [];
|
|
175
219
|
let agentFailures = 0;
|
|
176
220
|
// Sequential by design — see module doc. Each agent is independent: no
|
|
@@ -187,7 +231,26 @@ async function runCouncil(opts) {
|
|
|
187
231
|
maxTurns: 6,
|
|
188
232
|
disableSpawn: true,
|
|
189
233
|
});
|
|
190
|
-
|
|
234
|
+
let text = (res.summary ?? '').trim();
|
|
235
|
+
if (!res.success || /^Loop (ended|stalled)/i.test(text)) {
|
|
236
|
+
// The agent hit its turn cap (or stalled) before a final answer, so
|
|
237
|
+
// summary is just the loop-end marker. Salvage its last real message
|
|
238
|
+
// instead — feeding "Loop ended after 6 turns." to the synthesis
|
|
239
|
+
// makes the model fabricate an entire council from nothing (observed
|
|
240
|
+
// live: invented "3 of 5 agents" splits and fictional sources).
|
|
241
|
+
const lastAssistant = [...res.history].reverse().find((m) => m.role === 'assistant' && typeof m.content === 'string' && m.content.trim().length > 0);
|
|
242
|
+
text = lastAssistant?.content.trim() ?? '';
|
|
243
|
+
}
|
|
244
|
+
if (!text) {
|
|
245
|
+
// Tool-happy models (observed: DeepSeek) spend every turn on tool
|
|
246
|
+
// calls and never write prose, so there is nothing to salvage.
|
|
247
|
+
// Convert the research they DID gather into findings with one
|
|
248
|
+
// tool-less completion over their own history.
|
|
249
|
+
const wrap = await panelProvider.complete('Your tool budget is exhausted. Using ONLY what you already gathered in this conversation, ' +
|
|
250
|
+
'write the findings now in the requested format: 4-8 specific bullet points with sources in ' +
|
|
251
|
+
'parentheses, then one line "Stance: <bottom-line take>". Do not call tools. No preamble.', [...res.history, { role: 'user', content: 'Tool budget exhausted — write your findings list and stance NOW.' }], []);
|
|
252
|
+
text = (wrap.text ?? '').trim();
|
|
253
|
+
}
|
|
191
254
|
findings.push(text || `(Agent ${seat} returned no findings.)`);
|
|
192
255
|
}
|
|
193
256
|
catch (err) {
|
|
@@ -220,6 +283,6 @@ async function runCouncil(opts) {
|
|
|
220
283
|
const htmlOut = wrapHtml(topic, mdToHtml(`${verdictBody}${rawFindingsSection}`), date, panelSize);
|
|
221
284
|
const htmlPath = path.join(dir, `${date}-${slug}.html`);
|
|
222
285
|
fs.writeFileSync(htmlPath, htmlOut);
|
|
223
|
-
return { path: mdPath, htmlPath, topic, panelSize, agentFailures };
|
|
286
|
+
return { path: mdPath, htmlPath, topic, panelSize, panelModel, agentFailures };
|
|
224
287
|
}
|
|
225
288
|
//# sourceMappingURL=council.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"council.js","sourceRoot":"","sources":["../../src/research/council.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"council.js","sourceRoot":"","sources":["../../src/research/council.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkNA,gCAqGC;AAvTD,uCAAyB;AACzB,2CAA6B;AAC7B,mCAAgC;AAChC,8CAAgD;AAChD,wDAAyD;AAMzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,eAAe,GAAG,SAAS,CAAC;AAClC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,MAAM,GAAG,yEAAyE,CAAC;AAEzF,SAAS,UAAU,CAAC,WAAmB;IACrC,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,OAAO,CAAC,KAAa;IAC5B,OAAO,KAAK;SACT,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC;AAC7B,CAAC;AAED,SAAS,cAAc,CAAC,KAAa,EAAE,IAAY,EAAE,SAAiB;IACpE,OAAO,CACL,sBAAsB,IAAI,OAAO,SAAS,uDAAuD,KAAK,OAAO;QAC7G,2FAA2F;QAC3F,iEAAiE;QACjE,kGAAkG;QAClG,gGAAgG;QAChG,yEAAyE;QACzE,mFAAmF,CACpF,CAAC;AACJ,CAAC;AAED,S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
+
import type { HistoryMessage, LLMProvider } from '../providers/types.js';
|
|
2
|
+
import { type LoopResult } from '../agent/loop.js';
|
|
4
3
|
import type { ProjectContext } from '../agent/context.js';
|
|
5
4
|
import { PermissionSystem } from '../safety/permissions.js';
|
|
6
5
|
import type { Display } from '../cli/display.js';
|
|
@@ -15,39 +14,21 @@ export interface AlternatorOptions {
|
|
|
15
14
|
/** When set, routing and loop events are surfaced to the user. */
|
|
16
15
|
display?: Display;
|
|
17
16
|
/**
|
|
18
|
-
* The permission system
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* defaulted to a hardcoded 'auto', meaning destructive operations could
|
|
22
|
-
* get silently approved during the Ruby attempt even in a session the
|
|
23
|
-
* user explicitly ran in confirmation-required 'normal' mode.
|
|
17
|
+
* The session's permission system. When omitted, defaults to the safe
|
|
18
|
+
* 'normal' level — NEVER 'auto': the Ruby attempt must not auto-approve
|
|
19
|
+
* destructive operations the user's chosen mode would have prompted for.
|
|
24
20
|
*/
|
|
25
21
|
permissions?: PermissionSystem;
|
|
26
|
-
/**
|
|
27
|
-
* Confirmation callback for destructive operations, passed through to
|
|
28
|
-
* both the Ruby attempt and the large-model escalation. Pass the same
|
|
29
|
-
* one the caller already uses (e.g. the REPL's readline-based prompt) —
|
|
30
|
-
* without it, each inner loop falls back to its own default terminal
|
|
31
|
-
* confirm(), which can behave inconsistently alongside an already-active
|
|
32
|
-
* readline interface.
|
|
33
|
-
*/
|
|
22
|
+
/** Confirmation prompt for needs-confirm tool calls, threaded into the loop. */
|
|
34
23
|
confirmFn?: (message: string) => Promise<boolean>;
|
|
35
|
-
/**
|
|
36
|
-
* Prior conversation history to resume from (e.g. the REPL's stay-active
|
|
37
|
-
* history, or a loaded session). Without this, every Ruby-alternated
|
|
38
|
-
* turn would silently start fresh, breaking multi-turn conversation
|
|
39
|
-
* continuation any time alternation activates mid-conversation.
|
|
40
|
-
*/
|
|
24
|
+
/** Prior conversation history (multi-turn REPL), threaded into the loop. */
|
|
41
25
|
initialHistory?: HistoryMessage[];
|
|
42
26
|
}
|
|
43
27
|
export interface AlternatorRunResult {
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*
|
|
48
|
-
* history, costUsd, turns, and toolCallLog are all populated correctly
|
|
49
|
-
* from whichever path ran, so callers don't need special-case handling.
|
|
50
|
-
*/
|
|
28
|
+
/** Final user-facing output text (loopResult.summary, or an error note). */
|
|
29
|
+
result: string;
|
|
30
|
+
/** The full LoopResult from whichever model handled the task. Never undefined —
|
|
31
|
+
* a safe empty result is substituted when every path failed. */
|
|
51
32
|
loopResult: LoopResult;
|
|
52
33
|
episode: Episode;
|
|
53
34
|
usedRuby: boolean;
|