pinokiod 7.3.1 → 7.3.4

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.
Files changed (122) hide show
  1. package/kernel/api/github/index.js +444 -0
  2. package/kernel/api/index.js +199 -11
  3. package/kernel/api/process/index.js +124 -44
  4. package/kernel/api/shell_run_template.js +273 -0
  5. package/kernel/api/uri/index.js +51 -0
  6. package/kernel/bin/git.js +9 -10
  7. package/kernel/bin/huggingface.js +1 -1
  8. package/kernel/bin/zip.js +9 -1
  9. package/kernel/connect/providers/github/README.md +5 -4
  10. package/kernel/environment.js +195 -92
  11. package/kernel/git.js +126 -19
  12. package/kernel/gitconfig_template +7 -0
  13. package/kernel/gpu/amd.js +72 -0
  14. package/kernel/gpu/apple.js +8 -0
  15. package/kernel/gpu/common.js +12 -0
  16. package/kernel/gpu/intel.js +47 -0
  17. package/kernel/gpu/nvidia.js +8 -0
  18. package/kernel/index.js +11 -1
  19. package/kernel/managed_skills.js +871 -0
  20. package/kernel/plugin.js +6 -58
  21. package/kernel/plugin_sources.js +316 -0
  22. package/kernel/resource_usage/gpu.js +349 -0
  23. package/kernel/resource_usage/index.js +322 -0
  24. package/kernel/resource_usage/macos_footprint.js +197 -0
  25. package/kernel/resource_usage/preferences.js +92 -0
  26. package/kernel/resource_usage/process_tree.js +303 -0
  27. package/kernel/scripts/git/create +4 -4
  28. package/kernel/scripts/git/fork +7 -8
  29. package/kernel/shell.js +23 -2
  30. package/kernel/shells.js +41 -0
  31. package/kernel/sysinfo.js +62 -9
  32. package/kernel/util.js +60 -0
  33. package/package.json +1 -1
  34. package/server/index.js +984 -156
  35. package/server/lib/app_log_report.js +543 -0
  36. package/server/lib/content_validation.js +55 -33
  37. package/server/lib/launcher_instruction_bootstrap.js +4 -96
  38. package/server/lib/terminal_session_helpers.js +0 -3
  39. package/server/public/common.js +77 -31
  40. package/server/public/create-launcher.js +4 -32
  41. package/server/public/logs.js +1428 -0
  42. package/server/public/nav.js +7 -0
  43. package/server/public/plugin-detail.js +93 -10
  44. package/server/public/privacy_filter_worker.js +391 -0
  45. package/server/public/style.css +1104 -154
  46. package/server/public/task-launcher.js +8 -29
  47. package/server/public/universal-launcher.css +8 -6
  48. package/server/public/universal-launcher.js +3 -27
  49. package/server/routes/apps.js +195 -1
  50. package/server/views/app.ejs +3041 -717
  51. package/server/views/autolaunch.ejs +917 -0
  52. package/server/views/bootstrap.ejs +7 -1
  53. package/server/views/d.ejs +408 -65
  54. package/server/views/editor.ejs +85 -19
  55. package/server/views/index.ejs +661 -111
  56. package/server/views/init/index.ejs +1 -1
  57. package/server/views/install.ejs +1 -1
  58. package/server/views/logs.ejs +164 -86
  59. package/server/views/net.ejs +7 -1
  60. package/server/views/partials/d_terminal_column.ejs +2 -2
  61. package/server/views/partials/d_terminal_options.ejs +0 -8
  62. package/server/views/partials/fs_status.ejs +47 -0
  63. package/server/views/partials/home_action_modal.ejs +86 -0
  64. package/server/views/partials/home_run_menu.ejs +87 -0
  65. package/server/views/partials/main_sidebar.ejs +2 -0
  66. package/server/views/partials/menu.ejs +1 -1
  67. package/server/views/plugin_detail.ejs +19 -4
  68. package/server/views/plugins.ejs +201 -3
  69. package/server/views/pre.ejs +1 -1
  70. package/server/views/pro.ejs +1 -1
  71. package/server/views/shell.ejs +40 -18
  72. package/server/views/skills.ejs +506 -0
  73. package/server/views/terminal.ejs +45 -19
  74. package/spec/INSTRUCTION_SYNC.md +20 -10
  75. package/system/plugin/antigravity-cli/antigravity.png +0 -0
  76. package/system/plugin/antigravity-cli/common.js +155 -0
  77. package/system/plugin/antigravity-cli/install.js +272 -0
  78. package/system/plugin/antigravity-cli/pinokio.js +13 -0
  79. package/system/plugin/antigravity-cli-auto/antigravity.png +0 -0
  80. package/system/plugin/antigravity-cli-auto/pinokio.js +13 -0
  81. package/system/plugin/claude/claude.png +0 -0
  82. package/system/plugin/claude/pinokio.js +47 -0
  83. package/system/plugin/claude-auto/claude.png +0 -0
  84. package/system/plugin/claude-auto/pinokio.js +58 -0
  85. package/system/plugin/claude-desktop/icon.jpeg +0 -0
  86. package/system/plugin/claude-desktop/pinokio.js +23 -0
  87. package/system/plugin/codex/openai.webp +0 -0
  88. package/system/plugin/codex/pinokio.js +42 -0
  89. package/system/plugin/codex-auto/openai.webp +0 -0
  90. package/system/plugin/codex-auto/pinokio.js +49 -0
  91. package/system/plugin/codex-desktop/icon.png +0 -0
  92. package/system/plugin/codex-desktop/pinokio.js +23 -0
  93. package/system/plugin/crush/crush.png +0 -0
  94. package/system/plugin/crush/pinokio.js +15 -0
  95. package/system/plugin/cursor/cursor.jpeg +0 -0
  96. package/system/plugin/cursor/pinokio.js +23 -0
  97. package/system/plugin/qwen/pinokio.js +34 -0
  98. package/system/plugin/qwen/qwen.png +0 -0
  99. package/system/plugin/vscode/pinokio.js +20 -0
  100. package/system/plugin/vscode/vscode.png +0 -0
  101. package/system/plugin/windsurf/pinokio.js +23 -0
  102. package/system/plugin/windsurf/windsurf.png +0 -0
  103. package/test/antigravity-cli-plugin.test.js +185 -0
  104. package/test/app-api.test.js +239 -0
  105. package/test/app-log-report.test.js +67 -0
  106. package/test/environment-cache-preflight.test.js +98 -0
  107. package/test/git-bin.test.js +59 -0
  108. package/test/git-defaults.test.js +150 -0
  109. package/test/github-api.test.js +158 -0
  110. package/test/github-connection.test.js +117 -0
  111. package/test/huggingface-bin.test.js +25 -0
  112. package/test/managed-skills.test.js +351 -0
  113. package/test/plugin-action-functions.test.js +337 -0
  114. package/test/plugin-dev-iframe.test.js +17 -0
  115. package/test/plugin-sources.test.js +203 -0
  116. package/test/privacy-filter-worker-heuristics.test.js +69 -0
  117. package/test/process-wait.test.js +169 -0
  118. package/test/script-api.test.js +97 -0
  119. package/test/shell-api.test.js +134 -0
  120. package/test/shell-run-template.test.js +209 -0
  121. package/test/storage-api.test.js +137 -0
  122. package/test/uri-api.test.js +100 -0
