breakroom 2.1.3 → 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 +68 -0
  2. package/package.json +1 -1
package/bin/setup.js CHANGED
@@ -237,6 +237,7 @@ const ALL_BASE_URL_VARS = [
237
237
  'AI21_BASE_URL',
238
238
  'XAI_BASE_URL', 'XAI_API_BASE',
239
239
  'REPLICATE_API_BASE',
240
+ 'HERMES_API_BASE', 'HERMES_BASE_URL',
240
241
  'OPENAI_LIKE_API_BASE',
241
242
  'LLM_BASE_URL', 'LLM_API_BASE', 'OPENAI_API_BASE',
242
243
  ];
@@ -256,10 +257,12 @@ const ALL_BASE_URL_KEYS = [
256
257
  'AI21_BASE_URL',
257
258
  'XAI_BASE_URL',
258
259
  'REPLICATE_API_BASE',
260
+ 'HERMES_API_BASE', 'HERMES_BASE_URL',
259
261
  'OPENAI_LIKE_API_BASE',
260
262
  'LLM_BASE_URL', 'OPENAI_API_BASE',
261
263
  'openAiBaseUrl', 'anthropicBaseUrl',
262
264
  'openAiBaseURL', 'anthropicBaseURL',
265
+ 'hermesApiBase', 'hermesBaseUrl',
263
266
  ];
264
267
 
265
268
  function buildPatch(filePath, proxyUrl) {
@@ -687,6 +690,67 @@ async function actionRotate() {
687
690
  console.log();
688
691
  }
689
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
+
690
754
  // --- Menu ---
691
755
 
692
756
  function showMenu() {
@@ -694,6 +758,7 @@ function showMenu() {
694
758
  console.log(' 1) Configure a license');
695
759
  console.log(' 2) Change license key');
696
760
  console.log(' 3) Verify current license');
761
+ console.log(' a) Verify interventions');
697
762
  console.log(' 4) Get a license');
698
763
  console.log(' 5) Revert patches (restore backups)');
699
764
  console.log(' 6) Check configuration status');
@@ -722,6 +787,9 @@ async function main() {
722
787
  case '3':
723
788
  await actionVerify();
724
789
  break;
790
+ case 'a':
791
+ await actionTestIntervention();
792
+ break;
725
793
  case '4':
726
794
  actionGetLicense();
727
795
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "breakroom",
3
- "version": "2.1.3",
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"