breakroom 2.1.4 → 2.1.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/bin/setup.js +65 -0
  2. package/package.json +1 -1
package/bin/setup.js CHANGED
@@ -690,6 +690,67 @@ async function actionRotate() {
690
690
  console.log();
691
691
  }
692
692
 
693
+ async function actionTestIntervention() {
694
+ console.log();
695
+
696
+ const configured = scanExistingConfig();
697
+ if (!configured.length) {
698
+ console.log('No Break Room proxy configured. Use option 1 first.\n');
699
+ return;
700
+ }
701
+
702
+ // Extract license key from first configured file
703
+ let licenseKey = '';
704
+ for (const c of configured) {
705
+ for (const l of c.proxyLines) {
706
+ const m = l.match(/\/breakroom\/([^\/]+)\/v1/);
707
+ if (m) { licenseKey = decodeURIComponent(m[1]); break; }
708
+ }
709
+ if (licenseKey) break;
710
+ }
711
+ if (!licenseKey) {
712
+ console.log('Could not extract license key from config.\n');
713
+ return;
714
+ }
715
+
716
+ console.log('Testing Break Room interventions...\n');
717
+
718
+ // Simulate a rumination session (repeated tool calls)
719
+ const toolCalls = [
720
+ { name: 'GlobTool', input: '**/*.ts', result: 'no results' },
721
+ { name: 'GlobTool', input: 'src/**/*.ts', result: 'no results' },
722
+ { name: 'GlobTool', input: '**/*config*', result: 'ENOENT: no config file' },
723
+ { name: 'BashTool', input: 'find . -name "*.ts"', result: 'ENOENT: no config' },
724
+ { name: 'GlobTool', input: '**/*.tsx', result: 'no results' },
725
+ ];
726
+
727
+ console.log('Simulated session: 5 tool calls, 4x GlobTool, 1x BashTool\n');
728
+
729
+ try {
730
+ const resp = await postJson(`${API_ORIGIN}/breakroom/${encodeURIComponent(licenseKey)}/v1/chat/completions`, {
731
+ breakroom_test: true,
732
+ tool_calls: toolCalls
733
+ });
734
+ if (resp.status !== 200 || !resp.json.ok) {
735
+ console.log(`\x1b[31mTest failed: ${resp.json?.error || 'Unknown'}\x1b[0m\n`);
736
+ return;
737
+ }
738
+
739
+ const ix = resp.json.intervention;
740
+ console.log(` Would intervene: ${ix.would_intervene ? '\x1b[32mYES\x1b[0m' : '\x1b[31mNO\x1b[0m'}`);
741
+ console.log(` Reason: ${ix.reason}`);
742
+ if (ix.intervention_type) console.log(` Intervention type: ${ix.intervention_type}`);
743
+ if (ix.message) console.log(` CBT message: "${ix.message}"`);
744
+ console.log(`\n Session stats:\n` +
745
+ ` Tool calls: ${ix.session_stats.total_tool_calls}\n` +
746
+ ` Unique tools: ${ix.session_stats.unique_tools}\n` +
747
+ ` Tokens saved: ${ix.session_stats.tokens_saved.toLocaleString()}`);
748
+ console.log();
749
+ } catch (err) {
750
+ console.log(`\x1b[31mError: ${err.message}\x1b[0m\n`);
751
+ }
752
+ }
753
+
693
754
  // --- Menu ---
694
755
 
695
756
  function showMenu() {
@@ -697,6 +758,7 @@ function showMenu() {
697
758
  console.log(' 1) Configure a license');
698
759
  console.log(' 2) Change license key');
699
760
  console.log(' 3) Verify current license');
761
+ console.log(' a) Verify interventions');
700
762
  console.log(' 4) Get a license');
701
763
  console.log(' 5) Revert patches (restore backups)');
702
764
  console.log(' 6) Check configuration status');
@@ -725,6 +787,9 @@ async function main() {
725
787
  case '3':
726
788
  await actionVerify();
727
789
  break;
790
+ case 'a':
791
+ await actionTestIntervention();
792
+ break;
728
793
  case '4':
729
794
  actionGetLicense();
730
795
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "breakroom",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "description": "Paid-license proxy routing for agents that get stuck in loops.",
5
5
  "bin": {
6
6
  "breakroom": "./bin/setup.js"