@blockrun/franklin 3.6.7 → 3.6.8
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/dist/commands/daemon.js +2 -2
- package/dist/commands/init.js +2 -2
- package/dist/commands/logs.js +11 -3
- package/dist/commands/proxy.js +3 -3
- package/dist/panel/server.js +3 -1
- package/dist/stats/tracker.js +14 -2
- package/package.json +1 -1
package/dist/commands/daemon.js
CHANGED
|
@@ -3,8 +3,8 @@ import fs from 'node:fs';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import { BLOCKRUN_DIR, DEFAULT_PROXY_PORT } from '../config.js';
|
|
6
|
-
const PID_FILE = path.join(BLOCKRUN_DIR, '
|
|
7
|
-
const LOG_FILE = path.join(BLOCKRUN_DIR, '
|
|
6
|
+
const PID_FILE = path.join(BLOCKRUN_DIR, 'franklin.pid');
|
|
7
|
+
const LOG_FILE = path.join(BLOCKRUN_DIR, 'franklin-debug.log');
|
|
8
8
|
function readPid() {
|
|
9
9
|
try {
|
|
10
10
|
const raw = fs.readFileSync(PID_FILE, 'utf-8').trim();
|
package/dist/commands/init.js
CHANGED
|
@@ -63,9 +63,9 @@ export async function initCommand(options) {
|
|
|
63
63
|
<key>KeepAlive</key>
|
|
64
64
|
<false/>
|
|
65
65
|
<key>StandardOutPath</key>
|
|
66
|
-
<string>${os.homedir()}/.blockrun/
|
|
66
|
+
<string>${os.homedir()}/.blockrun/franklin-debug.log</string>
|
|
67
67
|
<key>StandardErrorPath</key>
|
|
68
|
-
<string>${os.homedir()}/.blockrun/
|
|
68
|
+
<string>${os.homedir()}/.blockrun/franklin-debug.log</string>
|
|
69
69
|
</dict>
|
|
70
70
|
</plist>`;
|
|
71
71
|
fs.mkdirSync(LAUNCH_AGENT_DIR, { recursive: true });
|
package/dist/commands/logs.js
CHANGED
|
@@ -2,7 +2,8 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { BLOCKRUN_DIR } from '../config.js';
|
|
5
|
-
const LOG_FILE = path.join(BLOCKRUN_DIR, '
|
|
5
|
+
const LOG_FILE = path.join(BLOCKRUN_DIR, 'franklin-debug.log');
|
|
6
|
+
const LEGACY_LOG_FILE = path.join(BLOCKRUN_DIR, 'runcode-debug.log');
|
|
6
7
|
const MAX_LOG_SIZE = 10 * 1024 * 1024; // 10MB auto-rotate threshold
|
|
7
8
|
export function logsCommand(options) {
|
|
8
9
|
if (options.clear) {
|
|
@@ -15,9 +16,16 @@ export function logsCommand(options) {
|
|
|
15
16
|
}
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
19
|
+
// Migrate legacy log file
|
|
20
|
+
if (!fs.existsSync(LOG_FILE) && fs.existsSync(LEGACY_LOG_FILE)) {
|
|
21
|
+
try {
|
|
22
|
+
fs.renameSync(LEGACY_LOG_FILE, LOG_FILE);
|
|
23
|
+
}
|
|
24
|
+
catch { /* best effort */ }
|
|
25
|
+
}
|
|
18
26
|
if (!fs.existsSync(LOG_FILE)) {
|
|
19
|
-
console.log(chalk.dim('No logs yet. Start
|
|
20
|
-
console.log(chalk.bold('
|
|
27
|
+
console.log(chalk.dim('No logs yet. Start franklin with --debug to enable logging:'));
|
|
28
|
+
console.log(chalk.bold(' franklin start --debug'));
|
|
21
29
|
return;
|
|
22
30
|
}
|
|
23
31
|
// Auto-rotate: if file is over threshold, keep only last half
|
package/dist/commands/proxy.js
CHANGED
|
@@ -87,10 +87,10 @@ function launchProxy(server, port, debug) {
|
|
|
87
87
|
});
|
|
88
88
|
server.listen(port, () => {
|
|
89
89
|
console.log(chalk.green(`✓ Proxy running on port ${port}`));
|
|
90
|
-
console.log(chalk.dim(` Usage tracking: ~/.blockrun/
|
|
90
|
+
console.log(chalk.dim(` Usage tracking: ~/.blockrun/franklin-stats.json`));
|
|
91
91
|
if (debug)
|
|
92
|
-
console.log(chalk.dim(` Debug log: ~/.blockrun/
|
|
93
|
-
console.log(chalk.dim(` Run '
|
|
92
|
+
console.log(chalk.dim(` Debug log: ~/.blockrun/franklin-debug.log`));
|
|
93
|
+
console.log(chalk.dim(` Run 'franklin stats' to view statistics\n`));
|
|
94
94
|
console.log('Set this in your shell to use with Claude Code:\n');
|
|
95
95
|
console.log(chalk.bold(` export ANTHROPIC_BASE_URL=http://localhost:${port}/api`));
|
|
96
96
|
console.log(chalk.bold(` export ANTHROPIC_AUTH_TOKEN=x402-proxy-handles-auth`));
|
package/dist/panel/server.js
CHANGED
|
@@ -158,7 +158,9 @@ export function createPanelServer(port) {
|
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
160
|
// Watch stats file for changes → push to SSE clients
|
|
161
|
-
const statsFile = path.join(BLOCKRUN_DIR, '
|
|
161
|
+
const statsFile = fs.existsSync(path.join(BLOCKRUN_DIR, 'franklin-stats.json'))
|
|
162
|
+
? path.join(BLOCKRUN_DIR, 'franklin-stats.json')
|
|
163
|
+
: path.join(BLOCKRUN_DIR, 'runcode-stats.json');
|
|
162
164
|
if (fs.existsSync(statsFile)) {
|
|
163
165
|
fs.watchFile(statsFile, { interval: 2000 }, () => {
|
|
164
166
|
try {
|
package/dist/stats/tracker.js
CHANGED
|
@@ -9,15 +9,27 @@ import { OPUS_PRICING } from '../pricing.js';
|
|
|
9
9
|
import { BLOCKRUN_DIR } from '../config.js';
|
|
10
10
|
let resolvedStatsFile = null;
|
|
11
11
|
function preferredStatsFile() {
|
|
12
|
+
return path.join(BLOCKRUN_DIR, 'franklin-stats.json');
|
|
13
|
+
}
|
|
14
|
+
function legacyStatsFile() {
|
|
12
15
|
return path.join(BLOCKRUN_DIR, 'runcode-stats.json');
|
|
13
16
|
}
|
|
14
17
|
function fallbackStatsFile() {
|
|
15
|
-
return path.join(os.tmpdir(), '
|
|
18
|
+
return path.join(os.tmpdir(), 'franklin', 'franklin-stats.json');
|
|
16
19
|
}
|
|
17
20
|
export function getStatsFilePath() {
|
|
18
21
|
if (resolvedStatsFile)
|
|
19
22
|
return resolvedStatsFile;
|
|
20
|
-
|
|
23
|
+
// Migrate legacy stats file if it exists and new one doesn't
|
|
24
|
+
const preferred = preferredStatsFile();
|
|
25
|
+
const legacy = legacyStatsFile();
|
|
26
|
+
if (!fs.existsSync(preferred) && fs.existsSync(legacy)) {
|
|
27
|
+
try {
|
|
28
|
+
fs.renameSync(legacy, preferred);
|
|
29
|
+
}
|
|
30
|
+
catch { /* best effort */ }
|
|
31
|
+
}
|
|
32
|
+
for (const file of [preferred, fallbackStatsFile()]) {
|
|
21
33
|
try {
|
|
22
34
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
23
35
|
resolvedStatsFile = file;
|
package/package.json
CHANGED