50c 3.0.14 → 3.1.0

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/50c.js +203 -5
  2. package/package.json +1 -1
package/bin/50c.js CHANGED
@@ -670,8 +670,201 @@ const LOCAL_TOOLS = [
670
670
  { name: "team_ask", description: "50c Team: Ask the team to run any 50c tool. Uses your API key.", inputSchema: { type: "object", properties: { tool: { type: "string", description: "50c tool name (e.g., hints, roast, genius, bcalc)" }, args: { type: "object", description: "Tool arguments" } }, required: ["tool"] } },
671
671
  { name: "team_chain", description: "50c Team: Chain multiple tools together. Output flows via $prev placeholder.", inputSchema: { type: "object", properties: { steps: { type: "array", description: "Array of {tool, args} - use $prev for previous result", items: { type: "object" } }, input: { type: "string", description: "Initial input (optional)" } }, required: ["steps"] } },
672
672
  { name: "pre_publish", description: "Pre-publish verification. Thorough checks before npm/github/arxiv/medical publish. Profiles: npm, github, arxiv, medical, science, math. Uses AI tools (bCalc, genius+, web_search) for academic verification. FREE.", inputSchema: { type: "object", properties: { profile: { type: "string", description: "Verification profile: npm, github, arxiv, medical, science, math", enum: ["npm", "github", "arxiv", "medical", "science", "math"] }, cwd: { type: "string", description: "Directory to check (default: current)" }, save_receipt: { type: "boolean", description: "Save receipt as markdown file" } } } },
673
+
674
+ // ENTERPRISE PRESET - Auto-Invent pipeline
675
+ { name: "auto_invent", description: "Enterprise: Full invention pipeline. Chains mind_opener → idea_fold → bcalc → genius_plus → compute → cvi_verify. Produces provable, verified solutions. $2.00", inputSchema: { type: "object", properties: { problem: { type: "string", description: "Problem or hypothesis to solve/prove" }, constraints: { type: "array", items: { type: "string" }, description: "Hard constraints the solution must satisfy" }, domain: { type: "string", description: "Domain hint: math, physics, engineering, business, code", enum: ["math", "physics", "engineering", "business", "code"] }, rigor: { type: "string", description: "Rigor level: standard (3 tools), deep (5 tools), exhaustive (all 6)", enum: ["standard", "deep", "exhaustive"], default: "deep" } }, required: ["problem"] } },
673
676
  ];
674
677
 
