osborn 0.9.281 → 0.9.283

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/scripts/review.ts CHANGED
@@ -7,14 +7,11 @@
7
7
  * 2. Extract voice mode + provider from the log via regex.
8
8
  * 3. Dynamic-import the current prompts from `../src/prompts.ts` so the
9
9
  * reviewer sees the LATEST version of each prompt (not a snapshot).
10
- * 4. Extract the pipeline fast-brain `buildSystemPrompt` function source
11
- * from `../src/pipeline-fastbrain.ts` (which is module-private and
12
- * cannot be dynamic-imported as a value).
13
- * 5. Build a markdown review brief: session summary + raw log + active
10
+ * 4. Build a markdown review brief: session summary + raw log + active
14
11
  * prompts + review task instructions.
15
- * 6. Size-check — if too large for argv, write the brief to a file and
12
+ * 5. Size-check — if too large for argv, write the brief to a file and
16
13
  * pass a pointer instead.
17
- * 7. Spawn `claude` CLI with `stdio: 'inherit'` and `--add-dir agent/src`
14
+ * 6. Spawn `claude` CLI with `stdio: 'inherit'` and `--add-dir agent/src`
18
15
  * so the reviewing Claude can Read / Grep / Edit the prompt files.
19
16
  *
20
17
  * Usage:
@@ -141,11 +138,9 @@ async function loadPrompts(mode: string, wd: string): Promise<PromptSection[]> {
141
138
  label: 'Research System Prompt (Claude SDK — agent/src/prompts.ts: getResearchSystemPrompt)',
142
139
  text: promptsModule.getResearchSystemPrompt?.(wd) ?? '(export not found)',
143
140
  })
144
- // Pipeline fast brain system prompt — see extractPipelineFastBrainSource below.
145
- const pfbSource = extractPipelineFastBrainSource()
146
141
  sections.push({
147
- label: 'Pipeline Fast Brain — buildSystemPrompt function source (agent/src/pipeline-fastbrain.ts)',
148
- text: pfbSource ?? '(extraction failed — pipeline-fastbrain.ts format may have changed)',
142
+ label: 'Pipeline Fast Brain System Prompt (agent/src/prompts/pipeline-fast-brain.md: getPipelineFastBrainPrompt)',
143
+ text: promptsModule.getPipelineFastBrainPrompt?.() ?? '(export not found)',
149
144
  })
150
145
  } else if (mode === 'realtime') {
151
146
  sections.push({
@@ -165,61 +160,6 @@ async function loadPrompts(mode: string, wd: string): Promise<PromptSection[]> {
165
160
  return sections
166
161
  }
167
162
 
168
- // ============================================================================
169
- // buildSystemPrompt extractor (brace-match, since it's not exported)
170
- // ============================================================================
171
-
172
- function extractPipelineFastBrainSource(): string | null {
173
- const pfbPath = join(agentSrcDir, 'pipeline-fastbrain.ts')
174
- if (!existsSync(pfbPath)) return null
175
- const src = readFileSync(pfbPath, 'utf-8')
176
-
177
- const startIdx = src.indexOf('function buildSystemPrompt')
178
- if (startIdx === -1) return null
179
-
180
- // Step 1: find the opening PAREN of the parameter list.
181
- const openParenIdx = src.indexOf('(', startIdx)
182
- if (openParenIdx === -1) return null
183
-
184
- // Step 2: paren-match to find the closing paren. We MUST skip past the
185
- // parameter list before looking for the function body's opening brace,
186
- // because TypeScript parameter type annotations contain braces
187
- // (e.g. `chatHistory?: { role: string; content: string }[]`). A naive
188
- // brace walker would latch onto the first `{` inside the param list,
189
- // decrement on its matching `}`, and return a 2-line "function body"
190
- // that's just the signature prefix.
191
- let parenDepth = 1
192
- let i = openParenIdx + 1
193
- while (i < src.length && parenDepth > 0) {
194
- const ch = src[i]
195
- if (ch === '(') parenDepth++
196
- else if (ch === ')') parenDepth--
197
- i++
198
- }
199
- if (parenDepth !== 0) return null
200
- const afterParamsIdx = i // position just after the closing `)`
201
-
202
- // Step 3: find the function body's opening brace AFTER the parameter list.
203
- // This skips any optional `: ReturnType` annotation between `)` and `{`.
204
- const openBraceIdx = src.indexOf('{', afterParamsIdx)
205
- if (openBraceIdx === -1) return null
206
-
207
- // Step 4: brace-match the function body. Doesn't handle braces in strings
208
- // or comments, which is fine for the current source (template literals
209
- // with `${...}` interpolations are balanced).
210
- let braceDepth = 1
211
- i = openBraceIdx + 1
212
- while (i < src.length && braceDepth > 0) {
213
- const ch = src[i]
214
- if (ch === '{') braceDepth++
215
- else if (ch === '}') braceDepth--
216
- i++
217
- }
218
- if (braceDepth !== 0) return null
219
-
220
- return src.substring(startIdx, i)
221
- }
222
-
223
163
  // ============================================================================
224
164
  // Step 4 — build markdown review brief
225
165
  // ============================================================================
@@ -319,7 +259,7 @@ Do NOT batch-propose a list of six edits. Each proposed change should be brought
319
259
 
320
260
  Only after the user has explicitly agreed to a specific change, use the Edit tool on:
321
261
  - \`${agentSrcDir}/prompts.ts\`
322
- - \`${agentSrcDir}/pipeline-fastbrain.ts\`
262
+ - \`${agentSrcDir}/prompts/pipeline-fast-brain.md\`
323
263
 
324
264
  ---
325
265