@iamoberlin/chorus 1.2.6 → 1.2.7

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.
Files changed (2) hide show
  1. package/index.ts +24 -8
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -38,7 +38,7 @@ import {
38
38
  import * as prayers from "./src/prayers/prayers.js";
39
39
  import * as prayerStore from "./src/prayers/store.js";
40
40
 
41
- const VERSION = "1.2.6"; // Fixed: use --message flag instead of nonexistent stdin support
41
+ const VERSION = "1.2.7"; // Fixed JSON parsing: extract JSON from output (plugin logs prefix it)
42
42
 
43
43
  const plugin = {
44
44
  id: "chorus",
@@ -208,7 +208,13 @@ const plugin = {
208
208
  isolated: true,
209
209
  timeoutSeconds: 300,
210
210
  });
211
- console.log(` ✓ ${choir.name} complete`);
211
+ const text = result?.text || result?.payloads?.[0]?.text || '';
212
+ const duration = result?.meta?.durationMs || 0;
213
+ console.log(` ✓ ${choir.name} complete (${(duration/1000).toFixed(1)}s)`);
214
+ if (text) {
215
+ const preview = text.slice(0, 150).replace(/\n/g, ' ');
216
+ console.log(` ${preview}${text.length > 150 ? '...' : ''}`);
217
+ }
212
218
  } catch (err) {
213
219
  console.error(` ✗ ${choir.name} failed:`, err);
214
220
  }
@@ -228,7 +234,11 @@ const plugin = {
228
234
 
229
235
  if (result.status === 0) {
230
236
  try {
231
- const json = JSON.parse(result.stdout || '{}');
237
+ // Extract JSON from output (may have plugin logs before it)
238
+ const stdout = result.stdout || '';
239
+ const jsonStart = stdout.indexOf('{');
240
+ const jsonStr = jsonStart >= 0 ? stdout.slice(jsonStart) : '{}';
241
+ const json = JSON.parse(jsonStr);
232
242
  const text = json.result?.payloads?.[0]?.text || '';
233
243
  const duration = json.result?.meta?.durationMs || 0;
234
244
  console.log(` ✓ ${choir.name} complete (${(duration/1000).toFixed(1)}s)`);
@@ -236,8 +246,8 @@ const plugin = {
236
246
  const preview = text.slice(0, 150).replace(/\n/g, ' ');
237
247
  console.log(` ${preview}${text.length > 150 ? '...' : ''}`);
238
248
  }
239
- } catch {
240
- console.log(` ✓ ${choir.name} complete`);
249
+ } catch (parseErr) {
250
+ console.log(` ✓ ${choir.name} complete (parse error: ${parseErr})`);
241
251
  }
242
252
  } else {
243
253
  const errMsg = result.stderr || result.stdout || 'Unknown error';
@@ -327,7 +337,10 @@ const plugin = {
327
337
  });
328
338
  if (result.status === 0 && result.stdout) {
329
339
  try {
330
- const json = JSON.parse(result.stdout);
340
+ const stdout = result.stdout;
341
+ const jsonStart = stdout.indexOf('{');
342
+ const jsonStr = jsonStart >= 0 ? stdout.slice(jsonStart) : '{}';
343
+ const json = JSON.parse(jsonStr);
331
344
  const text = json.result?.payloads?.[0]?.text || '';
332
345
  contextStore.set(`${choirId}:d${day}`, text.slice(0, 500));
333
346
  console.log(` ✓ (dry)`);
@@ -360,9 +373,12 @@ const plugin = {
360
373
  });
361
374
 
362
375
  if (result.status === 0) {
363
- // Parse the agent response
376
+ // Parse the agent response (extract JSON from output)
364
377
  try {
365
- const json = JSON.parse(result.stdout || '{}');
378
+ const stdout = result.stdout || '';
379
+ const jsonStart = stdout.indexOf('{');
380
+ const jsonStr = jsonStart >= 0 ? stdout.slice(jsonStart) : '{}';
381
+ const json = JSON.parse(jsonStr);
366
382
  const text = json.result?.payloads?.[0]?.text || '';
367
383
  const duration = json.result?.meta?.durationMs || 0;
368
384
  contextStore.set(`${choirId}:d${day}`, text.slice(0, 2000)); // Keep 2KB of response
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamoberlin/chorus",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "description": "CHORUS: Hierarchy Of Recursive Unified Self-improvement — with Prayer Requests social network",
5
5
  "author": "Oberlin <iam@oberlin.ai>",
6
6
  "license": "MIT",