678
+ /**
679
+ * AUTO-INVENT: Enterprise invention pipeline
680
+ * Chains tools in order to produce provable, verified inventive solutions
681
+ *
682
+ * Pipeline (exhaustive):
683
+ * 1. mind_opener - 5 curious angles to explore the problem space
684
+ * 2. idea_fold - Test top angle through STEM lenses
685
+ * 3. bcalc - Mathematical discovery/verification
686
+ * 4. genius_plus - Self-improving code generation
687
+ * 5. compute - Execute and validate the solution
688
+ * 6. cvi_verify - Verify output against constraints
689
+ *
690
+ * Cost: ~$2.00 for exhaustive, ~$1.20 for deep, ~$0.60 for standard
691
+ */
692
+ async function autoInvent(args) {
693
+ const { problem, constraints = [], domain = 'code', rigor = 'deep' } = args;
694
+ const startTime = Date.now();
695
+
696
+ // Define pipeline stages by rigor level
697
+ const PIPELINES = {
698
+ standard: ['mind_opener', 'genius_plus', 'cvi_verify'],
699
+ deep: ['mind_opener', 'idea_fold', 'bcalc', 'genius_plus', 'cvi_verify'],
700
+ exhaustive: ['mind_opener', 'idea_fold', 'bcalc', 'genius_plus', 'compute', 'cvi_verify']
701
+ };
702
+
703
+ const pipeline = PIPELINES[rigor] || PIPELINES.deep;
704
+ const results = {
705
+ ok: true,
706
+ problem,
707
+ domain,
708
+ rigor,
709
+ constraints,
710
+ stages: [],
711
+ invention: null,
712
+ verified: false,
713
+ proofs: [],
714
+ cost_estimate: rigor === 'exhaustive' ? '$2.00' : rigor === 'deep' ? '$1.20' : '$0.60'
715
+ };
716
+
717
+ let context = problem;
718
+ let bestAngle = null;
719
+ let mathProof = null;
720
+ let generatedCode = null;
721
+
722
+ for (const stage of pipeline) {
723
+ const stageStart = Date.now();
724
+ let stageResult = null;
725
+
726
+ try {
727
+ switch (stage) {
728
+ case 'mind_opener':
729
+ // Get 5 curious angles on the problem
730
+ stageResult = await call50cTool('mind_opener', { problem: context });
731
+ if (stageResult.angles && stageResult.angles.length > 0) {
732
+ bestAngle = stageResult.angles[0]; // Take the first/best angle
733
+ context = `${problem}\n\nApproach: ${bestAngle}`;
734
+ }
735
+ break;
736
+
737
+ case 'idea_fold':
738
+ // Test the chosen angle through STEM lenses
739
+ stageResult = await call50cTool('idea_fold', {
740
+ claim: bestAngle || problem,
741
+ context: `Domain: ${domain}. Problem: ${problem}`
742
+ });
743
+ if (stageResult.synthesis) {
744
+ context = `${context}\n\nSTEM Analysis: ${stageResult.synthesis}`;
745
+ }
746
+ break;
747
+
748
+ case 'bcalc':
749
+ // Mathematical discovery/verification
750
+ const mathQuery = domain === 'math' ? problem :
751
+ `Mathematical model for: ${bestAngle || problem}`;
752
+ stageResult = await call50cTool('bcalc', {
753
+ expression: mathQuery,
754
+ mode: 'explore'
755
+ });
756
+ if (stageResult.discovery || stageResult.result) {
757
+ mathProof = stageResult;
758
+ results.proofs.push({ type: 'mathematical', data: stageResult });
759
+ context = `${context}\n\nMath foundation: ${JSON.stringify(stageResult.discovery || stageResult.result)}`;
760
+ }
761
+ break;
762
+
763
+ case 'genius_plus':
764
+ // Self-improving code generation
765
+ const codePrompt = domain === 'code' ?
766
+ `${context}\n\nConstraints: ${constraints.join(', ')}` :
767
+ `Implement solution for: ${context}\n\nDomain: ${domain}\nConstraints: ${constraints.join(', ')}`;
768
+ stageResult = await call50cTool('genius_plus', { problem: codePrompt });
769
+ if (stageResult.code || stageResult.solution) {
770
+ generatedCode = stageResult.code || stageResult.solution;
771
+ results.invention = {
772
+ code: generatedCode,
773
+ explanation: stageResult.explanation || stageResult.reasoning,
774
+ iterations: stageResult.iterations || 1
775
+ };
776
+ }
777
+ break;
778
+
779
+ case 'compute':
780
+ // Execute and validate (only if we have code)
781
+ if (generatedCode) {
782
+ stageResult = await call50cTool('compute', { code: generatedCode });
783
+ results.proofs.push({ type: 'execution', data: stageResult });
784
+ if (stageResult.error) {
785
+ results.invention.execution_error = stageResult.error;
786
+ } else {
787
+ results.invention.execution_result = stageResult.result || stageResult.output;
788
+ }
789
+ } else {
790
+ stageResult = { skipped: true, reason: 'No code to execute' };
791
+ }
792
+ break;
793
+
794
+ case 'cvi_verify':
795
+ // Verify against constraints
796
+ if (constraints.length > 0 && results.invention) {
797
+ const output = typeof results.invention === 'string' ?
798
+ results.invention : JSON.stringify(results.invention);
799
+ stageResult = await call50cTool('cvi_verify', {
800
+ constraints,
801
+ output
802
+ });
803
+ results.verified = stageResult.passed || stageResult.all_passed || false;
804
+ results.proofs.push({ type: 'constraint_verification', data: stageResult });
805
+ } else {
806
+ stageResult = { skipped: true, reason: constraints.length === 0 ? 'No constraints specified' : 'No invention to verify' };
807
+ results.verified = constraints.length === 0; // Vacuously true if no constraints
808
+ }
809
+ break;
810
+ }
811
+
812
+ results.stages.push({
813
+ name: stage,
814
+ success: true,
815
+ duration_ms: Date.now() - stageStart,
816
+ output_summary: summarizeStageOutput(stage, stageResult)
817
+ });
818
+
819
+ } catch (e) {
820
+ results.stages.push({
821
+ name: stage,
822
+ success: false,
823
+ error: e.message,
824
+ duration_ms: Date.now() - stageStart
825
+ });
826
+ // Continue pipeline even if a stage fails (graceful degradation)
827
+ }
828
+ }
829
+
830
+ results.total_duration_ms = Date.now() - startTime;
831
+ results.pipeline_completed = results.stages.filter(s => s.success).length;
832
+ results.pipeline_total = pipeline.length;
833
+
834
+ // Final verdict
835
+ if (results.invention && results.verified) {
836
+ results.verdict = 'INVENTION_VERIFIED';
837
+ } else if (results.invention) {
838
+ results.verdict = 'INVENTION_UNVERIFIED';
839
+ } else {
840
+ results.verdict = 'EXPLORATION_ONLY';
841
+ }
842
+
843
+ return results;
844
+ }
845
+
846
+ function summarizeStageOutput(stage, result) {
847
+ if (!result) return 'No output';
848
+ if (result.skipped) return `Skipped: ${result.reason}`;
849
+
850
+ switch (stage) {
851
+ case 'mind_opener':
852
+ return result.angles ? `${result.angles.length} angles found` : 'Angles generated';
853
+ case 'idea_fold':
854
+ return result.synthesis ? 'STEM synthesis complete' : 'Folded through lenses';
855
+ case 'bcalc':
856
+ return result.discovery ? 'Mathematical discovery made' : 'Math exploration done';
857
+ case 'genius_plus':
858
+ return result.code ? `Code generated (${result.iterations || 1} iterations)` : 'Solution generated';
859
+ case 'compute':
860
+ return result.error ? `Execution error: ${result.error}` : 'Execution successful';
861
+ case 'cvi_verify':
862
+ return result.passed || result.all_passed ? 'All constraints verified' : 'Verification incomplete';
863
+ default:
864
+ return 'Complete';
865
+ }
866
+ }
867
+
675
868
  async function handleLocalTools(request) {
676
869
  const { id, method, params } = request;
677
870
 
@@ -830,6 +1023,16 @@ async function handleLocalTools(request) {
830
1023
  return mcpResult(id, { ok: false, error: e.message });
831
1024
  }
832
1025
  }