package/kernel/shell.js CHANGED
@@ -20,6 +20,7 @@ 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')
23
24
  const home = os.homedir()
24
25
 
25
26
  function normalizeComparablePath(filePath, platform) {
@@ -293,6 +294,8 @@ class Shell {
293
294
  }
294
295
  }
295
296
 
297
+ setDefaultEnvValue(this.env, "HF_HUB_DISABLE_UPDATE_CHECK", "1")
298
+
296
299
  if (this.platform === "win32") {
297
300
  // Hugging Face file symlinks regularly fail on non-admin Windows setups.
298
301
  // Default to no-symlink cache mode unless the user/app explicitly overrides it.
@@ -308,7 +311,7 @@ class Shell {
308
311
  delete this.env[key]
309
312
  }
310
313
  let val = this.env[key]
311
- if (/[\r\n]/.test(val)) {
314
+ if (!ShellRunTemplate.isPinokioEnvArgKey(key) && /[\r\n]/.test(val)) {
312
315
  const replaced = val.replaceAll(/[\r\n]+/g, ' ');
313
316
  this.env[key] = replaced
314
317
  // delete this.env[key]
@@ -362,6 +365,9 @@ class Shell {
362
365
  }
363
366
  quoteArgForShell(value, shellName=this.shell) {
364
367
  const input = value == null ? "" : String(value)
368
+ if (ShellRunTemplate.hasEnvArgMarker(input)) {
369
+ return ShellRunTemplate.quoteEnvArgComposite(input, shellName)
370
+ }
365
371
  if (this.isCmdShell(shellName)) {
366
372
  return `"${input.replace(/([()%!^"<>&|])/g, '^$1')}"`
367
373
  }
@@ -409,6 +415,7 @@ class Shell {
409
415
  this.userActive = false
410
416
  this.decsyncBuffer = ''
411
417
  this.stateSync.reset()
418
+ this.envArgsPreviewed = false
412
419
 
413
420
  /*
414
421
  params := {
@@ -540,6 +547,9 @@ class Shell {
540
547
  //}
541
548
  }
542
549
  }
550
+ if (params._pinokio_cmd_delayed_expansion && this.isCmdShell(this.shell) && !this.args.includes("/V:ON")) {
551
+ this.args.push("/V:ON")
552
+ }
543
553
 
544
554
  // 3. path => path can be http, relative, absolute
545
555
  this.path = params.path
@@ -757,6 +767,16 @@ class Shell {
757
767
  }
758
768
  this.stateSync.invalidate({ clearTail: true })
759
769
  }
770
+ emitEnvArgsPreview(params) {
771
+ if (!params || !Array.isArray(params._pinokio_env_args) || params._pinokio_env_args.length === 0 || this.envArgsPreviewed) {
772
+ return
773
+ }
774
+ this.envArgsPreviewed = true
775
+ const raw = ShellRunTemplate.formatEnvArgsPreview(params._pinokio_env_args)
776
+ if (raw && this.ondata) {
777
+ this.ondata({ raw })
778
+ }
779
+ }
760
780
  async run(params, cb) {
761
781
  let r = await this.request(params, cb)
762
782
  return r
@@ -1362,6 +1382,7 @@ class Shell {
1362
1382
  }
1363
1383
  async exec(params) {
1364
1384
  this.parser = new ShellParser()
1385
+ this.emitEnvArgsPreview(params)
1365
1386
  params = await this.activate(params)
1366
1387
  this.cmd = this.build(params)
1367
1388
  let res = await new Promise((resolve, reject) => {
@@ -1729,7 +1750,7 @@ class Shell {
1729
1750
  cmd: this.cmd,
1730
1751
  index: this.index,
1731
1752
  group: this.group,
1732
- env: this.env,
1753
+ env: ShellRunTemplate.redactEnvArgs(this.env),
1733
1754
  done: this.done,
1734
1755
  ready: this.ready,
1735
1756
  id: this.id,
package/kernel/shells.js CHANGED
@@ -96,6 +96,47 @@ class Shells {
96
96
  }
97
97
  })
98
98
  }
99
+ isPathWithin(parentPath, childPath) {
100
+ if (!parentPath || !childPath) {
101
+ return false
102
+ }
103
+ const relative = path.relative(parentPath, childPath)
104
+ if (!relative) {
105
+ return true
106
+ }
107
+ return !relative.startsWith("..") && !path.isAbsolute(relative)
108
+ }
109
+ resourceRootsByWorkspace(apiRoot) {
110
+ if (typeof apiRoot !== "string" || !apiRoot) {
111
+ return new Map()
112
+ }
113
+ const groups = new Map()
114
+ const normalizedApiRoot = path.resolve(apiRoot)
115
+ for (const shell of this.shells) {
116
+ if (!shell || shell.done || !shell.ptyProcess || !shell.ptyProcess.pid) {
117
+ continue
118
+ }
119
+ const shellPath = typeof shell.path === "string" && shell.path ? path.resolve(shell.path) : ""
120
+ if (!shellPath || !this.isPathWithin(normalizedApiRoot, shellPath)) {
121
+ continue
122
+ }
123
+ const relative = path.relative(normalizedApiRoot, shellPath)
124
+ const workspaceName = relative.split(path.sep).filter(Boolean)[0]
125
+ if (!workspaceName) {
126
+ continue
127
+ }
128
+ if (!groups.has(workspaceName)) {
129
+ groups.set(workspaceName, [])
130
+ }
131
+ groups.get(workspaceName).push({
132
+ id: shell.id,
133
+ group: shell.group,
134
+ path: shellPath,
135
+ pid: shell.ptyProcess.pid
136
+ })
137
+ }
138
+ return groups
139
+ }
99
140
  async ensureBracketedPasteSupport(shellName) {
100
141
  if (!shellName) {
101
142
  return
package/kernel/sysinfo.js CHANGED
@@ -1,6 +1,10 @@
1
1
  const system = require('systeminformation')
2
2
  const fs = require('fs')
3
3
  const path = require('path')
4
+ const nvidia = require("./gpu/nvidia")
5
+ const amd = require("./gpu/amd")
6
+ const apple = require("./gpu/apple")
7
+ const intel = require("./gpu/intel")
4
8
  class Sysinfo {
5
9
  async init(kernel) {
6
10
  this.kernel = kernel
@@ -52,21 +56,33 @@ class Sysinfo {
52
56
  gpus = []
53
57
  }
54
58
 
55
- let is_nvidia = gpus.find(gpu => /nvidia/i.test(gpu.name))
56
- let is_amd = gpus.find(gpu => /(amd|advanced micro devices)/i.test(gpu.name))
57
- let is_apple = gpus.find(gpu => /apple/i.test(gpu.name))
59
+ let bestByVram = (items) => {
60
+ return items.reduce((best, item) => {
61
+ let bestVram = Number(best && best.vram) || 0
62
+ let itemVram = Number(item && item.vram) || 0
63
+ return itemVram > bestVram ? item : best
64
+ }, items[0])
65
+ }
66
+ let model = (controller) => {
67
+ return (controller && controller.model ? controller.model : "").toLowerCase()
68
+ }
69
+
70
+ let is_nvidia = controllers.find(x => /nvidia/i.test(x.vendor || ""))
71
+ let is_amd = bestByVram(controllers.filter(x => /(amd|advanced micro devices)/i.test(x.vendor || "")))
72
+ let is_apple = controllers.find(x => /apple/i.test(x.vendor || ""))
73
+ let is_intel = controllers.find(x => /intel/i.test(x.vendor || ""))
58
74
 
59
75
  let gpu
60
76
  let gpu_model
61
77
  if (is_nvidia) {
62
78
  gpu = "nvidia"
63
- gpu_model = is_nvidia.model
79
+ gpu_model = model(is_nvidia)
64
80
  } else if (is_amd) {
65
81
  gpu = "amd"
66
- gpu_model = is_amd.model
82
+ gpu_model = model(is_amd)
67
83
  } else if (is_apple) {
68
84
  gpu = "apple"
69
- gpu_model = is_apple.model
85
+ gpu_model = model(is_apple)
70
86
  } else if (gpus.length > 0) {
71
87
  gpu = gpus[0].name
72
88
  gpu_model = gpus[0].model
@@ -76,24 +92,61 @@ class Sysinfo {
76
92
 
77
93
  let primaryController
78
94
  if (is_nvidia) {
79
- primaryController = controllers.find(x => /nvidia/i.test(x.vendor || ""))
95
+ primaryController = is_nvidia
80
96
  } else if (is_amd) {
81
- primaryController = controllers.find(x => /(amd|advanced micro devices)/i.test(x.vendor || ""))
97
+ primaryController = is_amd
82
98
  } else if (is_apple) {
83
- primaryController = controllers.find(x => /apple/i.test(x.vendor || ""))
99
+ primaryController = is_apple
84
100
  } else if (controllers.length > 0) {
85
101
  primaryController = controllers[0]
86
102
  }
87
103
 
88
104
  let vramMB = primaryController && primaryController.vram ? primaryController.vram : 0
89
105
  let vramGB = vramMB > 0 ? Math.round(vramMB / 1024) : 0
106
+ let torch_backend = await this.torch_backend({ is_nvidia, is_amd, is_apple, is_intel, gpu_model })
90
107
 
91
108
  this.info.graphics = g
92
109
  this.info.gpus = gpus
93
110
  this.info.gpu = gpu
94
111
  this.info.gpu_model = gpu_model
112
+ this.info.torch_backend = torch_backend
95
113
  this.info.vram = vramGB
96
114
  }
115
+ // Read CPU brand only when generic iGPU names need CPU fallback matching.
116
+ async cpu_brand() {
117
+ let cpu = this.info.cpu
118
+ if (!cpu) {
119
+ try {
120
+ cpu = await system.cpu()
121
+ } catch (e) {
122
+ cpu = null
123
+ }
124
+ }
125
+ return cpu && cpu.brand
126
+ }
127
+ // Select the PyTorch backend install target from detected hardware identity.
128
+ async torch_backend(detected) {
129
+ // Do not require runtime probes such as rocminfo, hipInfo, ze_info, or
130
+ // an existing torch install here.
131
+ if (nvidia.supports_torch_backend(detected.is_nvidia, process.platform)) {
132
+ return "cuda"
133
+ } else if (apple.supports_torch_backend(detected.is_apple, process.platform)) {
134
+ return "mps"
135
+ } else if (
136
+ detected.is_amd &&
137
+ process.platform !== "darwin" &&
138
+ await amd.supports_torch_backend(detected.gpu_model, () => this.cpu_brand())
139
+ ) {
140
+ return "rocm"
141
+ } else if (
142
+ detected.is_intel &&
143
+ await intel.supports_torch_backend(detected.is_intel.model, () => this.cpu_brand())
144
+ ) {
145
+ return "xpu"
146
+ } else {
147
+ return "cpu"
148
+ }
149
+ }
97
150
  // async time() {
98
151
  // this.info.time = await system.time()
99
152
  // }
package/kernel/util.js CHANGED
@@ -434,6 +434,65 @@ 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
+ }
437
496
  const openfs = (dirPath, options, kernel) => {
438
497
  let command = '';
439
498
  const platform = os.platform()
@@ -1197,6 +1256,7 @@ module.exports = {
1197
1256
  find_venv,
1198
1257
  fill_object,
1199
1258
  run,
1259
+ openURI,
1200
1260
  openURL,
1201
1261
  u2p,
1202
1262
  p2u,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "7.3.1",
3
+ "version": "7.3.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {