pinokiod 7.2.17 → 7.3.0
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/Dockerfile +2 -0
- package/kernel/api/index.js +1 -42
- package/kernel/api/process/index.js +44 -99
- package/kernel/bin/conda-python.js +30 -0
- package/kernel/bin/conda.js +22 -3
- package/kernel/bin/index.js +11 -1
- package/kernel/environment.js +2 -182
- package/kernel/git.js +13 -0
- package/kernel/index.js +1 -64
- package/kernel/plugin.js +58 -6
- package/kernel/shell.js +2 -21
- package/kernel/util.js +0 -60
- package/package.json +1 -1
- package/server/index.js +149 -176
- package/server/lib/content_validation.js +25 -28
- package/server/public/common.js +29 -103
- package/server/public/create-launcher.js +31 -4
- package/server/public/electron.css +6 -0
- package/server/public/style.css +0 -337
- package/server/public/task-launcher.js +32 -5
- package/server/public/universal-launcher.js +26 -3
- package/server/socket.js +11 -22
- package/server/views/app.ejs +30 -167
- package/server/views/d.ejs +33 -0
- package/server/views/editor.ejs +4 -25
- package/server/views/partials/main_sidebar.ejs +0 -1
- package/server/views/shell.ejs +3 -11
- package/server/views/terminal.ejs +3 -23
- package/server/views/terminals.ejs +0 -1
- package/spec/INSTRUCTION_SYNC.md +5 -5
- package/kernel/api/shell_run_template.js +0 -273
- package/kernel/api/uri/index.js +0 -51
- package/kernel/plugin_sources.js +0 -236
- package/kernel/watch/context.js +0 -42
- package/kernel/watch/drivers/fs.js +0 -71
- package/kernel/watch/drivers/poll.js +0 -33
- package/kernel/watch/index.js +0 -158
- package/server/features/drafts/index.js +0 -41
- package/server/features/drafts/parser.js +0 -169
- package/server/features/drafts/public/drafts.js +0 -1504
- package/server/features/drafts/registry_import.js +0 -412
- package/server/features/drafts/routes.js +0 -68
- package/server/features/drafts/service.js +0 -261
- package/server/features/drafts/watcher.js +0 -76
- package/server/features/index.js +0 -13
- package/server/lib/workspace_catalog.js +0 -151
- package/server/lib/workspace_runtime.js +0 -390
- package/server/routes/workspaces.js +0 -44
- package/server/views/partials/workspace_row.ejs +0 -61
- package/server/views/workspaces.ejs +0 -812
- package/system/plugin/antigravity/antigravity.png +0 -0
- package/system/plugin/antigravity/pinokio.js +0 -37
- package/system/plugin/claude/claude.png +0 -0
- package/system/plugin/claude/pinokio.js +0 -63
- package/system/plugin/claude-auto/claude.png +0 -0
- package/system/plugin/claude-auto/pinokio.js +0 -74
- package/system/plugin/claude-desktop/icon.jpeg +0 -0
- package/system/plugin/claude-desktop/pinokio.js +0 -39
- package/system/plugin/codex/openai.webp +0 -0
- package/system/plugin/codex/pinokio.js +0 -58
- package/system/plugin/codex-auto/openai.webp +0 -0
- package/system/plugin/codex-auto/pinokio.js +0 -65
- package/system/plugin/codex-desktop/icon.png +0 -0
- package/system/plugin/codex-desktop/pinokio.js +0 -39
- package/system/plugin/crush/crush.png +0 -0
- package/system/plugin/crush/pinokio.js +0 -31
- package/system/plugin/cursor/cursor.jpeg +0 -0
- package/system/plugin/cursor/pinokio.js +0 -39
- package/system/plugin/gemini/gemini.jpeg +0 -0
- package/system/plugin/gemini/pinokio.js +0 -40
- package/system/plugin/gemini-auto/gemini.jpeg +0 -0
- package/system/plugin/gemini-auto/pinokio.js +0 -43
- package/system/plugin/qwen/pinokio.js +0 -50
- package/system/plugin/qwen/qwen.png +0 -0
- package/system/plugin/vscode/pinokio.js +0 -36
- package/system/plugin/vscode/vscode.png +0 -0
- package/system/plugin/windsurf/pinokio.js +0 -39
- package/system/plugin/windsurf/windsurf.png +0 -0
package/kernel/index.js
CHANGED
|
@@ -40,11 +40,9 @@ const Git = require('./git')
|
|
|
40
40
|
const Connect = require('./connect')
|
|
41
41
|
const Favicon = require('./favicon')
|
|
42
42
|
const AppLauncher = require('./app_launcher')
|
|
43
|
-
const WatchManager = require('./watch')
|
|
44
43
|
const { DownloaderHelper } = require('node-downloader-helper');
|
|
45
44
|
const { ProxyAgent } = require('proxy-agent');
|
|
46
45
|
const fakeUa = require('fake-useragent');
|
|
47
|
-
const sudo = process.platform === "win32" ? require("sudo-prompt-programfiles-x86") : null
|
|
48
46
|
//const kill = require('./tree-kill');
|
|
49
47
|
const kill = require('kill-sync')
|
|
50
48
|
const ejs = require('ejs');
|
|
@@ -56,37 +54,9 @@ const VARS = {
|
|
|
56
54
|
}
|
|
57
55
|
}
|
|
58
56
|
|
|
59
|
-
const powershellSingleQuote = (value) => {
|
|
60
|
-
return `'${String(value).replace(/'/g, "''")}'`
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const windowsCacheRepairCommand = (targetPath) => {
|
|
64
|
-
const psPath = powershellSingleQuote(targetPath)
|
|
65
|
-
return [
|
|
66
|
-
"powershell.exe",
|
|
67
|
-
"-NoProfile",
|
|
68
|
-
"-ExecutionPolicy Bypass",
|
|
69
|
-
"-Command",
|
|
70
|
-
`"`,
|
|
71
|
-
"$ErrorActionPreference = 'Stop';",
|
|
72
|
-
`$p = ${psPath};`,
|
|
73
|
-
"$account = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name;",
|
|
74
|
-
"$grant = $account + ':(OI)(CI)F';",
|
|
75
|
-
"if (Test-Path -LiteralPath $p) {",
|
|
76
|
-
" & takeown.exe /F $p /R /D Y;",
|
|
77
|
-
" & icacls.exe $p /reset /T /C;",
|
|
78
|
-
" & icacls.exe $p /grant $grant /T /C;",
|
|
79
|
-
" Remove-Item -LiteralPath $p -Recurse -Force;",
|
|
80
|
-
"}",
|
|
81
|
-
"New-Item -ItemType Directory -Force -Path $p | Out-Null;",
|
|
82
|
-
"& icacls.exe $p /grant $grant /T /C;",
|
|
83
|
-
`"`
|
|
84
|
-
].join(" ")
|
|
85
|
-
}
|
|
86
|
-
|
|
87
57
|
//const memwatch = require('@airbnb/node-memwatch');
|
|
88
58
|
class Kernel {
|
|
89
|
-
schema = "<=7.
|
|
59
|
+
schema = "<=7.0.0"
|
|
90
60
|
constructor(store) {
|
|
91
61
|
this.fetch = fetch
|
|
92
62
|
|
|
@@ -415,9 +385,6 @@ class Kernel {
|
|
|
415
385
|
path(...args) {
|
|
416
386
|
return path.resolve(this.homedir, ...args)
|
|
417
387
|
}
|
|
418
|
-
systemPath(...args) {
|
|
419
|
-
return path.resolve(__dirname, "..", "system", ...args)
|
|
420
|
-
}
|
|
421
388
|
exists(...args) {
|
|
422
389
|
if (args) {
|
|
423
390
|
let abspath = this.path(...args)
|
|
@@ -497,30 +464,6 @@ class Kernel {
|
|
|
497
464
|
return ''
|
|
498
465
|
}
|
|
499
466
|
}
|
|
500
|
-
async elevatedCacheRepair(targetPath, log = console.log) {
|
|
501
|
-
if (this.platform !== "win32" || !sudo) {
|
|
502
|
-
return { ok: false, error: new Error("Elevated cache repair is only available on Windows") }
|
|
503
|
-
}
|
|
504
|
-
const command = windowsCacheRepairCommand(targetPath)
|
|
505
|
-
log(`elevated repair command=${command}`)
|
|
506
|
-
return new Promise((resolve) => {
|
|
507
|
-
sudo.exec(command, { name: "Pinokio" }, (error, stdout, stderr) => {
|
|
508
|
-
if (stdout && stdout.trim()) {
|
|
509
|
-
log(`elevated repair stdout ${stdout.trim()}`)
|
|
510
|
-
}
|
|
511
|
-
if (stderr && stderr.trim()) {
|
|
512
|
-
log(`elevated repair stderr ${stderr.trim()}`)
|
|
513
|
-
}
|
|
514
|
-
if (error) {
|
|
515
|
-
log(`elevated repair failed ${error.message || error}`)
|
|
516
|
-
resolve({ ok: false, error, stdout, stderr })
|
|
517
|
-
} else {
|
|
518
|
-
log(`elevated repair ok path=${targetPath}`)
|
|
519
|
-
resolve({ ok: true, stdout, stderr })
|
|
520
|
-
}
|
|
521
|
-
})
|
|
522
|
-
})
|
|
523
|
-
}
|
|
524
467
|
async ensureRouterMode() {
|
|
525
468
|
const domain = await this.resolvePinokioDomain()
|
|
526
469
|
const shouldUseCustom = domain.length > 0
|
|
@@ -1032,7 +975,6 @@ class Kernel {
|
|
|
1032
975
|
this.loader = new Loader()
|
|
1033
976
|
this.bin = new Bin(this)
|
|
1034
977
|
this.api = new Api(this)
|
|
1035
|
-
this.watch = new WatchManager(this)
|
|
1036
978
|
this.python = new Python(this)
|
|
1037
979
|
this.shell = new Shells(this)
|
|
1038
980
|
this.appLauncher = new AppLauncher(this)
|
|
@@ -1063,7 +1005,6 @@ class Kernel {
|
|
|
1063
1005
|
args: {},
|
|
1064
1006
|
}
|
|
1065
1007
|
this.procs = {}
|
|
1066
|
-
this.activeProcessWaits = {}
|
|
1067
1008
|
this.template = new Template()
|
|
1068
1009
|
try {
|
|
1069
1010
|
if (this.homedir) {
|
|
@@ -1110,10 +1051,6 @@ class Kernel {
|
|
|
1110
1051
|
|
|
1111
1052
|
// 2. mkdir all the folders if not already created
|
|
1112
1053
|
await Environment.init_folders(this.homedir, this)
|
|
1113
|
-
await Environment.ensurePinokioCacheDirs(this, {
|
|
1114
|
-
throwOnFailure: true,
|
|
1115
|
-
elevatedRepair: this.elevatedCacheRepair.bind(this)
|
|
1116
|
-
})
|
|
1117
1054
|
|
|
1118
1055
|
// if key.json doesn't exist, create an empty json file
|
|
1119
1056
|
let ee = await this.exists(this.homedir, "key.json")
|
package/kernel/plugin.js
CHANGED
|
@@ -1,14 +1,39 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const { glob } = require('glob')
|
|
3
|
+
const Info = require("./info")
|
|
4
4
|
class Plugin {
|
|
5
5
|
constructor(kernel) {
|
|
6
6
|
this.kernel = kernel
|
|
7
7
|
}
|
|
8
8
|
async setConfig() {
|
|
9
|
+
let plugin_dir = path.resolve(this.kernel.homedir, "plugin")
|
|
9
10
|
this.cache = {}
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
let plugin_paths = await glob('**/pinokio.js', { cwd: plugin_dir })
|
|
13
|
+
|
|
14
|
+
let plugins = []
|
|
15
|
+
for(let plugin_path of plugin_paths) {
|
|
16
|
+
let config = await this.kernel.require(path.resolve(plugin_dir, plugin_path))
|
|
17
|
+
if (config && config.run && Array.isArray(config.run)) {
|
|
18
|
+
let invalid
|
|
19
|
+
for(let key in config) {
|
|
20
|
+
if (typeof config[key] === "function") {
|
|
21
|
+
invalid = true
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (invalid) {
|
|
25
|
+
continue
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let chunks = plugin_path.split(path.sep)
|
|
29
|
+
let cwd = chunks.slice(0, -1).join("/")
|
|
30
|
+
config.image = "/asset/plugin/" + cwd + "/" + config.icon
|
|
31
|
+
plugins.push({
|
|
32
|
+
href: "/run/plugin/" + chunks.join("/"),
|
|
33
|
+
...config
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
}
|
|
12
37
|
|
|
13
38
|
this.config = {
|
|
14
39
|
menu: plugins.map((plugin) => {
|
|
@@ -23,10 +48,37 @@ class Plugin {
|
|
|
23
48
|
if (!exists) {
|
|
24
49
|
await fs.promises.mkdir(this.kernel.path("plugin"), { recursive: true }).catch((e) => {})
|
|
25
50
|
}
|
|
26
|
-
await this.
|
|
51
|
+
let code_exists = await this.kernel.exists("plugin/code")
|
|
52
|
+
console.log({ code_exists })
|
|
53
|
+
if (!code_exists) {
|
|
54
|
+
if (this.kernel.bin.installed && this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git")) {
|
|
55
|
+
await this.kernel.exec({
|
|
56
|
+
//message: "git clone https://github.com/peanutcocktail/plugin",
|
|
57
|
+
//message: "git clone https://github.com/pinokiocomputer/plugin",
|
|
58
|
+
message: "git clone https://github.com/pinokiocomputer/code",
|
|
59
|
+
path: this.kernel.path("plugin")
|
|
60
|
+
}, (e) => {
|
|
61
|
+
process.stdout.write(e.raw)
|
|
62
|
+
})
|
|
63
|
+
await this.setConfig()
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
await this.setConfig()
|
|
68
|
+
}
|
|
27
69
|
}
|
|
28
70
|
async update() {
|
|
29
|
-
|
|
71
|
+
if (this.kernel.bin.installed && this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git")) {
|
|
72
|
+
let exists = await this.kernel.exists("plugin")
|
|
73
|
+
if (!exists) {
|
|
74
|
+
await this.kernel.exec({
|
|
75
|
+
message: "git pull",
|
|
76
|
+
path: this.kernel.path("plugin")
|
|
77
|
+
}, (e) => {
|
|
78
|
+
process.stdout.write(e.raw)
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
}
|
|
30
82
|
}
|
|
31
83
|
}
|
|
32
84
|
module.exports = Plugin
|
package/kernel/shell.js
CHANGED
|
@@ -20,7 +20,6 @@ const { applyWindowsNodePackageManagerEnv } = require('./windows_node_package_ma
|
|
|
20
20
|
const ShellParser = require('./shell_parser')
|
|
21
21
|
const AnsiStreamTracker = require('./ansi_stream_tracker')
|
|
22
22
|
const ShellStateSync = require('./shell_state_sync')
|
|
23
|
-
const ShellRunTemplate = require('./api/shell_run_template')
|
|
24
23
|
const home = os.homedir()
|
|
25
24
|
|
|
26
25
|
function normalizeComparablePath(filePath, platform) {
|
|
@@ -309,7 +308,7 @@ class Shell {
|
|
|
309
308
|
delete this.env[key]
|
|
310
309
|
}
|
|
311
310
|
let val = this.env[key]
|
|
312
|
-
if (
|
|
311
|
+
if (/[\r\n]/.test(val)) {
|
|
313
312
|
const replaced = val.replaceAll(/[\r\n]+/g, ' ');
|
|
314
313
|
this.env[key] = replaced
|
|
315
314
|
// delete this.env[key]
|
|
@@ -363,9 +362,6 @@ class Shell {
|
|
|
363
362
|
}
|
|
364
363
|
quoteArgForShell(value, shellName=this.shell) {
|
|
365
364
|
const input = value == null ? "" : String(value)
|
|
366
|
-
if (ShellRunTemplate.hasEnvArgMarker(input)) {
|
|
367
|
-
return ShellRunTemplate.quoteEnvArgComposite(input, shellName)
|
|
368
|
-
}
|
|
369
365
|
if (this.isCmdShell(shellName)) {
|
|
370
366
|
return `"${input.replace(/([()%!^"<>&|])/g, '^$1')}"`
|
|
371
367
|
}
|
|
@@ -413,7 +409,6 @@ class Shell {
|
|
|
413
409
|
this.userActive = false
|
|
414
410
|
this.decsyncBuffer = ''
|
|
415
411
|
this.stateSync.reset()
|
|
416
|
-
this.envArgsPreviewed = false
|
|
417
412
|
|
|
418
413
|
/*
|
|
419
414
|
params := {
|
|
@@ -545,9 +540,6 @@ class Shell {
|
|
|
545
540
|
//}
|
|
546
541
|
}
|
|
547
542
|
}
|
|
548
|
-
if (params._pinokio_cmd_delayed_expansion && this.isCmdShell(this.shell) && !this.args.includes("/V:ON")) {
|
|
549
|
-
this.args.push("/V:ON")
|
|
550
|
-
}
|
|
551
543
|
|
|
552
544
|
// 3. path => path can be http, relative, absolute
|
|
553
545
|
this.path = params.path
|
|
@@ -765,16 +757,6 @@ class Shell {
|
|
|
765
757
|
}
|
|
766
758
|
this.stateSync.invalidate({ clearTail: true })
|
|
767
759
|
}
|
|
768
|
-
emitEnvArgsPreview(params) {
|
|
769
|
-
if (!params || !Array.isArray(params._pinokio_env_args) || params._pinokio_env_args.length === 0 || this.envArgsPreviewed) {
|
|
770
|
-
return
|
|
771
|
-
}
|
|
772
|
-
this.envArgsPreviewed = true
|
|
773
|
-
const raw = ShellRunTemplate.formatEnvArgsPreview(params._pinokio_env_args)
|
|
774
|
-
if (raw && this.ondata) {
|
|
775
|
-
this.ondata({ raw })
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
760
|
async run(params, cb) {
|
|
779
761
|
let r = await this.request(params, cb)
|
|
780
762
|
return r
|
|
@@ -1380,7 +1362,6 @@ class Shell {
|
|
|
1380
1362
|
}
|
|
1381
1363
|
async exec(params) {
|
|
1382
1364
|
this.parser = new ShellParser()
|
|
1383
|
-
this.emitEnvArgsPreview(params)
|
|
1384
1365
|
params = await this.activate(params)
|
|
1385
1366
|
this.cmd = this.build(params)
|
|
1386
1367
|
let res = await new Promise((resolve, reject) => {
|
|
@@ -1748,7 +1729,7 @@ class Shell {
|
|
|
1748
1729
|
cmd: this.cmd,
|
|
1749
1730
|
index: this.index,
|
|
1750
1731
|
group: this.group,
|
|
1751
|
-
env:
|
|
1732
|
+
env: this.env,
|
|
1752
1733
|
done: this.done,
|
|
1753
1734
|
ready: this.ready,
|
|
1754
1735
|
id: this.id,
|
package/kernel/util.js
CHANGED
|
@@ -434,65 +434,6 @@ const openURL = (url) => {
|
|
|
434
434
|
console.warn('[Util.openURL] exec failed:', err && err.message ? err.message : err)
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
|
-
const openURI = async (uri) => {
|
|
438
|
-
const platform = os.platform()
|
|
439
|
-
const launch = (command, args) => {
|
|
440
|
-
return new Promise((resolve, reject) => {
|
|
441
|
-
let settled = false
|
|
442
|
-
const settle = (fn, value) => {
|
|
443
|
-
if (settled) return
|
|
444
|
-
settled = true
|
|
445
|
-
clearTimeout(timer)
|
|
446
|
-
fn(value)
|
|
447
|
-
}
|
|
448
|
-
const timer = setTimeout(() => {
|
|
449
|
-
settle(resolve, {
|
|
450
|
-
ok: true,
|
|
451
|
-
command,
|
|
452
|
-
status: 'started'
|
|
453
|
-
})
|
|
454
|
-
}, 3000)
|
|
455
|
-
const child = spawn(command, args, {
|
|
456
|
-
detached: true,
|
|
457
|
-
stdio: 'ignore'
|
|
458
|
-
})
|
|
459
|
-
child.on('error', (error) => {
|
|
460
|
-
settle(reject, error)
|
|
461
|
-
})
|
|
462
|
-
child.on('close', (code) => {
|
|
463
|
-
if (code) {
|
|
464
|
-
settle(reject, new Error(`${command} exited with code ${code}`))
|
|
465
|
-
} else {
|
|
466
|
-
settle(resolve, {
|
|
467
|
-
ok: true,
|
|
468
|
-
command,
|
|
469
|
-
status: 'exited'
|
|
470
|
-
})
|
|
471
|
-
}
|
|
472
|
-
})
|
|
473
|
-
child.unref()
|
|
474
|
-
})
|
|
475
|
-
}
|
|
476
|
-
try {
|
|
477
|
-
if (platform === 'darwin') {
|
|
478
|
-
return await launch('open', [uri])
|
|
479
|
-
} else if (platform === 'win32') {
|
|
480
|
-
try {
|
|
481
|
-
return await launch('rundll32.exe', ['url.dll,FileProtocolHandler', uri])
|
|
482
|
-
} catch (error) {
|
|
483
|
-
console.warn('[Util.openURI] rundll32 failed, falling back to explorer:', error && error.message ? error.message : error)
|
|
484
|
-
return await launch('explorer.exe', [uri])
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
return await launch('xdg-open', [uri])
|
|
488
|
-
} catch (err) {
|
|
489
|
-
console.warn('[Util.openURI] spawn failed:', err && err.message ? err.message : err)
|
|
490
|
-
return {
|
|
491
|
-
ok: false,
|
|
492
|
-
error: err && err.message ? err.message : String(err)
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
437
|
const openfs = (dirPath, options, kernel) => {
|
|
497
438
|
let command = '';
|
|
498
439
|
const platform = os.platform()
|
|
@@ -1256,7 +1197,6 @@ module.exports = {
|
|
|
1256
1197
|
find_venv,
|
|
1257
1198
|
fill_object,
|
|
1258
1199
|
run,
|
|
1259
|
-
openURI,
|
|
1260
1200
|
openURL,
|
|
1261
1201
|
u2p,
|
|
1262
1202
|
p2u,
|