50c 3.9.2 → 3.9.9

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 (3) hide show
  1. package/bin/50c.js +1 -134
  2. package/lib/subagent.js +11 -8
  3. package/package.json +39 -39
package/bin/50c.js CHANGED
@@ -1023,9 +1023,6 @@ const LOCAL_TOOLS = [
1023
1023
  // ENTERPRISE PRESET - Auto-Invent Swarm Pipeline ($2.00)
1024
1024
  { 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"] } },
1025
1025
 
1026
- // PROGRAMMATIC INVENTION - JSON-defined executable pipeline (ENTERPRISE $2.00)
1027
- { 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"] } },
1028
-
1029
1026
  // ADOPTION EQUATION TOOLS - P(adopt) = (1-e^(-λR)) × N × W
1030
1027
  { name: "adoption_calc", description: "Adoption probability calculator. P=(1-e^(-λR))×Network×Window. Returns probability, diagnosis, bottleneck, and threshold. FREE.", inputSchema: { type: "object", properties: { lambda: { type: "number", description: "Reward sensitivity (default 1.0)" }, reward: { type: "number", description: "Reward magnitude (0+)" }, network: { type: "number", description: "Network effect 0-1" }, window: { type: "number", description: "Upheaval window 0-1" }, churn: { type: "number", description: "Churn rate 0-1 (default 0)" } }, required: ["reward", "network", "window"] } },
1031
1028
  { name: "adoption_diagnose", description: "Diagnose WHY adoption is failing. Finds which term (reward/network/window) is the bottleneck. Prescribes fix. FREE.", inputSchema: { type: "object", properties: { reward: { type: "number", description: "Reward magnitude" }, network: { type: "number", description: "Network effect 0-1" }, window: { type: "number", description: "Upheaval window 0-1" }, lambda: { type: "number", description: "Reward sensitivity (default 1.0)" }, context: { type: "string", description: "Optional: product/market context for richer diagnosis" } }, required: ["reward", "network", "window"] } },
@@ -1054,126 +1051,6 @@ const LOCAL_TOOLS = [
1054
1051
  * Cost: $2.00 flat for full invention pipeline
1055
1052
  */
1056
1053
 
1057
- /**
1058
- * INVENT_PROGRAM: JSON-defined Executable Invention Pipeline
1059
- * Enterprise-only ($2.00/request) - programmatic multi-step invention
1060
- *
1061
- * Actions:
1062
- * - generate: Create data/variables (Python code in compute sandbox)
1063
- * - compute: Calculate/transform (Python code)
1064
- * - assert: Verify condition (must return truthy or throws)
1065
- * - call: Invoke a 50c tool (genius, bcalc, hints, etc.)
1066
- * - return: Final output
1067
- *
1068
- * GATED: Requires Enterprise tier + $2.00 balance
1069
- */
1070
- async function inventProgram(args) {
1071
- const { program } = args;
1072
- const startTime = Date.now();
1073
-
1074
- if (!program || !program.problem || !program.steps) {
1075
- return { ok: false, error: 'Invalid program: must have "problem" and "steps" array' };
1076
- }
1077
-
1078
- const results = {
1079
- ok: true,
1080
- problem: program.problem,
1081
- steps_completed: 0,
1082
- steps_total: program.steps.length,
1083
- outputs: {},
1084
- assertions: [],
1085
- tool_calls: [],
1086
- final_result: null,
1087
- cost: '$2.00',
1088
- tier_required: 'enterprise'
1089
- };
1090
-
1091
- // Build execution context for Python code
1092
- let pythonContext = `
1093
- import json, math, re, itertools, functools, collections
1094
- from decimal import Decimal, getcontext
1095
- getcontext().prec = 100
1096
-
1097
- # Shared context between steps
1098
- _ctx = {}
1099
- _results = {}
1100
-
1101
- `;
1102
-
1103
- // Execute steps sequentially
1104
- for (const step of program.steps) {
1105
- const stepStart = Date.now();
1106
-
1107
- try {
1108
- if (step.action === 'generate' || step.action === 'compute') {
1109
- // Execute Python code in compute sandbox
1110
- pythonContext += `\n# Step: ${step.id}\n${step.code}\n_results['${step.id}'] = locals().get('result', None)\n`;
1111
-
1112
- } else if (step.action === 'assert') {
1113
- // Add assertion check
1114
- 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`;
1115
- results.assertions.push({ id: step.id, code: step.code });
1116
-
1117
- } else if (step.action === 'call') {
1118
- // Call a 50c tool
1119
- const toolResult = await call50cTool(step.tool, step.args || {});
1120
- results.tool_calls.push({ id: step.id, tool: step.tool, result: toolResult });
1121
- results.outputs[step.id] = toolResult;
1122
- // Inject result into Python context
1123
- pythonContext += `\n# Tool result: ${step.id}\n_results['${step.id}'] = ${JSON.stringify(toolResult)}\n`;
1124
-
1125
- } else if (step.action === 'return') {
1126
- // Final return - will be evaluated after all code runs
1127
- pythonContext += `\n# Final output\n_final = ${step.code}\nprint('__FINAL__:' + json.dumps(_final))\n`;
1128
- }
1129
-
1130
- results.steps_completed++;
1131
-
1132
- } catch (err) {
1133
- results.ok = false;
1134
- results.error = `Step ${step.id} failed: ${err.message}`;
1135
- break;
1136
- }
1137
- }
1138
-
1139
- // Execute all Python code in one compute call
1140
- if (results.ok) {
1141
- pythonContext += `\n# Output all results\nprint('__RESULTS__:' + json.dumps(_results))\n`;
1142
-
1143
- try {
1144
- const computeResult = await call50cTool('compute', { code: pythonContext });
1145
-
1146
- // Parse outputs
1147
- if (computeResult && typeof computeResult === 'string') {
1148
- const finalMatch = computeResult.match(/__FINAL__:(.+)/);
1149
- if (finalMatch) {
1150
- try {
1151
- results.final_result = JSON.parse(finalMatch[1]);
1152
- } catch (e) {
1153
- results.final_result = finalMatch[1];
1154
- }
1155
- }
1156
-
1157
- const resultsMatch = computeResult.match(/__RESULTS__:(.+)/);
1158
- if (resultsMatch) {
1159
- try {
1160
- results.outputs = { ...results.outputs, ...JSON.parse(resultsMatch[1]) };
1161
- } catch (e) {}
1162
- }
1163
- }
1164
-
1165
- results.compute_output = computeResult;
1166
-
1167
- } catch (err) {
1168
- results.ok = false;
1169
- results.error = `Compute execution failed: ${err.message}`;
1170
- }
1171
- }
1172
-
1173
- results.duration_ms = Date.now() - startTime;
1174
- return results;
1175
- }
1176
-
1177
1054
  async function autoInvent(args) {
1178
1055
  const { problem, constraints = [], domain = 'code', rigor = 'deep' } = args;
1179
1056
  const startTime = Date.now();
@@ -1847,16 +1724,6 @@ async function handleLocalTools(request) {
1847
1724
  }
1848
1725
  }
1849
1726
 
1850
- // ENTERPRISE: Programmatic invention pipeline ($2.00, gated)
1851
- if (name === 'invent_program') {
1852
- try {
1853
- const result = await inventProgram(args);
1854
- return mcpResult(id, result);
1855
- } catch (e) {
1856
- return mcpResult(id, { ok: false, error: e.message, stage: 'invent_program' });
1857
- }
1858
- }
1859
-
1860
1727
  // ADOPTION EQUATION TOOLS - P(adopt) = (1-e^(-λR)) × N × W (FREE, local compute)
1861
1728
  if (name === 'adoption_calc') {
1862
1729
  const result = adoptionCalc(args);
@@ -2209,4 +2076,4 @@ process.on('SIGINT', () => process.exit(130));
2209
2076
  process.on('SIGTERM', () => process.exit(143));
2210
2077
 
2211
2078
  // Export enterprise functions for team.js integration
2212
- module.exports = { autoInvent, inventProgram };
2079
+ module.exports = { autoInvent };
package/lib/subagent.js CHANGED
@@ -16,18 +16,21 @@ const http = require('http');
16
16
  const fs = require('fs');
17
17
  const path = require('path');
18
18
 
19
- // User-configured servers loaded from ~/.50c/servers.json
20
- // Run: 50c servers add <alias> <host> <user> to configure
21
- function loadUserServers() {
19
+ // Known servers - loaded from ~/.50c/servers.json (not hardcoded for security)
20
+ const os = require('os');
21
+ const SERVERS_FILE = path.join(os.homedir(), '.50c', 'servers.json');
22
+
23
+ function loadKnownServers() {
22
24
  try {
23
- const serversPath = path.join(require('os').homedir(), '.50c', 'servers.json');
24
- if (fs.existsSync(serversPath)) {
25
- return JSON.parse(fs.readFileSync(serversPath, 'utf8'));
25
+ if (fs.existsSync(SERVERS_FILE)) {
26
+ return JSON.parse(fs.readFileSync(SERVERS_FILE, 'utf8'));
26
27
  }
27
28
  } catch (e) {}
29
+ // Empty by default - users must configure their own servers
28
30
  return {};
29
31
  }
30
- const KNOWN_SERVERS = loadUserServers();
32
+
33
+ const KNOWN_SERVERS = loadKnownServers();
31
34
 
32
35
  /**
33
36
  * HTTP/HTTPS fetch - no shell, pure Node
@@ -49,7 +52,7 @@ async function httpFetch(url, options = {}) {
49
52
  ...(bodyData ? { 'Content-Length': Buffer.byteLength(bodyData) } : {})
50
53
  },
51
54
  timeout: options.timeout || 30000,
52
- // TLS certificate validation enabled for security
55
+ rejectUnauthorized: false // Allow self-signed certs
53
56
  };
54
57
 
55
58
  const req = lib.request(reqOptions, (res) => {
package/package.json CHANGED
@@ -1,39 +1,39 @@
1
- {
2
- "name": "50c",
3
- "version": "3.9.2",
4
- "description": "AI developer tools via MCP. Pay-per-use from $0.01. No subscriptions.",
5
- "bin": {
6
- "50c": "./bin/50c.js"
7
- },
8
- "scripts": {
9
- "postinstall": "node -e \"console.log('\\n50c Hub installed. Run: 50c install\\n')\""
10
- },
11
- "keywords": [
12
- "mcp",
13
- "ai",
14
- "llm",
15
- "cli",
16
- "agent",
17
- "50c",
18
- "hints",
19
- "genius",
20
- "beacon",
21
- "developer-tools",
22
- "context",
23
- "compression",
24
- "caz",
25
- "file-memory"
26
- ],
27
- "author": "genxis",
28
- "license": "SEE LICENSE IN LICENSE",
29
- "homepage": "https://50c.ai",
30
- "engines": {
31
- "node": ">=18.0.0"
32
- },
33
- "files": [
34
- "bin/",
35
- "lib/",
36
- "README.md",
37
- "LICENSE"
38
- ]
39
- }
1
+ {
2
+ "name": "50c",
3
+ "version": "3.9.9",
4
+ "description": "AI developer tools via MCP. Pay-per-use from $0.01. No subscriptions.",
5
+ "bin": {
6
+ "50c": "./bin/50c.js"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "node -e \"console.log('\\n50c Hub installed. Run: 50c install\\n')\""
10
+ },
11
+ "keywords": [
12
+ "mcp",
13
+ "ai",
14
+ "llm",
15
+ "cli",
16
+ "agent",
17
+ "50c",
18
+ "hints",
19
+ "genius",
20
+ "beacon",
21
+ "developer-tools",
22
+ "context",
23
+ "compression",
24
+ "caz",
25
+ "file-memory"
26
+ ],
27
+ "author": "genxis",
28
+ "license": "SEE LICENSE IN LICENSE",
29
+ "homepage": "https://50c.ai",
30
+ "engines": {
31
+ "node": ">=18.0.0"
32
+ },
33
+ "files": [
34
+ "bin/",
35
+ "lib/",
36
+ "README.md",
37
+ "LICENSE"
38
+ ]
39
+ }