pinokiod 3.0.24 → 3.0.26
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/kernel/shell.js +12 -16
- package/package.json +1 -1
- package/server/index.js +20 -0
- package/server/views/editor.ejs +11 -26
- package/server/views/fullscreen_editor.ejs +11 -26
package/kernel/shell.js
CHANGED
|
@@ -110,8 +110,6 @@ class Shell {
|
|
|
110
110
|
delete this.env.CUDA_PATH
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
this.env.PINOKIO_SHELL_START = Date.now()
|
|
114
|
-
|
|
115
113
|
this.env.CMAKE_OBJECT_PATH_MAX = 1024
|
|
116
114
|
this.env.PYTORCH_ENABLE_MPS_FALLBACK = 1
|
|
117
115
|
// this.env.NPM_CONFIG_USERCONFIG = this.kernel.path("user_npmrc")
|
|
@@ -452,17 +450,9 @@ class Shell {
|
|
|
452
450
|
// params.message.push(`echo "SHELL FINISHED RUNNING"\r\n`)
|
|
453
451
|
// if params.message is empty, filter out
|
|
454
452
|
//let delimiter = " && "
|
|
455
|
-
|
|
456
|
-
if (this.platform === "win32") {
|
|
457
|
-
params.message.push(`echo "--- pinokio shell.run finished: %PINOKIO_SHELL_START% ---"`)
|
|
458
|
-
} else {
|
|
459
|
-
params.message.push('echo "--- pinokio shell.run finished $PINOKIO_SHELL_START ---"')
|
|
460
|
-
}
|
|
461
|
-
|
|
462
453
|
let delimiter
|
|
463
454
|
if (this.platform === "win32") {
|
|
464
|
-
|
|
465
|
-
delimiter = " & "; // must use &&. & doesn't necessariliy wait until the curruent command finishes
|
|
455
|
+
delimiter = " && "; // must use &&. & doesn't necessariliy wait until the curruent command finishes
|
|
466
456
|
} else {
|
|
467
457
|
delimiter = " ; ";
|
|
468
458
|
}
|
|
@@ -550,6 +540,8 @@ class Shell {
|
|
|
550
540
|
conda_activation = [
|
|
551
541
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
552
542
|
`conda deactivate`,
|
|
543
|
+
`conda deactivate`,
|
|
544
|
+
`conda deactivate`,
|
|
553
545
|
`conda activate ${env_path}`,
|
|
554
546
|
]
|
|
555
547
|
} else {
|
|
@@ -557,6 +549,8 @@ class Shell {
|
|
|
557
549
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
558
550
|
`conda create -y -p ${env_path} ${conda_python} ${conda_args ? conda_args : ''}`,
|
|
559
551
|
`conda deactivate`,
|
|
552
|
+
`conda deactivate`,
|
|
553
|
+
`conda deactivate`,
|
|
560
554
|
`conda activate ${env_path}`,
|
|
561
555
|
]
|
|
562
556
|
}
|
|
@@ -565,6 +559,8 @@ class Shell {
|
|
|
565
559
|
conda_activation = [
|
|
566
560
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
567
561
|
`conda deactivate`,
|
|
562
|
+
`conda deactivate`,
|
|
563
|
+
`conda deactivate`,
|
|
568
564
|
`conda activate ${conda_name}`,
|
|
569
565
|
]
|
|
570
566
|
} else {
|
|
@@ -575,6 +571,8 @@ class Shell {
|
|
|
575
571
|
conda_activation = [
|
|
576
572
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
577
573
|
`conda deactivate`,
|
|
574
|
+
`conda deactivate`,
|
|
575
|
+
`conda deactivate`,
|
|
578
576
|
`conda activate ${conda_name}`,
|
|
579
577
|
]
|
|
580
578
|
} else {
|
|
@@ -582,6 +580,8 @@ class Shell {
|
|
|
582
580
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
583
581
|
`conda create -y -n ${conda_name} ${conda_python} ${conda_args ? conda_args : ''}`,
|
|
584
582
|
`conda deactivate`,
|
|
583
|
+
`conda deactivate`,
|
|
584
|
+
`conda deactivate`,
|
|
585
585
|
`conda activate ${conda_name}`,
|
|
586
586
|
]
|
|
587
587
|
}
|
|
@@ -827,13 +827,9 @@ ${cleaned}
|
|
|
827
827
|
// Decide whether to kill or continue
|
|
828
828
|
if (this.ready) {
|
|
829
829
|
// when ready, watch out for the prompt pattern that terminates with [\r\n ]
|
|
830
|
-
|
|
831
|
-
let termination_prompt_re = new RegExp(".*--- pinokio shell.run finished: [0-9]+ ---.*", "g")
|
|
832
|
-
|
|
833
|
-
//let termination_prompt_re = new RegExp(this.prompt_pattern + "[ \r\n]*$", "g")
|
|
830
|
+
let termination_prompt_re = new RegExp(this.prompt_pattern + "[ \r\n]*$", "g")
|
|
834
831
|
let line = cleaned.replaceAll(/[\r\n]/g, "")
|
|
835
832
|
let test = line.match(termination_prompt_re)
|
|
836
|
-
console.log({ line, test, termination_prompt_re })
|
|
837
833
|
if (test) {
|
|
838
834
|
let cache = cleaned
|
|
839
835
|
let cached_msg = msg
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -1323,6 +1323,10 @@ class Server {
|
|
|
1323
1323
|
if (config.color) this.colors.color = config.color
|
|
1324
1324
|
if (config.symbolColor) this.colors.symbolColor = config.symbolColor
|
|
1325
1325
|
}
|
|
1326
|
+
if (config.xterm) {
|
|
1327
|
+
this.xterm = config.xterm
|
|
1328
|
+
console.log("this.xterm", this.xterm)
|
|
1329
|
+
}
|
|
1326
1330
|
}
|
|
1327
1331
|
}
|
|
1328
1332
|
}
|
|
@@ -2670,6 +2674,22 @@ class Server {
|
|
|
2670
2674
|
agent: this.agent,
|
|
2671
2675
|
})
|
|
2672
2676
|
}))
|
|
2677
|
+
this.app.get("/xterm_config", ex(async (req, res) => {
|
|
2678
|
+
let exists = await fse.pathExists(this.kernel.path("web"))
|
|
2679
|
+
if (exists) {
|
|
2680
|
+
let config_exists = await fse.pathExists(this.kernel.path("web/config.json"))
|
|
2681
|
+
if (config_exists) {
|
|
2682
|
+
let config = (await this.kernel.loader.load(this.kernel.path("web/config.json"))).resolved
|
|
2683
|
+
if (config) {
|
|
2684
|
+
if (config.xterm) {
|
|
2685
|
+
this.xterm = config.xterm
|
|
2686
|
+
console.log("this.xterm", this.xterm)
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
res.json({ config: this.xterm })
|
|
2692
|
+
}))
|
|
2673
2693
|
this.app.get("/du/:name", ex(async (req, res) => {
|
|
2674
2694
|
let p = this.kernel.path("api", req.params.name)
|
|
2675
2695
|
let d1 = await Util.du(p)
|
package/server/views/editor.ejs
CHANGED
|
@@ -572,34 +572,19 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
572
572
|
await this.createTerm()
|
|
573
573
|
await this.start(mode)
|
|
574
574
|
}
|
|
575
|
-
createTerm () {
|
|
575
|
+
async createTerm () {
|
|
576
576
|
if (!this.term) {
|
|
577
|
-
|
|
578
|
-
//theme: xtermTheme.Piatto_Light,
|
|
579
|
-
//theme: xtermTheme.Spring,
|
|
580
|
-
|
|
581
|
-
//theme: xtermTheme.Github,
|
|
582
|
-
|
|
583
|
-
//theme: xtermTheme.Cobalt_Neon, // top legibility
|
|
584
|
-
//theme: xtermTheme.Duotone_Dark,
|
|
585
|
-
theme: xtermTheme.FrontEndDelight,
|
|
586
|
-
//theme: xtermTheme.Seafoam_Pastel,
|
|
587
|
-
//theme: xtermTheme.IC_Green_PPL,
|
|
588
|
-
//theme: xtermTheme.FunForrest,
|
|
589
|
-
//theme: xtermTheme.Jackie_Brown,
|
|
590
|
-
//theme: xtermTheme.Ocean,
|
|
591
|
-
|
|
592
|
-
//theme: xtermTheme.Blazer,
|
|
593
|
-
//theme: xtermTheme.BirdsOfParadise,
|
|
594
|
-
//theme: xtermTheme.AtelierSulphurpool,
|
|
595
|
-
//theme: xtermTheme.Borland,
|
|
596
|
-
//rows: 20,
|
|
597
|
-
//cols: 1000,
|
|
577
|
+
let config = {
|
|
598
578
|
fontSize: 12,
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
579
|
+
theme: xtermTheme.FrontEndDelight
|
|
580
|
+
}
|
|
581
|
+
let res = await fetch("/xterm_config").then((res) => {
|
|
582
|
+
return res.json()
|
|
583
|
+
})
|
|
584
|
+
if (res && res.config) {
|
|
585
|
+
config = res.config
|
|
586
|
+
}
|
|
587
|
+
const term = new Terminal(config)
|
|
603
588
|
term.open(document.querySelector("#terminal"))
|
|
604
589
|
|
|
605
590
|
|
|
@@ -556,35 +556,20 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
556
556
|
await this.createTerm()
|
|
557
557
|
await this.start(mode)
|
|
558
558
|
}
|
|
559
|
-
createTerm () {
|
|
559
|
+
async createTerm () {
|
|
560
560
|
if (!this.term) {
|
|
561
|
-
|
|
561
|
+
let config = {
|
|
562
562
|
scrollback: 9999999,
|
|
563
|
-
//theme: xtermTheme.Piatto_Light,
|
|
564
|
-
//theme: xtermTheme.Spring,
|
|
565
|
-
|
|
566
|
-
//theme: xtermTheme.Github,
|
|
567
|
-
|
|
568
|
-
//theme: xtermTheme.Cobalt_Neon, // top legibility
|
|
569
|
-
//theme: xtermTheme.Duotone_Dark,
|
|
570
|
-
//theme: xtermTheme.Batman,
|
|
571
|
-
//theme: xtermTheme.Brogrammer,
|
|
572
|
-
theme: xtermTheme.FrontEndDelight,
|
|
573
|
-
//theme: xtermTheme.Seafoam_Pastel,
|
|
574
|
-
//theme: xtermTheme.IC_Green_PPL,
|
|
575
|
-
//theme: xtermTheme.FunForrest,
|
|
576
|
-
//theme: xtermTheme.Jackie_Brown,
|
|
577
|
-
//theme: xtermTheme.Ocean,
|
|
578
|
-
|
|
579
|
-
//theme: xtermTheme.Blazer,
|
|
580
|
-
//theme: xtermTheme.BirdsOfParadise,
|
|
581
|
-
//theme: xtermTheme.AtelierSulphurpool,
|
|
582
|
-
//theme: xtermTheme.Borland,
|
|
583
563
|
fontSize: 12,
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
564
|
+
theme: xtermTheme.FrontEndDelight
|
|
565
|
+
}
|
|
566
|
+
let res = await fetch("/xterm_config").then((res) => {
|
|
567
|
+
return res.json()
|
|
568
|
+
})
|
|
569
|
+
if (res && res.config) {
|
|
570
|
+
config = res.config
|
|
571
|
+
}
|
|
572
|
+
const term = new Terminal(config)
|
|
588
573
|
term.open(document.querySelector("#terminal"))
|
|
589
574
|
|
|
590
575
|
term.attachCustomKeyEventHandler(event => {
|