1026
+
1027
+ // AUTO-INVENT: Enterprise invention pipeline
1028
+ if (name === 'auto_invent') {
1029
+ try {
1030
+ const result = await autoInvent(args);
1031
+ return mcpResult(id, result);
1032
+ } catch (e) {
1033
+ return mcpResult(id, { ok: false, error: e.message, stage: 'auto_invent' });
1034
+ }
1035
+ }
833
1036
  }
834
1037
 
835
1038
  return null; // Not a local tool, forward to remote
@@ -995,10 +1198,6 @@ function installMCP() {
995
1198
  'playwright': {
996
1199
  command: 'npx',
997
1200
  args: ['-y', '@playwright/mcp@latest']
998
- },
999
- 'filesystem': {
1000
- command: 'npx',
1001
- args: ['-y', '@modelcontextprotocol/server-filesystem@latest', home]
1002
1201
  }
1003
1202
  };
1004
1203
 
@@ -1046,7 +1245,6 @@ function installMCP() {
1046
1245
  console.log('MCPs added:');
1047
1246
  console.log(' 50c - AI dev tools ($0.01-$0.65)');
1048
1247
  console.log(' playwright - Browser automation (free)');
1049
- console.log(' filesystem - File system access (free)');
1050
1248
  console.log('');
1051
1249
  console.log('Optional: npx 50c-vault init # Secure credentials (Windows Hello/Touch ID)');
1052
1250
  if (!API_KEY) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "50c",
3
- "version": "3.0.14",
3
+ "version": "3.1.0",
4
4
  "description": "AI developer tools via MCP. Pay-per-use from $0.01. No subscriptions.",
5
5
  "bin": {
6
6
  "50c": "./bin/50c.js"