osborn 0.9.145 → 0.9.146
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/dist/claude-llm.js +34 -2
- package/package.json +1 -1
package/dist/claude-llm.js
CHANGED
|
@@ -12,6 +12,7 @@ import { EventEmitter } from 'events';
|
|
|
12
12
|
import { saveSessionMetadata, getSessionWorkspace } from './config.js';
|
|
13
13
|
import { statusManager } from './status-manager.js';
|
|
14
14
|
import { getResearchSystemPrompt, getDirectModeResearchPrompt } from './prompts.js';
|
|
15
|
+
import { getIndexPath } from './summary-index.js';
|
|
15
16
|
import { existsSync, readdirSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
16
17
|
import { join, dirname } from 'node:path';
|
|
17
18
|
import { fileURLToPath } from 'node:url';
|
|
@@ -1133,9 +1134,13 @@ export class ClaudeLLM extends llm.LLM {
|
|
|
1133
1134
|
return;
|
|
1134
1135
|
this.#dispatchedFor.add(agentId);
|
|
1135
1136
|
try {
|
|
1137
|
+
const idxPathReviewer = (this.#sessionId && this.#opts.workingDirectory)
|
|
1138
|
+
? getIndexPath(this.#sessionId, this.#opts.workingDirectory)
|
|
1139
|
+
: null;
|
|
1136
1140
|
const prompt = [
|
|
1137
1141
|
'Use the reviewer sub-agent to review this writer output for correctness/spec-adherence/obvious bugs.',
|
|
1138
1142
|
'End your reply with exactly `VERDICT: ACCEPT` or `VERDICT: REJECT`.',
|
|
1143
|
+
...(idxPathReviewer ? [`The session index is at ${idxPathReviewer} — you MUST read it before reviewing.`] : []),
|
|
1139
1144
|
'',
|
|
1140
1145
|
'<writer_output>',
|
|
1141
1146
|
writerOutput.slice(0, 8000),
|
|
@@ -1148,8 +1153,11 @@ export class ClaudeLLM extends llm.LLM {
|
|
|
1148
1153
|
const reviewerOptions = {
|
|
1149
1154
|
cwd: this.#opts.workingDirectory,
|
|
1150
1155
|
permissionMode: 'default',
|
|
1156
|
+
systemPrompt: NAMED_AGENTS.reviewer.prompt,
|
|
1157
|
+
allowedTools: ['Read', 'Glob', 'Grep', 'Bash', 'Write', 'Edit'],
|
|
1151
1158
|
hooks: {
|
|
1152
|
-
PreToolUse: [
|
|
1159
|
+
PreToolUse: [
|
|
1160
|
+
{
|
|
1153
1161
|
matcher: '.*',
|
|
1154
1162
|
hooks: [async (input) => {
|
|
1155
1163
|
const toolName = input?.tool_name || 'unknown';
|
|
@@ -1157,7 +1165,26 @@ export class ClaudeLLM extends llm.LLM {
|
|
|
1157
1165
|
emitter.emit('tool_use', { name: toolName, input: toolInput, agentRole: 'reviewer' });
|
|
1158
1166
|
return {};
|
|
1159
1167
|
}],
|
|
1160
|
-
}
|
|
1168
|
+
},
|
|
1169
|
+
{
|
|
1170
|
+
matcher: '.*',
|
|
1171
|
+
hooks: [async (input) => {
|
|
1172
|
+
const toolName = input?.tool_name || '';
|
|
1173
|
+
const toolInput = input?.tool_input;
|
|
1174
|
+
if ((toolName === 'Write' || toolName === 'Edit' || toolName === 'MultiEdit') &&
|
|
1175
|
+
!/\.(md|markdown|mdx|txt|rst|adoc)$/i.test(String(toolInput?.file_path))) {
|
|
1176
|
+
return {
|
|
1177
|
+
hookSpecificOutput: {
|
|
1178
|
+
hookEventName: 'PreToolUse',
|
|
1179
|
+
permissionDecision: 'deny',
|
|
1180
|
+
},
|
|
1181
|
+
reason: 'reviewer may only write documentation files (.md/.markdown/.mdx/.txt/.rst/.adoc)',
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
return {};
|
|
1185
|
+
}],
|
|
1186
|
+
},
|
|
1187
|
+
],
|
|
1161
1188
|
PostToolUse: [{
|
|
1162
1189
|
matcher: '.*',
|
|
1163
1190
|
hooks: [async (input) => {
|
|
@@ -1211,10 +1238,14 @@ export class ClaudeLLM extends llm.LLM {
|
|
|
1211
1238
|
return;
|
|
1212
1239
|
this.#dispatchedFor.add(agentId);
|
|
1213
1240
|
try {
|
|
1241
|
+
const idxPathGate = (this.#sessionId && this.#opts.workingDirectory)
|
|
1242
|
+
? getIndexPath(this.#sessionId, this.#opts.workingDirectory)
|
|
1243
|
+
: null;
|
|
1214
1244
|
const prompt = [
|
|
1215
1245
|
'Use the reasoner sub-agent to vet this research output.',
|
|
1216
1246
|
'Determine whether the research is sufficient to answer the original question.',
|
|
1217
1247
|
'End your reply with exactly `GATE: PASS` or `GATE: NEEDS-MORE`.',
|
|
1248
|
+
...(idxPathGate ? [`The session index is at ${idxPathGate} — you MUST read it before reviewing.`] : []),
|
|
1218
1249
|
'',
|
|
1219
1250
|
'<research_output>',
|
|
1220
1251
|
researchOutput.slice(0, 8000),
|
|
@@ -1227,6 +1258,7 @@ export class ClaudeLLM extends llm.LLM {
|
|
|
1227
1258
|
const gateOptions = {
|
|
1228
1259
|
cwd: this.#opts.workingDirectory,
|
|
1229
1260
|
permissionMode: 'default',
|
|
1261
|
+
systemPrompt: NAMED_AGENTS.reasoner.prompt,
|
|
1230
1262
|
hooks: {
|
|
1231
1263
|
PreToolUse: [{
|
|
1232
1264
|
matcher: '.*',
|