50c 3.0.14 → 3.1.1
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.
- package/bin/50c.js +195 -5
- package/package.json +1 -1
package/bin/50c.js
CHANGED
|
@@ -670,8 +670,193 @@ 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. $0.65-$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: fast ($0.65, genius_plus only), standard ($0.60, 3 tools), deep ($1.20, 5 tools parallel), exhaustive ($2.00, all 6)", enum: ["fast", "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
|
+
fast: ['genius_plus'], // Just genius_plus for quick results
|
|
699
|
+
standard: ['mind_opener', 'genius_plus', 'cvi_verify'],
|
|
700
|
+
deep: ['mind_opener', 'idea_fold', 'bcalc', 'genius_plus', 'cvi_verify'],
|
|
701
|
+
exhaustive: ['mind_opener', 'idea_fold', 'bcalc', 'genius_plus', 'compute', 'cvi_verify']
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
const pipeline = PIPELINES[rigor] || PIPELINES.deep;
|
|
705
|
+
const results = {
|
|
706
|
+
ok: true,
|
|
707
|
+
problem,
|
|
708
|
+
domain,
|
|
709
|
+
rigor,
|
|
710
|
+
constraints,
|
|
711
|
+
stages: [],
|
|
712
|
+
invention: null,
|
|
713
|
+
verified: false,
|
|
714
|
+
proofs: [],
|
|
715
|
+
cost_estimate: rigor === 'exhaustive' ? '$2.00' : rigor === 'deep' ? '$1.20' : rigor === 'standard' ? '$0.60' : '$0.65'
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
let context = problem;
|
|
719
|
+
let bestAngle = null;
|
|
720
|
+
let mathProof = null;
|
|
721
|
+
let generatedCode = null;
|
|
722
|
+
|
|
723
|
+
// For deep/exhaustive, run first 3 stages in parallel to save time
|
|
724
|
+
if (rigor === 'deep' || rigor === 'exhaustive') {
|
|
725
|
+
const parallelStart = Date.now();
|
|
726
|
+
try {
|
|
727
|
+
const [mindResult, ideaResult, bcalcResult] = await Promise.all([
|
|
728
|
+
call50cTool('mind_opener', { problem }).catch(e => ({ error: e.message })),
|
|
729
|
+
call50cTool('idea_fold', { claim: problem, context: `Domain: ${domain}` }).catch(e => ({ error: e.message })),
|
|
730
|
+
call50cTool('bcalc', { expression: domain === 'math' ? problem : `Model for: ${problem}`, mode: 'explore' }).catch(e => ({ error: e.message }))
|
|
731
|
+
]);
|
|
732
|
+
|
|
733
|
+
// Process mind_opener
|
|
734
|
+
if (mindResult.angles && mindResult.angles.length > 0) {
|
|
735
|
+
bestAngle = mindResult.angles[0];
|
|
736
|
+
context = `${problem}\n\nApproach: ${bestAngle}`;
|
|
737
|
+
}
|
|
738
|
+
results.stages.push({ name: 'mind_opener', success: !mindResult.error, duration_ms: Date.now() - parallelStart, output_summary: mindResult.angles ? `${mindResult.angles.length} angles` : (mindResult.error || 'Done') });
|
|
739
|
+
|
|
740
|
+
// Process idea_fold
|
|
741
|
+
if (ideaResult.synthesis) {
|
|
742
|
+
context = `${context}\n\nSTEM: ${ideaResult.synthesis}`;
|
|
743
|
+
}
|
|
744
|
+
results.stages.push({ name: 'idea_fold', success: !ideaResult.error, duration_ms: Date.now() - parallelStart, output_summary: ideaResult.synthesis ? 'STEM synthesis' : (ideaResult.error || 'Done') });
|
|
745
|
+
|
|
746
|
+
// Process bcalc
|
|
747
|
+
if (bcalcResult.discovery || bcalcResult.result) {
|
|
748
|
+
mathProof = bcalcResult;
|
|
749
|
+
results.proofs.push({ type: 'mathematical', data: bcalcResult });
|
|
750
|
+
context = `${context}\n\nMath: ${JSON.stringify(bcalcResult.discovery || bcalcResult.result).slice(0, 200)}`;
|
|
751
|
+
}
|
|
752
|
+
results.stages.push({ name: 'bcalc', success: !bcalcResult.error, duration_ms: Date.now() - parallelStart, output_summary: bcalcResult.discovery ? 'Discovery made' : (bcalcResult.error || 'Done') });
|
|
753
|
+
|
|
754
|
+
} catch (e) {
|
|
755
|
+
results.stages.push({ name: 'parallel_init', success: false, error: e.message });
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// Now run remaining stages sequentially
|
|
759
|
+
const remainingStages = pipeline.filter(s => !['mind_opener', 'idea_fold', 'bcalc'].includes(s));
|
|
760
|
+
for (const stage of remainingStages) {
|
|
761
|
+
const stageStart = Date.now();
|
|
762
|
+
try {
|
|
763
|
+
const stageResult = await runStage(stage, { context, problem, domain, constraints, bestAngle, generatedCode, results });
|
|
764
|
+
if (stageResult.generatedCode) generatedCode = stageResult.generatedCode;
|
|
765
|
+
if (stageResult.invention) results.invention = stageResult.invention;
|
|
766
|
+
if (stageResult.verified !== undefined) results.verified = stageResult.verified;
|
|
767
|
+
if (stageResult.proof) results.proofs.push(stageResult.proof);
|
|
768
|
+
results.stages.push({ name: stage, success: true, duration_ms: Date.now() - stageStart, output_summary: stageResult.summary });
|
|
769
|
+
} catch (e) {
|
|
770
|
+
results.stages.push({ name: stage, success: false, error: e.message, duration_ms: Date.now() - stageStart });
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
} else {
|
|
774
|
+
// For fast/standard, run sequentially
|
|
775
|
+
for (const stage of pipeline) {
|
|
776
|
+
const stageStart = Date.now();
|
|
777
|
+
try {
|
|
778
|
+
const stageResult = await runStage(stage, { context, problem, domain, constraints, bestAngle, generatedCode, results });
|
|
779
|
+
if (stageResult.context) context = stageResult.context;
|
|
780
|
+
if (stageResult.bestAngle) bestAngle = stageResult.bestAngle;
|
|
781
|
+
if (stageResult.generatedCode) generatedCode = stageResult.generatedCode;
|
|
782
|
+
if (stageResult.invention) results.invention = stageResult.invention;
|
|
783
|
+
if (stageResult.verified !== undefined) results.verified = stageResult.verified;
|
|
784
|
+
if (stageResult.proof) results.proofs.push(stageResult.proof);
|
|
785
|
+
results.stages.push({ name: stage, success: true, duration_ms: Date.now() - stageStart, output_summary: stageResult.summary });
|
|
786
|
+
} catch (e) {
|
|
787
|
+
results.stages.push({ name: stage, success: false, error: e.message, duration_ms: Date.now() - stageStart });
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
results.total_duration_ms = Date.now() - startTime;
|
|
793
|
+
results.pipeline_completed = results.stages.filter(s => s.success).length;
|
|
794
|
+
results.pipeline_total = pipeline.length;
|
|
795
|
+
|
|
796
|
+
if (results.invention && results.verified) {
|
|
797
|
+
results.verdict = 'INVENTION_VERIFIED';
|
|
798
|
+
} else if (results.invention) {
|
|
799
|
+
results.verdict = 'INVENTION_UNVERIFIED';
|
|
800
|
+
} else {
|
|
801
|
+
results.verdict = 'EXPLORATION_ONLY';
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
return results;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
async function runStage(stage, ctx) {
|
|
808
|
+
const { context, problem, domain, constraints, bestAngle, generatedCode, results } = ctx;
|
|
809
|
+
|
|
810
|
+
switch (stage) {
|
|
811
|
+
case 'mind_opener': {
|
|
812
|
+
const r = await call50cTool('mind_opener', { problem: context });
|
|
813
|
+
return {
|
|
814
|
+
bestAngle: r.angles?.[0],
|
|
815
|
+
context: r.angles?.[0] ? `${problem}\n\nApproach: ${r.angles[0]}` : context,
|
|
816
|
+
summary: r.angles ? `${r.angles.length} angles` : 'Done'
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
case 'idea_fold': {
|
|
820
|
+
const r = await call50cTool('idea_fold', { claim: bestAngle || problem, context: `Domain: ${domain}` });
|
|
821
|
+
return { context: r.synthesis ? `${context}\n\nSTEM: ${r.synthesis}` : context, summary: r.synthesis ? 'STEM synthesis' : 'Done' };
|
|
822
|
+
}
|
|
823
|
+
case 'bcalc': {
|
|
824
|
+
const r = await call50cTool('bcalc', { expression: domain === 'math' ? problem : `Model: ${bestAngle || problem}`, mode: 'explore' });
|
|
825
|
+
return { proof: r.discovery ? { type: 'mathematical', data: r } : null, summary: r.discovery ? 'Discovery' : 'Done' };
|
|
826
|
+
}
|
|
827
|
+
case 'genius_plus': {
|
|
828
|
+
const prompt = `${context}\n\nConstraints: ${constraints.join(', ')}`;
|
|
829
|
+
const r = await call50cTool('genius_plus', { problem: prompt });
|
|
830
|
+
const code = r.code || r.solution;
|
|
831
|
+
return {
|
|
832
|
+
generatedCode: code,
|
|
833
|
+
invention: code ? { code, explanation: r.explanation || r.reasoning, iterations: r.iterations || 1 } : null,
|
|
834
|
+
summary: code ? `Code (${r.iterations || 1} iter)` : 'Solution generated'
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
case 'compute': {
|
|
838
|
+
if (!generatedCode) return { summary: 'Skipped: no code' };
|
|
839
|
+
const r = await call50cTool('compute', { code: generatedCode });
|
|
840
|
+
return {
|
|
841
|
+
proof: { type: 'execution', data: r },
|
|
842
|
+
summary: r.error ? `Error: ${r.error}` : 'Executed'
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
case 'cvi_verify': {
|
|
846
|
+
if (constraints.length === 0) return { verified: true, summary: 'No constraints' };
|
|
847
|
+
if (!results.invention) return { verified: false, summary: 'No invention' };
|
|
848
|
+
const r = await call50cTool('cvi_verify', { constraints, output: JSON.stringify(results.invention) });
|
|
849
|
+
return {
|
|
850
|
+
verified: r.passed || r.all_passed || false,
|
|
851
|
+
proof: { type: 'constraint_verification', data: r },
|
|
852
|
+
summary: r.passed ? 'Verified' : 'Unverified'
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
default:
|
|
856
|
+
return { summary: 'Unknown stage' };
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
|
|
675
860
|
async function handleLocalTools(request) {
|
|
676
861
|
const { id, method, params } = request;
|
|
677
862
|
|
|
@@ -830,6 +1015,16 @@ async function handleLocalTools(request) {
|
|
|
830
1015
|
return mcpResult(id, { ok: false, error: e.message });
|
|
831
1016
|
}
|
|
832
1017
|
}
|
|
1018
|
+
|
|
1019
|
+
// AUTO-INVENT: Enterprise invention pipeline
|
|
1020
|
+
if (name === 'auto_invent') {
|
|
1021
|
+
try {
|
|
1022
|
+
const result = await autoInvent(args);
|
|
1023
|
+
return mcpResult(id, result);
|
|
1024
|
+
} catch (e) {
|
|
1025
|
+
return mcpResult(id, { ok: false, error: e.message, stage: 'auto_invent' });
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
833
1028
|
}
|
|
834
1029
|
|
|
835
1030
|
return null; // Not a local tool, forward to remote
|
|
@@ -995,10 +1190,6 @@ function installMCP() {
|
|
|
995
1190
|
'playwright': {
|
|
996
1191
|
command: 'npx',
|
|
997
1192
|
args: ['-y', '@playwright/mcp@latest']
|
|
998
|
-
},
|
|
999
|
-
'filesystem': {
|
|
1000
|
-
command: 'npx',
|
|
1001
|
-
args: ['-y', '@modelcontextprotocol/server-filesystem@latest', home]
|
|
1002
1193
|
}
|
|
1003
1194
|
};
|
|
1004
1195
|
|
|
@@ -1046,7 +1237,6 @@ function installMCP() {
|
|
|
1046
1237
|
console.log('MCPs added:');
|
|
1047
1238
|
console.log(' 50c - AI dev tools ($0.01-$0.65)');
|
|
1048
1239
|
console.log(' playwright - Browser automation (free)');
|
|
1049
|
-
console.log(' filesystem - File system access (free)');
|
|
1050
1240
|
console.log('');
|
|
1051
1241
|
console.log('Optional: npx 50c-vault init # Secure credentials (Windows Hello/Touch ID)');
|
|
1052
1242
|
if (!API_KEY) {
|