pinokiod 3.8.1532 → 3.8.1534
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/LICENSE +7 -0
- package/kernel/api/fs/index.js +4 -6
- package/kernel/api/index.js +37 -123
- package/kernel/api/input/index.js +0 -2
- package/kernel/api/web/index.js +0 -6
- package/kernel/bin/cloudflared.js +0 -1
- package/kernel/bin/conda.js +2 -10
- package/kernel/bin/cuda.js +16 -0
- package/kernel/bin/ffmpeg.js +6 -4
- package/kernel/bin/git.js +29 -55
- package/kernel/bin/gxx.js +6 -8
- package/kernel/bin/huggingface.js +5 -4
- package/kernel/bin/index.js +88 -349
- package/kernel/bin/node.js +6 -13
- package/kernel/bin/py.js +1 -1
- package/kernel/bin/uv.js +5 -4
- package/kernel/bin/zip.js +8 -7
- package/kernel/environment.js +1 -50
- package/kernel/index.js +27 -178
- package/kernel/info.js +2 -4
- package/kernel/loader.js +3 -5
- package/kernel/shell.js +60 -142
- package/kernel/shells.js +17 -32
- package/kernel/sysinfo.js +1 -0
- package/kernel/util.js +36 -143
- package/package.json +1 -2
- package/pipe/index.js +2 -0
- package/script/index.js +12 -12
- package/server/index.js +578 -1307
- package/server/public/install.js +20 -17
- package/server/public/modalinput.js +2 -3
- package/server/public/opener.js +1 -3
- package/server/public/pinokio-black.png +0 -0
- package/server/public/style.css +9 -167
- package/server/socket.js +37 -108
- package/server/views/404.ejs +1 -0
- package/server/views/500.ejs +1 -1
- package/server/views/app.ejs +33 -275
- package/server/views/bootstrap.ejs +19 -22
- package/server/views/download.ejs +1 -7
- package/server/views/editor.ejs +10 -77
- package/server/views/explore.ejs +6 -12
- package/server/views/file_explorer.ejs +11 -19
- package/server/views/help.ejs +3 -10
- package/server/views/index.ejs +87 -256
- package/server/views/install.ejs +29 -56
- package/server/views/partials/menu.ejs +1 -7
- package/server/views/proxy.ejs +405 -0
- package/server/views/required_env_editor.ejs +2 -11
- package/server/views/settings.ejs +5 -35
- package/server/views/terminal.ejs +36 -171
- package/kernel/bin/caddy.js +0 -127
- package/kernel/bin/setup.js +0 -130
- package/kernel/kv.js +0 -38
- package/kernel/peer.js +0 -161
- package/kernel/procs.js +0 -116
- package/kernel/prototype.js +0 -49
- package/kernel/router/common.js +0 -42
- package/kernel/router/connector.js +0 -81
- package/kernel/router/index.js +0 -225
- package/kernel/router/localhost_home_router.js +0 -84
- package/kernel/router/localhost_port_router.js +0 -15
- package/kernel/router/localhost_variable_router.js +0 -37
- package/kernel/router/peer_home_router.js +0 -15
- package/kernel/router/peer_peer_router.js +0 -26
- package/kernel/router/peer_port_router.js +0 -45
- package/kernel/router/peer_variable_router.js +0 -46
- package/kernel/router/processor.js +0 -31
- package/kernel/store.js +0 -58
- package/server/public/SourceCodePro-Regular.ttf +0 -0
- package/server/public/SpaceMono-Bold.ttf +0 -0
- package/server/public/SpaceMono-BoldItalic.ttf +0 -0
- package/server/public/SpaceMono-Italic.ttf +0 -0
- package/server/public/SpaceMono-Regular.ttf +0 -0
- package/server/public/commander.js +0 -40
- package/server/public/filepond-plugin-file-validate-type.min.js +0 -9
- package/server/public/filepond-plugin-image-crop.min.js +0 -9
- package/server/public/filepond-plugin-image-edit.min.css +0 -8
- package/server/public/filepond-plugin-image-edit.min.js +0 -9
- package/server/public/filepond-plugin-image-exif-orientation.min.js +0 -9
- package/server/public/filepond-plugin-image-preview.min.css +0 -8
- package/server/public/filepond-plugin-image-preview.min.js +0 -9
- package/server/public/filepond-plugin-image-resize.min.js +0 -9
- package/server/public/filepond-plugin-image-transform.min.js +0 -9
- package/server/public/filepond.min.css +0 -8
- package/server/public/filepond.min.js +0 -9
- package/server/public/fscreator.js +0 -177
- package/server/public/fseditor.js +0 -189
- package/server/public/github.png +0 -0
- package/server/public/pinokio-black2.png +0 -0
- package/server/public/redoc.standalone.js +0 -1832
- package/server/public/swagger-ui-bundle.js +0 -2
- package/server/public/swagger-ui.css +0 -3
- package/server/views/github.ejs +0 -179
- package/server/views/keys.ejs +0 -276
- package/server/views/network.ejs +0 -874
- package/server/views/partials/dynamic.ejs +0 -6
- package/server/views/prototype.ejs +0 -299
- package/server/views/redoc.ejs +0 -18
- package/server/views/setup.ejs +0 -254
- package/server/views/setup_home.ejs +0 -191
- package/server/views/shell.ejs +0 -781
- package/server/views/swaggerui.ejs +0 -19
package/LICENSE
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2023 Pinokio
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/kernel/api/fs/index.js
CHANGED
|
@@ -75,18 +75,16 @@ class FS {
|
|
|
75
75
|
/*
|
|
76
76
|
params := {
|
|
77
77
|
path: <filepath>,
|
|
78
|
-
|
|
78
|
+
mode: "view(default)|open"
|
|
79
79
|
}
|
|
80
80
|
open finder/file explorer at path
|
|
81
81
|
*/
|
|
82
82
|
let dirPath = path.resolve(req.cwd, req.params.path)
|
|
83
83
|
ondata({ raw: `\r\nopening path: ${dirPath}\r\n` })
|
|
84
|
-
if (req.params.
|
|
85
|
-
Util.openfs(dirPath, req.params
|
|
86
|
-
} else if (req.params.mode) {
|
|
87
|
-
Util.openfs(dirPath, req.params, kernel)
|
|
84
|
+
if (req.params.mode) {
|
|
85
|
+
Util.openfs(dirPath, req.params.mode)
|
|
88
86
|
} else {
|
|
89
|
-
Util.openfs(dirPath
|
|
87
|
+
Util.openfs(dirPath)
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
90
|
|
package/kernel/api/index.js
CHANGED
|
@@ -28,21 +28,6 @@ class Api {
|
|
|
28
28
|
this.child_procs = {}
|
|
29
29
|
this.lproxy = new Lproxy()
|
|
30
30
|
}
|
|
31
|
-
async meta(name) {
|
|
32
|
-
let p = this.kernel.path("api", name, "pinokio.js")
|
|
33
|
-
let pinokio = (await this.kernel.loader.load(p)).resolved
|
|
34
|
-
let p2 = this.kernel.path("api", name, "pinokio_meta.json")
|
|
35
|
-
let pinokio2 = (await this.kernel.loader.load(p2)).resolved
|
|
36
|
-
let p3 = this.kernel.path("api", name, "pinokio.json")
|
|
37
|
-
let pinokio3 = (await this.kernel.loader.load(p3)).resolved
|
|
38
|
-
let meta = Object.assign({}, pinokio, pinokio2, pinokio3)
|
|
39
|
-
meta.iconpath = meta.icon ? this.kernel.path("api", name, meta.icon) : null
|
|
40
|
-
meta.icon = meta.icon ? `/api/${name}/${meta.icon}?raw=true` : "/pinokio-black.png"
|
|
41
|
-
meta.path = this.kernel.path("api", name)
|
|
42
|
-
meta.name = meta.title
|
|
43
|
-
meta.link = `/pinokio/browser/${name}/browse#n1`
|
|
44
|
-
return meta
|
|
45
|
-
}
|
|
46
31
|
get_proxy_url(root, port) {
|
|
47
32
|
if (this.proxies) {
|
|
48
33
|
let proxies = this.proxies[root]
|
|
@@ -139,12 +124,16 @@ class Api {
|
|
|
139
124
|
|
|
140
125
|
let requestPath = this.filePath(req.params.uri)
|
|
141
126
|
|
|
127
|
+
|
|
128
|
+
|
|
142
129
|
let { cwd, script } = await this.resolveScript(requestPath)
|
|
130
|
+
console.log("STOP", { script })
|
|
143
131
|
if (script.on) {
|
|
144
132
|
if (script.on.stop) {
|
|
145
133
|
await this.process(script.on.stop)
|
|
146
134
|
}
|
|
147
135
|
}
|
|
136
|
+
|
|
148
137
|
// reset modules
|
|
149
138
|
let modpath = this.resolvePath(cwd, req.params.uri)
|
|
150
139
|
console.log("STOP modpath", modpath)
|
|
@@ -190,7 +179,6 @@ class Api {
|
|
|
190
179
|
id: requestPath,
|
|
191
180
|
type: "disconnect"
|
|
192
181
|
})
|
|
193
|
-
this.kernel.refresh(true)
|
|
194
182
|
return true
|
|
195
183
|
}
|
|
196
184
|
async startScripts() {
|
|
@@ -364,20 +352,13 @@ class Api {
|
|
|
364
352
|
let modpath
|
|
365
353
|
if (matched_repo.length > 0) {
|
|
366
354
|
let repo_uri = matched_repo[0]
|
|
367
|
-
if (!repo_uri.endsWith(".git")) {
|
|
368
|
-
repo_uri = repo_uri + ".git"
|
|
369
|
-
}
|
|
370
355
|
|
|
371
|
-
let
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
} else {
|
|
375
|
-
let relative_path = uri
|
|
376
|
-
.replace(repo_uri, "") // remove the git repo uri
|
|
377
|
-
.slice(1) // remove the leading '/' for relative path
|
|
378
|
-
modpath = path.resolve(repopath, relative_path)
|
|
379
|
-
}
|
|
356
|
+
let relative_path = uri
|
|
357
|
+
.replace(repo_uri, "") // remove the git repo uri
|
|
358
|
+
.slice(1) // remove the leading '/' for relative path
|
|
380
359
|
|
|
360
|
+
let repopath = this.gitPath[repo_uri]
|
|
361
|
+
modpath = path.resolve(repopath, relative_path)
|
|
381
362
|
} else {
|
|
382
363
|
//console.log("no matching gitpath")
|
|
383
364
|
}
|
|
@@ -445,18 +426,14 @@ class Api {
|
|
|
445
426
|
let method
|
|
446
427
|
let dirname
|
|
447
428
|
let mod
|
|
448
|
-
if (req.
|
|
449
|
-
modpath = null
|
|
450
|
-
method = req.method
|
|
451
|
-
dirname = __dirname
|
|
452
|
-
mod = null
|
|
453
|
-
} else if (req.uri) {
|
|
429
|
+
if (req.uri) {
|
|
454
430
|
modpath = this.resolvePath(cwd, req.uri)
|
|
455
431
|
let m = (await this.loader.load(modpath))
|
|
456
432
|
const stats = await fs.promises.stat(modpath)
|
|
457
433
|
if (!this.child_procs[req.parent.path]) {
|
|
458
434
|
this.child_procs[req.parent.path] = new Set()
|
|
459
435
|
}
|
|
436
|
+
console.log("SCRIPT RESOLVE METHOD", req)
|
|
460
437
|
if (this.mods[modpath]) {
|
|
461
438
|
// use the cached module if unchanged
|
|
462
439
|
if (String(stats.mtime) === String(this.mods[modpath].updated)) {
|
|
@@ -590,19 +567,15 @@ class Api {
|
|
|
590
567
|
|
|
591
568
|
}
|
|
592
569
|
async step (request, rawrpc, input, i, total, args) {
|
|
570
|
+
console.time("STEP INIT")
|
|
593
571
|
await Promise.all([this.init(), this.kernel.update_sysinfo()])
|
|
572
|
+
console.timeEnd("STEP INIT")
|
|
594
573
|
|
|
595
574
|
// clear global regular expression object RegExp.lastMatch (memory leak prevention)
|
|
596
575
|
let r = /\s*/g.exec("");
|
|
597
576
|
|
|
598
|
-
let port = await this.kernel.port()
|
|
599
|
-
|
|
600
577
|
let { cwd, script } = await this.resolveScript(request.path)
|
|
601
578
|
|
|
602
|
-
if (request.cwd) {
|
|
603
|
-
cwd = request.cwd
|
|
604
|
-
}
|
|
605
|
-
|
|
606
579
|
let memory = {
|
|
607
580
|
script: this.kernel.script,
|
|
608
581
|
input,
|
|
@@ -614,7 +587,6 @@ class Api {
|
|
|
614
587
|
uri: request.uri,
|
|
615
588
|
cwd,
|
|
616
589
|
self: script,
|
|
617
|
-
port,
|
|
618
590
|
...this.kernel.vars,
|
|
619
591
|
}
|
|
620
592
|
|
|
@@ -655,6 +627,7 @@ class Api {
|
|
|
655
627
|
break;
|
|
656
628
|
}
|
|
657
629
|
}
|
|
630
|
+
|
|
658
631
|
// replace {{{ }}} with {{ }}
|
|
659
632
|
rpc = this.kernel.template.flatten(rpc)
|
|
660
633
|
|
|
@@ -788,7 +761,6 @@ class Api {
|
|
|
788
761
|
uri: request.path
|
|
789
762
|
}
|
|
790
763
|
})
|
|
791
|
-
console.log(">>>>>> STOPPED", request)
|
|
792
764
|
}
|
|
793
765
|
return { request, input: null, step: rpc.next, total: script.run.length, args }
|
|
794
766
|
} else {
|
|
@@ -1007,7 +979,6 @@ class Api {
|
|
|
1007
979
|
uri: request.path
|
|
1008
980
|
}
|
|
1009
981
|
})
|
|
1010
|
-
console.log("<<<<<< STOPPED", request)
|
|
1011
982
|
return { request, input: result, step: rpc.next, total: script.run.length, args }
|
|
1012
983
|
}
|
|
1013
984
|
|
|
@@ -1085,7 +1056,6 @@ class Api {
|
|
|
1085
1056
|
})
|
|
1086
1057
|
}
|
|
1087
1058
|
}
|
|
1088
|
-
this.kernel.refresh(true)
|
|
1089
1059
|
} catch (e) {
|
|
1090
1060
|
ondata({ raw: e.toString() })
|
|
1091
1061
|
}
|
|
@@ -1151,35 +1121,6 @@ class Api {
|
|
|
1151
1121
|
this.process(request, resolve)
|
|
1152
1122
|
})
|
|
1153
1123
|
}
|
|
1154
|
-
async get_default(repo_path) {
|
|
1155
|
-
let p = path.resolve(repo_path, "pinokio.js")
|
|
1156
|
-
// call 'process' based on the current status
|
|
1157
|
-
let config = (await this.loader.load(p)).resolved
|
|
1158
|
-
if (config && config.menu) {
|
|
1159
|
-
if (typeof config.menu === "function") {
|
|
1160
|
-
if (config.menu.constructor.name === "AsyncFunction") {
|
|
1161
|
-
config.menu = await config.menu(this.kernel, this.kernel.info)
|
|
1162
|
-
} else {
|
|
1163
|
-
config.menu = config.menu(this.kernel, this.kernel.info)
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
// find the default item in the menu
|
|
1167
|
-
let running = config.menu.filter((item) => {
|
|
1168
|
-
return item.default
|
|
1169
|
-
})
|
|
1170
|
-
if (running.length > 0) {
|
|
1171
|
-
let r = running[0]
|
|
1172
|
-
if (r.href) {
|
|
1173
|
-
if (r.href.startsWith("http")) {
|
|
1174
|
-
return r.href
|
|
1175
|
-
} else {
|
|
1176
|
-
let href = path.resolve(repo_path, r.href)
|
|
1177
|
-
return href
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
1124
|
async process(request, done) {
|
|
1184
1125
|
/**************************************************************
|
|
1185
1126
|
*
|
|
@@ -1221,66 +1162,43 @@ class Api {
|
|
|
1221
1162
|
// this.kernel.keys = (await this.loader.load(keypath)).resolved
|
|
1222
1163
|
|
|
1223
1164
|
// init shell before running just to make sure the environment variables are fresh
|
|
1165
|
+
console.time("shell.init")
|
|
1224
1166
|
await this.kernel.shell.init()
|
|
1167
|
+
console.timeEnd("shell.init")
|
|
1225
1168
|
|
|
1226
1169
|
if (request.uri){
|
|
1227
|
-
|
|
1228
1170
|
this.counter++;
|
|
1229
1171
|
// API Call
|
|
1230
1172
|
|
|
1231
1173
|
request.path = this.resolvePath(this.userdir, request.uri)
|
|
1174
|
+
let { cwd, script } = await this.resolveScript(request.path)
|
|
1175
|
+
request.cwd = cwd
|
|
1232
1176
|
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
// the script is requesting a uri of the git repo
|
|
1240
|
-
// look for pinokio.js
|
|
1241
|
-
let p = path.resolve(request.path, "pinokio.js")
|
|
1242
|
-
let exists = await this.exists(p)
|
|
1243
|
-
console.log({ p, exists })
|
|
1244
|
-
if (exists) {
|
|
1245
|
-
await this.launch(request, p)
|
|
1246
|
-
} else {
|
|
1247
|
-
this.ondata({
|
|
1248
|
-
id: request.path,
|
|
1249
|
-
type: "error",
|
|
1250
|
-
data: "uri doesn't exist \r\n" + JSON.stringify(request, null, 2)
|
|
1251
|
-
})
|
|
1252
|
-
}
|
|
1177
|
+
if (!script) {
|
|
1178
|
+
this.ondata({
|
|
1179
|
+
id: request.path,
|
|
1180
|
+
type: "error",
|
|
1181
|
+
data: "the endpoint does not exist: " + request.uri,
|
|
1182
|
+
})
|
|
1253
1183
|
} else {
|
|
1254
|
-
|
|
1255
|
-
|
|
1184
|
+
// 3. Check if the resolved endpoint has the "run" attribute and it's an array
|
|
1185
|
+
//if (script.run && Array.isArray(script.run)) {
|
|
1186
|
+
if (script.run) {
|
|
1187
|
+
|
|
1188
|
+
this.running[request.path] = true
|
|
1256
1189
|
|
|
1257
|
-
|
|
1190
|
+
this.done[request.path] = done
|
|
1191
|
+
|
|
1192
|
+
this.queue(request, script.run[0], request.input, 0, script.run.length, cwd, request.input)
|
|
1193
|
+
|
|
1194
|
+
} else {
|
|
1258
1195
|
this.ondata({
|
|
1259
1196
|
id: request.path,
|
|
1260
1197
|
type: "error",
|
|
1261
|
-
data: "
|
|
1198
|
+
data: "missing attribute: run"
|
|
1262
1199
|
})
|
|
1263
|
-
} else {
|
|
1264
|
-
// 3. Check if the resolved endpoint has the "run" attribute and it's an array
|
|
1265
|
-
//if (script.run && Array.isArray(script.run)) {
|
|
1266
|
-
if (script.run) {
|
|
1267
|
-
|
|
1268
|
-
this.running[request.path] = true
|
|
1269
|
-
|
|
1270
|
-
this.done[request.path] = done
|
|
1271
|
-
|
|
1272
|
-
this.queue(request, script.run[0], request.input, 0, script.run.length, cwd, request.input)
|
|
1273
|
-
|
|
1274
|
-
} else {
|
|
1275
|
-
this.ondata({
|
|
1276
|
-
id: request.path,
|
|
1277
|
-
type: "error",
|
|
1278
|
-
data: "missing attribute: run"
|
|
1279
|
-
})
|
|
1280
|
-
}
|
|
1281
1200
|
}
|
|
1282
1201
|
}
|
|
1283
|
-
|
|
1284
1202
|
} else if (request.method) {
|
|
1285
1203
|
let pass = 0;
|
|
1286
1204
|
while(true) {
|
|
@@ -1311,16 +1229,12 @@ class Api {
|
|
|
1311
1229
|
|
|
1312
1230
|
// Kernel Call
|
|
1313
1231
|
let resolved = await this.resolveMethod(request)
|
|
1314
|
-
let id = request.id ? request.id : request.method
|
|
1315
|
-
if (request.id) {
|
|
1316
|
-
this.running[request.id] = true
|
|
1317
|
-
}
|
|
1318
1232
|
try {
|
|
1319
1233
|
resolved.dirname = resolved.dirname
|
|
1320
1234
|
let result = await this.run(resolved.method, request, (stream, type) => {
|
|
1321
1235
|
this.ondata({
|
|
1322
1236
|
kernel: true,
|
|
1323
|
-
id,
|
|
1237
|
+
id: request.method,
|
|
1324
1238
|
type: (type ? type : "stream"),
|
|
1325
1239
|
data: stream,
|
|
1326
1240
|
rpc: request,
|
|
@@ -1329,7 +1243,7 @@ class Api {
|
|
|
1329
1243
|
})
|
|
1330
1244
|
this.ondata({
|
|
1331
1245
|
kernel: true,
|
|
1332
|
-
id,
|
|
1246
|
+
id: request.method,
|
|
1333
1247
|
type: "result",
|
|
1334
1248
|
data: result,
|
|
1335
1249
|
rpc: request,
|
package/kernel/api/web/index.js
CHANGED
|
@@ -21,11 +21,5 @@ class Web {
|
|
|
21
21
|
kernel.exposed[app] = req.params.uri
|
|
22
22
|
console.log("kernel.exposed", kernel.exposed)
|
|
23
23
|
}
|
|
24
|
-
async open(req, ondata, kernel) {
|
|
25
|
-
ondata(req.params, "browser.open")
|
|
26
|
-
}
|
|
27
|
-
async close(req, ondata, kernel) {
|
|
28
|
-
ondata(req.params, "browser.close")
|
|
29
|
-
}
|
|
30
24
|
}
|
|
31
25
|
module.exports = Web
|
package/kernel/bin/conda.js
CHANGED
|
@@ -4,7 +4,6 @@ const fetch = require('cross-fetch')
|
|
|
4
4
|
const { glob } = require('glob')
|
|
5
5
|
const semver = require('semver')
|
|
6
6
|
class Conda {
|
|
7
|
-
description = "Pinokio uses Conda to install various useful programs in an isolated manner."
|
|
8
7
|
urls = {
|
|
9
8
|
darwin: {
|
|
10
9
|
//x64: "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.5.2-0-MacOSX-x86_64.sh",
|
|
@@ -120,7 +119,6 @@ report_errors: false`)
|
|
|
120
119
|
// }
|
|
121
120
|
async check() {
|
|
122
121
|
let res = await this.kernel.bin.exec({ message: `conda list` }, (stream) => {
|
|
123
|
-
// process.stdout.write(stream.raw)
|
|
124
122
|
// console.log("conda list check", { stream })
|
|
125
123
|
})
|
|
126
124
|
|
|
@@ -178,6 +176,7 @@ report_errors: false`)
|
|
|
178
176
|
}
|
|
179
177
|
}
|
|
180
178
|
}
|
|
179
|
+
console.log("> Check", { conda_check, conda })
|
|
181
180
|
this.kernel.bin.installed.conda = conda
|
|
182
181
|
return conda_check.conda && conda_check.mamba && conda_check.sqlite
|
|
183
182
|
//return conda_check.conda && conda_check.mamba
|
|
@@ -251,18 +250,11 @@ report_errors: false`)
|
|
|
251
250
|
// 2. The pinned file says conda-libmamba-solver=24.11.1
|
|
252
251
|
// 3. so after conda update --all, it should be conda-libmamba-solver=24.11.1
|
|
253
252
|
|
|
254
|
-
let mods = this.kernel.bin.mods.filter((m) => {
|
|
255
|
-
return req.dependencies.includes(m.name)
|
|
256
|
-
// return ["zip", "uv", "node", "huggingface", "gxx", "git", "ffmpeg", "caddy"].includes(m.name)
|
|
257
|
-
}).map((m) => {
|
|
258
|
-
return m.mod.cmd()
|
|
259
|
-
}).join(" ")
|
|
260
|
-
console.log("Conda dependencies to install", { mods })
|
|
261
253
|
|
|
262
254
|
let cmds = [
|
|
263
255
|
//"conda clean -y --index-cache",
|
|
264
256
|
"conda clean -y --all",
|
|
265
|
-
|
|
257
|
+
"conda install -y -c conda-forge sqlite=3.47.2",
|
|
266
258
|
|
|
267
259
|
// `conda config --file ${this.kernel.path('condarc')} --set remote_connect_timeout_secs 20`,
|
|
268
260
|
// `conda config --file ${this.kernel.path('condarc')} --set remote_read_timeout_secs 300`,
|
package/kernel/bin/cuda.js
CHANGED
|
@@ -6,12 +6,20 @@ class Cuda {
|
|
|
6
6
|
"conda clean -y --all",
|
|
7
7
|
"conda install -y cudnn libzlib-wapi -c conda-forge",
|
|
8
8
|
]
|
|
9
|
+
// conda: {
|
|
10
|
+
// name: "base",
|
|
11
|
+
// activate: "minimal"
|
|
12
|
+
// }
|
|
9
13
|
}, ondata)
|
|
10
14
|
await this.kernel.bin.exec({
|
|
11
15
|
message: [
|
|
12
16
|
"conda clean -y --all",
|
|
13
17
|
"conda install -y cuda -c nvidia/label/cuda-12.1.0",
|
|
14
18
|
]
|
|
19
|
+
// conda: {
|
|
20
|
+
// name: "base",
|
|
21
|
+
// activate: "minimal"
|
|
22
|
+
// }
|
|
15
23
|
}, ondata)
|
|
16
24
|
} else {
|
|
17
25
|
await this.kernel.bin.exec({
|
|
@@ -19,12 +27,20 @@ class Cuda {
|
|
|
19
27
|
"conda clean -y --all",
|
|
20
28
|
"conda install -y cudnn -c conda-forge",
|
|
21
29
|
]
|
|
30
|
+
// conda: {
|
|
31
|
+
// name: "base",
|
|
32
|
+
// activate: "minimal"
|
|
33
|
+
// }
|
|
22
34
|
}, ondata)
|
|
23
35
|
await this.kernel.bin.exec({
|
|
24
36
|
message: [
|
|
25
37
|
"conda clean -y --all",
|
|
26
38
|
"conda install -y cuda -c nvidia/label/cuda-12.1.0",
|
|
27
39
|
]
|
|
40
|
+
// conda: {
|
|
41
|
+
// name: "base",
|
|
42
|
+
// activate: "minimal"
|
|
43
|
+
// }
|
|
28
44
|
}, ondata)
|
|
29
45
|
if (this.kernel.platform === "linux") {
|
|
30
46
|
await this.kernel.bin.exec({
|
package/kernel/bin/ffmpeg.js
CHANGED
|
@@ -3,15 +3,17 @@ const fetch = require('cross-fetch')
|
|
|
3
3
|
const { rimraf } = require('rimraf')
|
|
4
4
|
const decompress = require('decompress');
|
|
5
5
|
class Ffmpeg {
|
|
6
|
-
cmd() {
|
|
7
|
-
return "ffmpeg"
|
|
8
|
-
}
|
|
9
6
|
async install(req, ondata) {
|
|
10
7
|
await this.kernel.bin.exec({
|
|
11
8
|
message: [
|
|
12
9
|
"conda clean -y --all",
|
|
13
|
-
|
|
10
|
+
//"conda install -y -c conda-forge ffmpeg=5.1.2",
|
|
11
|
+
"conda install -y -c conda-forge ffmpeg"
|
|
14
12
|
]
|
|
13
|
+
// conda: {
|
|
14
|
+
// name: "base",
|
|
15
|
+
// activate: "minimal"
|
|
16
|
+
// }
|
|
15
17
|
}, ondata)
|
|
16
18
|
}
|
|
17
19
|
async installed() {
|
package/kernel/bin/git.js
CHANGED
|
@@ -4,69 +4,43 @@ const fetch = require('cross-fetch')
|
|
|
4
4
|
const { rimraf } = require('rimraf')
|
|
5
5
|
const path = require("path")
|
|
6
6
|
class Git {
|
|
7
|
-
cmd() {
|
|
8
|
-
if (this.kernel.platform === "darwin") {
|
|
9
|
-
return "git git-lfs"
|
|
10
|
-
} else {
|
|
11
|
-
return "git git-lfs gh"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
7
|
async install(req, ondata) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
conda
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"conda clean -y --all",
|
|
24
|
-
`conda install -y -c conda-forge ${this.cmd()}`
|
|
25
|
-
]
|
|
26
|
-
}, ondata)
|
|
27
|
-
}
|
|
28
|
-
await fs.promises.mkdir(this.kernel.path("config/gh"), { recursive: true }).catch((e) => { })
|
|
29
|
-
// if (this.kernel.platform === 'win32') {
|
|
30
|
-
// let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
|
|
31
|
-
// // check if gitconfig exists
|
|
32
|
-
// let exists = await this.kernel.api.exists(gitconfig_path)
|
|
33
|
-
// // if not, create one
|
|
34
|
-
// if (!exists) {
|
|
35
|
-
// await fs.promises.copyFile(
|
|
36
|
-
// path.resolve(__dirname, "..", "gitconfig_template"),
|
|
37
|
-
// gitconfig_path
|
|
38
|
-
// )
|
|
8
|
+
await this.kernel.bin.exec({
|
|
9
|
+
message: [
|
|
10
|
+
"conda clean -y --all",
|
|
11
|
+
"conda install --no-shortcuts -y -c conda-forge git git-lfs"
|
|
12
|
+
]
|
|
13
|
+
// conda: {
|
|
14
|
+
// name: "base",
|
|
15
|
+
// activate: "minimal"
|
|
39
16
|
// }
|
|
40
|
-
|
|
17
|
+
}, ondata)
|
|
18
|
+
if (this.kernel.platform === 'win32') {
|
|
19
|
+
let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
|
|
20
|
+
// check if gitconfig exists
|
|
21
|
+
let exists = await this.kernel.api.exists(gitconfig_path)
|
|
22
|
+
// if not, create one
|
|
23
|
+
if (!exists) {
|
|
24
|
+
await fs.promises.copyFile(
|
|
25
|
+
path.resolve(__dirname, "..", "gitconfig_template"),
|
|
26
|
+
gitconfig_path
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
41
30
|
}
|
|
42
31
|
async installed() {
|
|
43
|
-
|
|
44
|
-
let gh_config_exists = await this.kernel.exists("config/gh")
|
|
45
|
-
console.log("conda installed", this.kernel.bin.installed.conda)
|
|
46
|
-
return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.brew.has("gh") && gh_config_exists
|
|
47
|
-
} else {
|
|
48
|
-
let gh_config_exists = await this.kernel.exists("config/gh")
|
|
49
|
-
console.log("conda installed", this.kernel.bin.installed.conda)
|
|
50
|
-
return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("gh") && gh_config_exists
|
|
51
|
-
}
|
|
32
|
+
return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git")
|
|
52
33
|
}
|
|
53
34
|
async uninstall(req, ondata) {
|
|
54
|
-
|
|
55
|
-
await this.kernel.bin.exec({ message: "conda remove git" }, ondata)
|
|
56
|
-
await this.kernel.bin.exec({
|
|
57
|
-
conda: { skip: true },
|
|
58
|
-
message: "brew uninstall gh",
|
|
59
|
-
})
|
|
60
|
-
} else {
|
|
61
|
-
await this.kernel.bin.exec({ message: "conda remove git gh" }, ondata)
|
|
62
|
-
}
|
|
35
|
+
await this.kernel.bin.exec({ message: "conda remove git" }, ondata)
|
|
63
36
|
}
|
|
64
37
|
env() {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
38
|
+
// if (this.kernel.platform === 'win32') {
|
|
39
|
+
let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
|
|
40
|
+
return {
|
|
41
|
+
GIT_CONFIG_GLOBAL: gitconfig_path
|
|
42
|
+
}
|
|
43
|
+
// }
|
|
70
44
|
}
|
|
71
45
|
async requires() {
|
|
72
46
|
return ["conda"]
|
package/kernel/bin/gxx.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
class GXX {
|
|
2
|
-
cmd() {
|
|
3
|
-
if (this.kernel.platform === "linux") {
|
|
4
|
-
return "'gxx<12'"
|
|
5
|
-
} else {
|
|
6
|
-
return ""
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
2
|
async install(req, ondata) {
|
|
10
3
|
await this.kernel.bin.exec({
|
|
4
|
+
//message: "conda install -y nodejs=22.12.0 -c conda-forge"
|
|
11
5
|
message: [
|
|
12
6
|
"conda clean -y --all",
|
|
13
|
-
|
|
7
|
+
"conda install -y -c conda-forge 'gxx<12'"
|
|
14
8
|
]
|
|
9
|
+
// conda: {
|
|
10
|
+
// name: "base",
|
|
11
|
+
// activate: "minimal"
|
|
12
|
+
// }
|
|
15
13
|
}, ondata)
|
|
16
14
|
}
|
|
17
15
|
async installed() {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
class Huggingface {
|
|
2
|
-
cmd() {
|
|
3
|
-
return "huggingface_hub"
|
|
4
|
-
}
|
|
5
2
|
async install(req, ondata) {
|
|
6
3
|
await this.kernel.bin.exec({
|
|
7
4
|
message: [
|
|
8
5
|
"conda clean -y --all",
|
|
9
|
-
|
|
6
|
+
"conda install -y -c conda-forge huggingface_hub"
|
|
10
7
|
]
|
|
8
|
+
// conda: {
|
|
9
|
+
// name: "base",
|
|
10
|
+
// activate: "minimal"
|
|
11
|
+
// }
|
|
11
12
|
}, ondata)
|
|
12
13
|
}
|
|
13
14
|
async installed() {
|