@blockrun/franklin 3.15.32 → 3.15.34
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/tasks/spawn.d.ts +7 -2
- package/dist/tasks/spawn.js +30 -6
- package/dist/ui/app.js +19 -2
- package/package.json +1 -1
package/dist/tasks/spawn.d.ts
CHANGED
|
@@ -16,8 +16,13 @@
|
|
|
16
16
|
*
|
|
17
17
|
* CLI path resolution (in priority order):
|
|
18
18
|
* 1. process.env.FRANKLIN_CLI_PATH — escape hatch for tests / dev.
|
|
19
|
-
* 2.
|
|
20
|
-
*
|
|
19
|
+
* 2. STARTUP_CLI_PATH (captured at module load) — absolute path of
|
|
20
|
+
* the script Node is currently executing. Captured early so it
|
|
21
|
+
* survives any later chdir; resolved to absolute so it survives
|
|
22
|
+
* the spawn's `cwd:` override (the bug it fixes — verified
|
|
23
|
+
* 2026-05-04 from a real session: dev-mode `node dist/index.js`
|
|
24
|
+
* run, then Detach with workingDir=other-repo, child fails with
|
|
25
|
+
* MODULE_NOT_FOUND on `<other-repo>/dist/index.js`).
|
|
21
26
|
*/
|
|
22
27
|
export interface StartDetachedTaskInput {
|
|
23
28
|
label: string;
|
package/dist/tasks/spawn.js
CHANGED
|
@@ -16,22 +16,46 @@
|
|
|
16
16
|
*
|
|
17
17
|
* CLI path resolution (in priority order):
|
|
18
18
|
* 1. process.env.FRANKLIN_CLI_PATH — escape hatch for tests / dev.
|
|
19
|
-
* 2.
|
|
20
|
-
*
|
|
19
|
+
* 2. STARTUP_CLI_PATH (captured at module load) — absolute path of
|
|
20
|
+
* the script Node is currently executing. Captured early so it
|
|
21
|
+
* survives any later chdir; resolved to absolute so it survives
|
|
22
|
+
* the spawn's `cwd:` override (the bug it fixes — verified
|
|
23
|
+
* 2026-05-04 from a real session: dev-mode `node dist/index.js`
|
|
24
|
+
* run, then Detach with workingDir=other-repo, child fails with
|
|
25
|
+
* MODULE_NOT_FOUND on `<other-repo>/dist/index.js`).
|
|
21
26
|
*/
|
|
22
27
|
import { spawn } from 'node:child_process';
|
|
23
28
|
import fs from 'node:fs';
|
|
29
|
+
import path from 'node:path';
|
|
24
30
|
import { randomUUID } from 'node:crypto';
|
|
25
31
|
import { writeTaskMeta } from './store.js';
|
|
26
32
|
import { taskLogPath, ensureTaskDir } from './paths.js';
|
|
33
|
+
// Captured at module load so it survives later chdir / argv mutation.
|
|
34
|
+
// `process.argv[1]` may be relative (`dist/index.js` in dev mode); we
|
|
35
|
+
// resolve against process.cwd() at startup which is when the user's
|
|
36
|
+
// shell exec'd the bundle. Doing this at call time would be wrong if
|
|
37
|
+
// any code chdir'd between startup and the Detach call.
|
|
38
|
+
const STARTUP_CLI_PATH = (() => {
|
|
39
|
+
const argv1 = process.argv[1];
|
|
40
|
+
if (!argv1)
|
|
41
|
+
return undefined;
|
|
42
|
+
try {
|
|
43
|
+
return path.resolve(argv1);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return argv1;
|
|
47
|
+
}
|
|
48
|
+
})();
|
|
27
49
|
function resolveCliPath() {
|
|
28
50
|
const fromEnv = process.env.FRANKLIN_CLI_PATH;
|
|
29
51
|
if (fromEnv && fromEnv.length > 0)
|
|
30
52
|
return fromEnv;
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
|
|
53
|
+
// STARTUP_CLI_PATH is the absolute path resolved at module load —
|
|
54
|
+
// safe to use after `cwd: input.workingDir` redirects the child.
|
|
55
|
+
// npm global installs already give an absolute path; this only
|
|
56
|
+
// matters in dev mode where `node dist/index.js` puts a relative
|
|
57
|
+
// path into argv[1].
|
|
58
|
+
return STARTUP_CLI_PATH || process.argv[1];
|
|
35
59
|
}
|
|
36
60
|
function generateRunId() {
|
|
37
61
|
return `t_${Date.now().toString(36)}_${randomUUID().slice(0, 8)}`;
|
package/dist/ui/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
3
|
* RunCode ink-based terminal UI.
|
|
4
4
|
* Real-time streaming, thinking animation, tool progress, slash commands.
|
|
@@ -84,7 +84,24 @@ function InputBox({ input, setInput, onSubmit, model, balance, chain, walletTail
|
|
|
84
84
|
const leadingGlyph = (awaitingApproval || awaitingAnswer)
|
|
85
85
|
? _jsx(Text, { color: "yellow", bold: true, children: "\u26A0 " })
|
|
86
86
|
: (showSpinner ? _jsxs(Text, { color: "yellow", children: [_jsx(Spinner, { type: "dots" }), " "] }) : null);
|
|
87
|
-
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Box, { borderStyle: "round", borderColor: borderColor, borderDimColor: !borderColor, paddingX: 1, width: boxWidth, children: [leadingGlyph, _jsx(Box, { flexGrow: 1, children: vimMode ? (_jsx(VimInput, { value: input, onChange: setInput, onSubmit: onSubmit, placeholder: placeholder, focus: focused !== false, showMode: true, onModeChange: onVimModeChange })) : (_jsx(TextInput, { value: input, onChange: setInput, onSubmit: onSubmit, placeholder: placeholder, focus: focused !== false })) })] }), _jsx(Box, { marginLeft: 2, children: _jsxs(Text, { dimColor: true, children: [busy ? _jsx(Text, { color: "yellow", children: _jsx(Spinner, { type: "dots" }) }) : null, busy ? ' ' : '', shortModelName(model), " \u00B7 ",
|
|
87
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Box, { borderStyle: "round", borderColor: borderColor, borderDimColor: !borderColor, paddingX: 1, width: boxWidth, children: [leadingGlyph, _jsx(Box, { flexGrow: 1, children: vimMode ? (_jsx(VimInput, { value: input, onChange: setInput, onSubmit: onSubmit, placeholder: placeholder, focus: focused !== false, showMode: true, onModeChange: onVimModeChange })) : (_jsx(TextInput, { value: input, onChange: setInput, onSubmit: onSubmit, placeholder: placeholder, focus: focused !== false })) })] }), _jsx(Box, { marginLeft: 2, children: _jsxs(Text, { dimColor: true, children: [busy ? _jsx(Text, { color: "yellow", children: _jsx(Spinner, { type: "dots" }) }) : null, busy ? ' ' : '', shortModelName(model), " \u00B7 ", (() => {
|
|
88
|
+
// Color the balance by funding state. Real session 2026-05-04
|
|
89
|
+
// had a user staring at "$0.08 USDC" in dim text wondering
|
|
90
|
+
// whether it meant "out of money" or "wrong chain". Make
|
|
91
|
+
// low/critical balances unmistakable. Thresholds match the
|
|
92
|
+
// ~$0.10 / ~$0.50 ranges where a typical Opus turn ($0.08–
|
|
93
|
+
// $0.15) tips over: <$0.50 = red bold + low hint;
|
|
94
|
+
// <$1.00 = yellow; otherwise plain dim.
|
|
95
|
+
const m = balance.match(/\$([\d.]+)/);
|
|
96
|
+
const num = m ? parseFloat(m[1]) : null;
|
|
97
|
+
if (num !== null && num < 0.50) {
|
|
98
|
+
return _jsxs(_Fragment, { children: [_jsx(Text, { color: "red", bold: true, children: balance }), _jsx(Text, { color: "red", children: " \u26A0 low \u2014 fund wallet or /model free" })] });
|
|
99
|
+
}
|
|
100
|
+
if (num !== null && num < 1.00) {
|
|
101
|
+
return _jsx(Text, { color: "yellow", children: balance });
|
|
102
|
+
}
|
|
103
|
+
return balance;
|
|
104
|
+
})(), chain ? _jsxs(Text, { children: [" \u00B7 ", _jsx(Text, { color: "magenta", children: chain }), walletTail ? _jsxs(Text, { dimColor: true, children: [":", walletTail] }) : ''] }) : '', sessionCost > 0.00001 ? _jsxs(Text, { color: "yellow", children: [" -$", sessionCost.toFixed(4)] }) : '', contextPct !== undefined && contextPct > 0 ? (() => {
|
|
88
105
|
// Visual context bar: ▓▓▓▓▓▓░░░░ 75%
|
|
89
106
|
const filled = Math.round(contextPct / 10);
|
|
90
107
|
const empty = 10 - filled;
|
package/package.json
CHANGED