@iamoberlin/chorus 1.2.3 → 1.2.5

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 +52 -20
  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.3"; // Vision now outputs collected insights + RSI summary
41
+ const VERSION = "1.2.5"; // Vision now correctly passes choir prompts via stdin
42
42
 
43
43
  const plugin = {
44
44
  id: "chorus",
@@ -264,8 +264,8 @@ const plugin = {
264
264
  // NOTE: This is CLI-only, runs via spawned openclaw agent calls
265
265
  program
266
266
  .command("vision [days]")
267
- .description("Simulate multiple days of choir cycles (prophetic vision)")
268
- .option("--dry-run", "Show what would run without executing")
267
+ .description("Run multiple days of choir cycles with real state changes (prophetic vision)")
268
+ .option("--dry-run", "Narration mode: describe what would happen without executing")
269
269
  .action((daysArg?: string, options?: { dryRun?: boolean }) => {
270
270
  // Synchronous wrapper to avoid async issues in commander
271
271
  const days = parseInt(daysArg || "1", 10);
@@ -286,9 +286,13 @@ const plugin = {
286
286
  console.log("");
287
287
  console.log("👁️ VISION MODE");
288
288
  console.log("═".repeat(55));
289
- console.log(` Simulating ${days} day${days > 1 ? 's' : ''} of cognitive cycles`);
290
- console.log(` Total choir runs: ${days * 9}`);
291
- console.log(` Mode: ${options?.dryRun ? 'DRY RUN' : 'LIVE'}`);
289
+ console.log(` Days: ${days}`);
290
+ console.log(` Choir runs: ${days * 9}`);
291
+ if (options?.dryRun) {
292
+ console.log(` Mode: DRY RUN (narration only, no state changes)`);
293
+ } else {
294
+ console.log(` Mode: LIVE (real execution, real state changes)`);
295
+ }
292
296
  console.log("");
293
297
 
294
298
  const startTime = Date.now();
@@ -307,38 +311,66 @@ const plugin = {
307
311
  totalRuns++;
308
312
 
309
313
  if (options?.dryRun) {
310
- console.log(` ${choir.emoji} ${choir.name} (would run)`);
311
- contextStore.set(choirId, `[Simulated ${choir.name} output for day ${day}]`);
314
+ // Dry run: narration mode - describe what would happen without doing it
315
+ process.stdout.write(` ${choir.emoji} ${choir.name}...`);
316
+ try {
317
+ const dryPrompt = `You are ${choir.name} in VISION MODE (day ${day}/${days}). Role: ${choir.function}. Output: ${choir.output}. Briefly describe what you would do. Keep response under 300 words.`;
318
+ const result = spawnSync('openclaw', [
319
+ 'agent',
320
+ '--session-id', `chorus:vision:dry:${choirId}:d${day}`,
321
+ '--message', dryPrompt,
322
+ '--json',
323
+ ], {
324
+ encoding: 'utf-8',
325
+ timeout: 60000,
326
+ maxBuffer: 1024 * 1024,
327
+ });
328
+ if (result.status === 0 && result.stdout) {
329
+ try {
330
+ const json = JSON.parse(result.stdout);
331
+ const text = json.result?.payloads?.[0]?.text || '';
332
+ contextStore.set(`${choirId}:d${day}`, text.slice(0, 500));
333
+ console.log(` ✓ (dry)`);
334
+ } catch {
335
+ contextStore.set(`${choirId}:d${day}`, `[${choir.name} would run]`);
336
+ console.log(` ✓ (dry)`);
337
+ }
338
+ } else {
339
+ console.log(` ✗ (dry)`);
340
+ }
341
+ } catch {
342
+ console.log(` ✗ (dry)`);
343
+ }
312
344
  continue;
313
345
  }
314
346
 
315
347
  process.stdout.write(` ${choir.emoji} ${choir.name}...`);
316
348
 
317
349
  try {
318
- // Build a simplified prompt for vision mode (short enough for CLI args)
319
- const visionPrompt = `You are ${choir.name} in VISION MODE (day ${day}/${days}). Role: ${choir.function}. Output: ${choir.output}. Provide a brief summary of what you would do. Keep response under 300 words.`;
320
-
321
- // Vision prompts are short - safe to use --message
350
+ // Run the REAL choir with full tool access via direct agent call
351
+ // Pass the choir prompt via stdin to avoid arg length limits
322
352
  const result = spawnSync('openclaw', [
323
353
  'agent',
324
354
  '--session-id', `chorus:vision:${choirId}:d${day}`,
325
- '--message', visionPrompt,
326
355
  '--json',
327
356
  ], {
357
+ input: choir.prompt, // Pass the full choir prompt via stdin
328
358
  encoding: 'utf-8',
329
- timeout: 120000, // 2 min timeout per choir
330
- maxBuffer: 1024 * 1024, // 1MB buffer
359
+ timeout: 300000, // 5 min timeout per choir (real work takes longer)
360
+ maxBuffer: 10 * 1024 * 1024, // 10MB buffer for full output
331
361
  });
332
362
 
333
- if (result.status === 0 && result.stdout) {
363
+ if (result.status === 0) {
364
+ // Parse the agent response
334
365
  try {
335
- const json = JSON.parse(result.stdout);
366
+ const json = JSON.parse(result.stdout || '{}');
336
367
  const text = json.result?.payloads?.[0]?.text || '';
337
- contextStore.set(`${choirId}:d${day}`, text.slice(0, 500));
368
+ const duration = json.result?.meta?.durationMs || 0;
369
+ contextStore.set(`${choirId}:d${day}`, text.slice(0, 2000)); // Keep 2KB of response
338
370
  successfulRuns++;
339
- console.log(` ✓`);
371
+ console.log(` ✓ (${(duration/1000).toFixed(1)}s)`);
340
372
  } catch {
341
- contextStore.set(`${choirId}:d${day}`, `[${choir.name} completed]`);
373
+ contextStore.set(`${choirId}:d${day}`, result.stdout?.slice(-2000) || `[${choir.name} completed]`);
342
374
  successfulRuns++;
343
375
  console.log(` ✓`);
344
376
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamoberlin/chorus",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
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",