50c 3.2.0 ā 3.5.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.
- package/bin/50c.js +246 -4
- package/lib/team.js +47 -5
- package/package.json +1 -1
package/bin/50c.js
CHANGED
|
@@ -13,6 +13,25 @@ const path = require('path');
|
|
|
13
13
|
const os = require('os');
|
|
14
14
|
const { spawn } = require('child_process');
|
|
15
15
|
|
|
16
|
+
// Early imports for CLI commands that need these
|
|
17
|
+
let call50cTool, subagent, httpFetch, sshExec, localExec, KNOWN_SERVERS;
|
|
18
|
+
let team, matchTaskToTools;
|
|
19
|
+
try {
|
|
20
|
+
const subagentModule = require('../lib/subagent.js');
|
|
21
|
+
call50cTool = subagentModule.call50cTool;
|
|
22
|
+
subagent = subagentModule.subagent;
|
|
23
|
+
httpFetch = subagentModule.httpFetch;
|
|
24
|
+
sshExec = subagentModule.sshExec;
|
|
25
|
+
localExec = subagentModule.localExec;
|
|
26
|
+
KNOWN_SERVERS = subagentModule.KNOWN_SERVERS;
|
|
27
|
+
|
|
28
|
+
const teamModule = require('../lib/team.js');
|
|
29
|
+
team = teamModule.team;
|
|
30
|
+
matchTaskToTools = teamModule.matchTaskToTools;
|
|
31
|
+
} catch (e) {
|
|
32
|
+
// Graceful fallback if libs not available (shouldn't happen in normal install)
|
|
33
|
+
}
|
|
34
|
+
|
|
16
35
|
const VERSION = require('../package.json').version;
|
|
17
36
|
const HOME = os.homedir();
|
|
18
37
|
const HUB_DIR = path.join(HOME, '.50c');
|
|
@@ -104,6 +123,7 @@ const TOOL_COMMANDS = {
|
|
|
104
123
|
'compute': { tool: 'compute', arg: 'code', cost: '$0.02' },
|
|
105
124
|
'chat': { tool: 'ide_conversation', special: 'chat' },
|
|
106
125
|
'refocus': { tool: 'llm_refocus', special: 'refocus' },
|
|
126
|
+
'invent': { tool: 'auto_invent', special: 'invent', cost: '$2.00' },
|
|
107
127
|
};
|
|
108
128
|
|
|
109
129
|
// Route command
|
|
@@ -501,6 +521,85 @@ async function runToolCommand(cmd, args) {
|
|
|
501
521
|
return;
|
|
502
522
|
}
|
|
503
523
|
|
|
524
|
+
// INVENT: Enterprise invention pipeline
|
|
525
|
+
if (spec.special === 'invent') {
|
|
526
|
+
// Parse args: 50c invent "problem" --rigor=deep --domain=math --constraint="must be fast"
|
|
527
|
+
let problem = '';
|
|
528
|
+
let rigor = 'deep';
|
|
529
|
+
let domain = 'code';
|
|
530
|
+
const constraints = [];
|
|
531
|
+
|
|
532
|
+
for (const arg of args) {
|
|
533
|
+
if (arg.startsWith('--rigor=')) {
|
|
534
|
+
rigor = arg.split('=')[1];
|
|
535
|
+
} else if (arg.startsWith('--domain=')) {
|
|
536
|
+
domain = arg.split('=')[1];
|
|
537
|
+
} else if (arg.startsWith('--constraint=')) {
|
|
538
|
+
constraints.push(arg.split('=')[1].replace(/^["']|["']$/g, ''));
|
|
539
|
+
} else if (!arg.startsWith('--')) {
|
|
540
|
+
problem += (problem ? ' ' : '') + arg;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
if (!problem) {
|
|
545
|
+
console.error('Usage: 50c invent "problem description" [options]');
|
|
546
|
+
console.error('Options:');
|
|
547
|
+
console.error(' --rigor=fast|standard|deep|exhaustive (default: deep)');
|
|
548
|
+
console.error(' --domain=math|physics|code|business (default: code)');
|
|
549
|
+
console.error(' --constraint="constraint text" (can repeat)');
|
|
550
|
+
console.error('');
|
|
551
|
+
console.error('Examples:');
|
|
552
|
+
console.error(' 50c invent "faster sorting algorithm" --rigor=deep');
|
|
553
|
+
console.error(' 50c invent "prove Riemann hypothesis" --domain=math --rigor=exhaustive');
|
|
554
|
+
console.error(' 50c invent "novel auth system" --constraint="must be passwordless"');
|
|
555
|
+
process.exit(1);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
console.log(`\nš¬ 50c Auto-Invent Pipeline`);
|
|
559
|
+
console.log(` Problem: ${problem.slice(0, 60)}${problem.length > 60 ? '...' : ''}`);
|
|
560
|
+
console.log(` Rigor: ${rigor} | Domain: ${domain}`);
|
|
561
|
+
if (constraints.length) console.log(` Constraints: ${constraints.length}`);
|
|
562
|
+
console.log(` Cost: $2.00\n`);
|
|
563
|
+
|
|
564
|
+
// Call auto_invent directly (not via remote API - it's local)
|
|
565
|
+
const inventArgs = { problem, rigor, domain, constraints };
|
|
566
|
+
const result = await autoInvent(inventArgs);
|
|
567
|
+
|
|
568
|
+
// Format output
|
|
569
|
+
if (result.ok && result.invention) {
|
|
570
|
+
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
571
|
+
console.log(' INVENTION RESULT');
|
|
572
|
+
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n');
|
|
573
|
+
|
|
574
|
+
if (result.angles && result.angles.length > 0) {
|
|
575
|
+
console.log('š CREATIVE ANGLES:');
|
|
576
|
+
result.angles.slice(0, 5).forEach((a, i) => console.log(` ${i+1}. ${a}`));
|
|
577
|
+
console.log('');
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
if (result.invention.solution) {
|
|
581
|
+
console.log('š” SOLUTION:');
|
|
582
|
+
console.log(result.invention.solution);
|
|
583
|
+
console.log('');
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
if (result.proofs && result.proofs.length > 0) {
|
|
587
|
+
console.log('ā PROOFS:', result.proofs.length, 'verification(s)');
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
if (result.prior_art && result.prior_art.length > 0) {
|
|
591
|
+
console.log('š PRIOR ART:', result.prior_art.length, 'related work(s) found');
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
console.log('\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
595
|
+
console.log(`ā± Duration: ${(result.total_duration_ms / 1000).toFixed(1)}s | Verified: ${result.verified ? 'ā' : 'ā'}`);
|
|
596
|
+
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n');
|
|
597
|
+
} else {
|
|
598
|
+
console.log('Result:', JSON.stringify(result, null, 2));
|
|
599
|
+
}
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
|
|
504
603
|
// Standard tool
|
|
505
604
|
const input = args.join(' ');
|
|
506
605
|
if (!input) {
|
|
@@ -645,8 +744,7 @@ async function handleMCPRequest(request) {
|
|
|
645
744
|
|
|
646
745
|
// Local file-memory tools (FREE, runs on user machine)
|
|
647
746
|
const { FILE_TOOLS, indexFile, findSymbol, getLines, searchFile, fileSummary } = require('../lib/file-memory.js');
|
|
648
|
-
|
|
649
|
-
const { team, matchTaskToTools } = require('../lib/team.js');
|
|
747
|
+
// Note: subagent, team already imported at top for CLI commands
|
|
650
748
|
|
|
651
749
|
const LOCAL_TOOLS = [
|
|
652
750
|
// THE MAIN TOOL - Ask the 50c team to do anything
|
|
@@ -671,8 +769,11 @@ const LOCAL_TOOLS = [
|
|
|
671
769
|
{ 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
770
|
{ 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
771
|
|
|
674
|
-
// ENTERPRISE PRESET - Auto-Invent Swarm Pipeline
|
|
675
|
-
{ name: "auto_invent", description: "
|
|
772
|
+
// ENTERPRISE PRESET - Auto-Invent Swarm Pipeline ($2.00)
|
|
773
|
+
{ name: "auto_invent", description: "ENTERPRISE ($2.00): Full invention pipeline. Chains mind_opener ā idea_fold ā bcalc ā genius_plus ā compute ā cvi_verify. Produces provable, verified solutions. Requires Enterprise tier.", 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, standard, deep, exhaustive (all $2.00)", enum: ["fast", "standard", "deep", "exhaustive"], default: "deep" } }, required: ["problem"] } },
|
|
774
|
+
|
|
775
|
+
// PROGRAMMATIC INVENTION - JSON-defined executable pipeline (ENTERPRISE $2.00)
|
|
776
|
+
{ name: "invent_program", description: "ENTERPRISE ($2.00): Execute a JSON-defined invention program in one shot. Steps: generate/compute (Python), assert (verify), call (50c tool), return. All steps compile to single compute execution. Requires Enterprise tier.", inputSchema: { type: "object", properties: { program: { type: "object", description: "JSON program with 'problem' and 'steps' array", properties: { problem: { type: "string" }, steps: { type: "array", items: { type: "object", properties: { id: { type: "string" }, action: { type: "string", enum: ["generate", "compute", "assert", "call", "return"] }, code: { type: "string" }, tool: { type: "string" }, args: { type: "object" }, depends: { type: "array", items: { type: "string" } } }, required: ["id", "action"] } } }, required: ["problem", "steps"] } }, required: ["program"] } },
|
|
676
777
|
];
|
|
677
778
|
|
|
678
779
|
/**
|
|
@@ -696,6 +797,127 @@ const LOCAL_TOOLS = [
|
|
|
696
797
|
*
|
|
697
798
|
* Cost: $2.00 flat for full invention pipeline
|
|
698
799
|
*/
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* INVENT_PROGRAM: JSON-defined Executable Invention Pipeline
|
|
803
|
+
* Enterprise-only ($2.00/request) - programmatic multi-step invention
|
|
804
|
+
*
|
|
805
|
+
* Actions:
|
|
806
|
+
* - generate: Create data/variables (Python code in compute sandbox)
|
|
807
|
+
* - compute: Calculate/transform (Python code)
|
|
808
|
+
* - assert: Verify condition (must return truthy or throws)
|
|
809
|
+
* - call: Invoke a 50c tool (genius, bcalc, hints, etc.)
|
|
810
|
+
* - return: Final output
|
|
811
|
+
*
|
|
812
|
+
* GATED: Requires Enterprise tier + $2.00 balance
|
|
813
|
+
*/
|
|
814
|
+
async function inventProgram(args) {
|
|
815
|
+
const { program } = args;
|
|
816
|
+
const startTime = Date.now();
|
|
817
|
+
|
|
818
|
+
if (!program || !program.problem || !program.steps) {
|
|
819
|
+
return { ok: false, error: 'Invalid program: must have "problem" and "steps" array' };
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
const results = {
|
|
823
|
+
ok: true,
|
|
824
|
+
problem: program.problem,
|
|
825
|
+
steps_completed: 0,
|
|
826
|
+
steps_total: program.steps.length,
|
|
827
|
+
outputs: {},
|
|
828
|
+
assertions: [],
|
|
829
|
+
tool_calls: [],
|
|
830
|
+
final_result: null,
|
|
831
|
+
cost: '$2.00',
|
|
832
|
+
tier_required: 'enterprise'
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
// Build execution context for Python code
|
|
836
|
+
let pythonContext = `
|
|
837
|
+
import json, math, re, itertools, functools, collections
|
|
838
|
+
from decimal import Decimal, getcontext
|
|
839
|
+
getcontext().prec = 100
|
|
840
|
+
|
|
841
|
+
# Shared context between steps
|
|
842
|
+
_ctx = {}
|
|
843
|
+
_results = {}
|
|
844
|
+
|
|
845
|
+
`;
|
|
846
|
+
|
|
847
|
+
// Execute steps sequentially
|
|
848
|
+
for (const step of program.steps) {
|
|
849
|
+
const stepStart = Date.now();
|
|
850
|
+
|
|
851
|
+
try {
|
|
852
|
+
if (step.action === 'generate' || step.action === 'compute') {
|
|
853
|
+
// Execute Python code in compute sandbox
|
|
854
|
+
pythonContext += `\n# Step: ${step.id}\n${step.code}\n_results['${step.id}'] = locals().get('result', None)\n`;
|
|
855
|
+
|
|
856
|
+
} else if (step.action === 'assert') {
|
|
857
|
+
// Add assertion check
|
|
858
|
+
pythonContext += `\n# Assert: ${step.id}\n_assert_${step.id} = ${step.code}\nif not _assert_${step.id}: raise AssertionError('${step.id} failed')\n_results['${step.id}'] = True\n`;
|
|
859
|
+
results.assertions.push({ id: step.id, code: step.code });
|
|
860
|
+
|
|
861
|
+
} else if (step.action === 'call') {
|
|
862
|
+
// Call a 50c tool
|
|
863
|
+
const toolResult = await call50cTool(step.tool, step.args || {});
|
|
864
|
+
results.tool_calls.push({ id: step.id, tool: step.tool, result: toolResult });
|
|
865
|
+
results.outputs[step.id] = toolResult;
|
|
866
|
+
// Inject result into Python context
|
|
867
|
+
pythonContext += `\n# Tool result: ${step.id}\n_results['${step.id}'] = ${JSON.stringify(toolResult)}\n`;
|
|
868
|
+
|
|
869
|
+
} else if (step.action === 'return') {
|
|
870
|
+
// Final return - will be evaluated after all code runs
|
|
871
|
+
pythonContext += `\n# Final output\n_final = ${step.code}\nprint('__FINAL__:' + json.dumps(_final))\n`;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
results.steps_completed++;
|
|
875
|
+
|
|
876
|
+
} catch (err) {
|
|
877
|
+
results.ok = false;
|
|
878
|
+
results.error = `Step ${step.id} failed: ${err.message}`;
|
|
879
|
+
break;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
// Execute all Python code in one compute call
|
|
884
|
+
if (results.ok) {
|
|
885
|
+
pythonContext += `\n# Output all results\nprint('__RESULTS__:' + json.dumps(_results))\n`;
|
|
886
|
+
|
|
887
|
+
try {
|
|
888
|
+
const computeResult = await call50cTool('compute', { code: pythonContext });
|
|
889
|
+
|
|
890
|
+
// Parse outputs
|
|
891
|
+
if (computeResult && typeof computeResult === 'string') {
|
|
892
|
+
const finalMatch = computeResult.match(/__FINAL__:(.+)/);
|
|
893
|
+
if (finalMatch) {
|
|
894
|
+
try {
|
|
895
|
+
results.final_result = JSON.parse(finalMatch[1]);
|
|
896
|
+
} catch (e) {
|
|
897
|
+
results.final_result = finalMatch[1];
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
const resultsMatch = computeResult.match(/__RESULTS__:(.+)/);
|
|
902
|
+
if (resultsMatch) {
|
|
903
|
+
try {
|
|
904
|
+
results.outputs = { ...results.outputs, ...JSON.parse(resultsMatch[1]) };
|
|
905
|
+
} catch (e) {}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
results.compute_output = computeResult;
|
|
910
|
+
|
|
911
|
+
} catch (err) {
|
|
912
|
+
results.ok = false;
|
|
913
|
+
results.error = `Compute execution failed: ${err.message}`;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
results.duration_ms = Date.now() - startTime;
|
|
918
|
+
return results;
|
|
919
|
+
}
|
|
920
|
+
|
|
699
921
|
async function autoInvent(args) {
|
|
700
922
|
const { problem, constraints = [], domain = 'code', rigor = 'deep' } = args;
|
|
701
923
|
const startTime = Date.now();
|
|
@@ -1187,6 +1409,16 @@ async function handleLocalTools(request) {
|
|
|
1187
1409
|
return mcpResult(id, { ok: false, error: e.message, stage: 'auto_invent' });
|
|
1188
1410
|
}
|
|
1189
1411
|
}
|
|
1412
|
+
|
|
1413
|
+
// ENTERPRISE: Programmatic invention pipeline ($2.00, gated)
|
|
1414
|
+
if (name === 'invent_program') {
|
|
1415
|
+
try {
|
|
1416
|
+
const result = await inventProgram(args);
|
|
1417
|
+
return mcpResult(id, result);
|
|
1418
|
+
} catch (e) {
|
|
1419
|
+
return mcpResult(id, { ok: false, error: e.message, stage: 'invent_program' });
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1190
1422
|
}
|
|
1191
1423
|
|
|
1192
1424
|
return null; // Not a local tool, forward to remote
|
|
@@ -1451,6 +1683,12 @@ TOOLS (labs pack):
|
|
|
1451
1683
|
genius <problem> Deep problem solving ($0.50)
|
|
1452
1684
|
compute <code> Python sandbox ($0.02)
|
|
1453
1685
|
|
|
1686
|
+
ENTERPRISE (auto_invent):
|
|
1687
|
+
invent "problem" [options] Full invention pipeline ($2.00)
|
|
1688
|
+
--rigor=fast|standard|deep|exhaustive (default: deep)
|
|
1689
|
+
--domain=math|physics|code|business (default: code)
|
|
1690
|
+
--constraint="text" Add constraint (repeatable)
|
|
1691
|
+
|
|
1454
1692
|
TOOLS (beacon pack):
|
|
1455
1693
|
50c beacon.health Context health check (FREE)
|
|
1456
1694
|
50c beacon.compress <text> Smart compression ($0.02)
|
|
@@ -1470,6 +1708,7 @@ SNAPSHOTS:
|
|
|
1470
1708
|
EXAMPLES:
|
|
1471
1709
|
50c hints "api design"
|
|
1472
1710
|
50c genius "optimize this algorithm"
|
|
1711
|
+
50c invent "novel sorting algorithm" --rigor=deep --domain=code
|
|
1473
1712
|
50c beacon.compress "long context here..."
|
|
1474
1713
|
50c tip 10 "saved my deploy"
|
|
1475
1714
|
50c notip compress wrong_answer "output was garbage"
|
|
@@ -1481,3 +1720,6 @@ MCP MODE:
|
|
|
1481
1720
|
|
|
1482
1721
|
process.on('SIGINT', () => process.exit(130));
|
|
1483
1722
|
process.on('SIGTERM', () => process.exit(143));
|
|
1723
|
+
|
|
1724
|
+
// Export enterprise functions for team.js integration
|
|
1725
|
+
module.exports = { autoInvent, inventProgram };
|
package/lib/team.js
CHANGED
|
@@ -46,6 +46,8 @@ const ENTERPRISE_GATED_TOOLS = [
|
|
|
46
46
|
'team_exec', // Execute commands (requires vault: exec_allowed_hosts)
|
|
47
47
|
'team_http', // HTTP requests to user's servers (requires vault: api_endpoints)
|
|
48
48
|
'team_deploy', // Deploy to user's infra (requires vault: deploy_targets)
|
|
49
|
+
'auto_invent', // Enterprise invention pipeline ($2.00)
|
|
50
|
+
'invent_program' // JSON-defined invention ($2.00)
|
|
49
51
|
];
|
|
50
52
|
|
|
51
53
|
// Required vault keys for each enterprise tool
|
|
@@ -54,6 +56,8 @@ const ENTERPRISE_VAULT_REQUIREMENTS = {
|
|
|
54
56
|
'team_exec': ['exec_allowed_hosts'],
|
|
55
57
|
'team_http': ['http_endpoints'],
|
|
56
58
|
'team_deploy': ['deploy_targets'],
|
|
59
|
+
'auto_invent': [], // No vault needed, just enterprise tier + $2.00
|
|
60
|
+
'invent_program': [] // No vault needed, just enterprise tier + $2.00
|
|
57
61
|
};
|
|
58
62
|
|
|
59
63
|
/**
|
|
@@ -85,22 +89,29 @@ async function checkEnterpriseAccess(tool, apiKey) {
|
|
|
85
89
|
const { call50cTool } = require('./subagent.js');
|
|
86
90
|
|
|
87
91
|
// Strict API key validation (security: prevent prefix collisions)
|
|
88
|
-
// Enterprise keys: cv_ent_XXXXXXXX (8+ hex chars) OR cv_enterprise_*
|
|
92
|
+
// Enterprise keys: cv_ent_XXXXXXXX (8+ hex chars) OR cv_enterprise_* OR any cv_ key with $2+ balance
|
|
89
93
|
const isValidEntKey = apiKey && (
|
|
90
94
|
/^cv_ent_[a-f0-9]{8,}$/i.test(apiKey) ||
|
|
91
|
-
/^cv_enterprise_/i.test(apiKey)
|
|
95
|
+
/^cv_enterprise_/i.test(apiKey) ||
|
|
96
|
+
/^cv_[a-f0-9]{40,}$/i.test(apiKey) // Production keys with sufficient balance
|
|
92
97
|
);
|
|
93
98
|
|
|
94
99
|
if (!isValidEntKey) {
|
|
95
100
|
return {
|
|
96
101
|
allowed: false,
|
|
97
|
-
reason: `${tool} requires Enterprise tier. Upgrade at https://50c.ai/enterprise`,
|
|
102
|
+
reason: `${tool} requires Enterprise tier ($2.00). Upgrade at https://50c.ai/enterprise`,
|
|
98
103
|
code: 'ENTERPRISE_REQUIRED'
|
|
99
104
|
};
|
|
100
105
|
}
|
|
101
106
|
|
|
102
|
-
// 4. Check vault status
|
|
107
|
+
// 4. Check vault status ONLY for tools that require vault keys
|
|
103
108
|
const requiredKeys = ENTERPRISE_VAULT_REQUIREMENTS[tool];
|
|
109
|
+
|
|
110
|
+
// If no vault keys required (auto_invent, invent_program), skip vault check
|
|
111
|
+
if (!requiredKeys || requiredKeys.length === 0) {
|
|
112
|
+
return { allowed: true, reason: `Enterprise tool ${tool} allowed (no vault required)` };
|
|
113
|
+
}
|
|
114
|
+
|
|
104
115
|
const vaultStatus = await call50cTool('vault_status', {});
|
|
105
116
|
|
|
106
117
|
if (!vaultStatus || !vaultStatus.initialized) {
|
|
@@ -266,6 +277,10 @@ function filterAirgappedTools(tools, task) {
|
|
|
266
277
|
|
|
267
278
|
// Tool capabilities for matching
|
|
268
279
|
const TOOL_CAPABILITIES = {
|
|
280
|
+
// ENTERPRISE INVENTION ($2.00)
|
|
281
|
+
auto_invent: { keywords: ['invent', 'discover', 'prove', 'novel', 'patent', 'breakthrough', 'scientific', 'rigorous', 'verified solution', 'invention'], desc: 'Enterprise invention pipeline ($2.00)' },
|
|
282
|
+
invent_program: { keywords: ['programmatic invention', 'json program', 'executable pipeline', 'step by step invention'], desc: 'JSON-defined invention ($2.00)' },
|
|
283
|
+
|
|
269
284
|
// Research & Analysis
|
|
270
285
|
web_search: { keywords: ['search', 'find', 'look up', 'research', 'google', 'internet'], desc: 'Search the web' },
|
|
271
286
|
page_fetch: { keywords: ['fetch', 'scrape', 'get page', 'read url', 'website content'], desc: 'Fetch webpage content' },
|
|
@@ -350,6 +365,17 @@ const TASK_PATTERNS = [
|
|
|
350
365
|
tools: ['team_http'],
|
|
351
366
|
desc: 'HTTP request (Enterprise + Vault required)'
|
|
352
367
|
},
|
|
368
|
+
// ENTERPRISE INVENTION PATTERNS ($2.00)
|
|
369
|
+
{
|
|
370
|
+
match: /\binvent\b|\bdiscover\b|\bprove\b|\bsolve.*rigor|\bnovel.*solution|\bpatent|\bbreakthrough|\bscientific.*method/i,
|
|
371
|
+
tools: ['auto_invent'],
|
|
372
|
+
desc: 'Enterprise invention pipeline ($2.00) - full swarm with verification'
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
match: /\bauto.?invent|\bfull.*pipeline|\bswarm.*invention|\bverified.*solution/i,
|
|
376
|
+
tools: ['auto_invent'],
|
|
377
|
+
desc: 'Enterprise auto-invent ($2.00)'
|
|
378
|
+
},
|
|
353
379
|
// Standard patterns
|
|
354
380
|
{
|
|
355
381
|
match: /roast.*fix|review.*suggest|critique.*improve/i,
|
|
@@ -594,7 +620,23 @@ async function teamExecute(task, context, options = {}) {
|
|
|
594
620
|
const stepStart = Date.now();
|
|
595
621
|
const args = buildArgs(tool, task, prevResult);
|
|
596
622
|
|
|
597
|
-
|
|
623
|
+
// SPECIAL: Local enterprise tools (auto_invent, invent_program) run in-process
|
|
624
|
+
let toolResult;
|
|
625
|
+
if (tool === 'auto_invent' || tool === 'invent_program') {
|
|
626
|
+
// These are local enterprise tools - import from 50c.js
|
|
627
|
+
try {
|
|
628
|
+
const { autoInvent, inventProgram } = require('../bin/50c.js');
|
|
629
|
+
if (tool === 'auto_invent') {
|
|
630
|
+
toolResult = { ok: true, result: await autoInvent(args) };
|
|
631
|
+
} else {
|
|
632
|
+
toolResult = { ok: true, result: await inventProgram(args) };
|
|
633
|
+
}
|
|
634
|
+
} catch (e) {
|
|
635
|
+
toolResult = { ok: false, error: `Local tool ${tool} failed: ${e.message}` };
|
|
636
|
+
}
|
|
637
|
+
} else {
|
|
638
|
+
toolResult = await call50cTool(tool, args);
|
|
639
|
+
}
|
|
598
640
|
|
|
599
641
|
// Track usage
|
|
600
642
|
if (isFree) freeUsed++;
|