pinokiod 7.3.1 → 7.3.3

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 +98 -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 +97 -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
@@ -0,0 +1,273 @@
1
+ function isCmdShellName(shellName) {
2
+ const name = (shellName || '').toLowerCase()
3
+ return name.includes('cmd.exe') || name === 'cmd'
4
+ }
5
+
6
+ function isPowerShellName(shellName) {
7
+ const name = (shellName || '').toLowerCase()
8
+ return name.includes('powershell') || name.includes('pwsh')
9
+ }
10
+
11
+ const ENV_ARG_MARKER_RE = /__PINOKIO_ENVARG_(\d+)__/g
12
+
13
+ function envArgMarker(index) {
14
+ return `__PINOKIO_ENVARG_${index}__`
15
+ }
16
+
17
+ function isPinokioEnvArgKey(key) {
18
+ return /^PINOKIO_ARG_\d+$/.test(key || "")
19
+ }
20
+
21
+ function hasEnvArgMarker(value) {
22
+ ENV_ARG_MARKER_RE.lastIndex = 0
23
+ return ENV_ARG_MARKER_RE.test(String(value))
24
+ }
25
+
26
+ function quotePosixLiteral(value) {
27
+ const input = value == null ? "" : String(value)
28
+ return `'${input.split("'").join("'\"'\"'")}'`
29
+ }
30
+
31
+ function quotePowerShellComposite(value) {
32
+ const input = value == null ? "" : String(value)
33
+ ENV_ARG_MARKER_RE.lastIndex = 0
34
+ let output = '"'
35
+ let lastIndex = 0
36
+ for (const match of input.matchAll(ENV_ARG_MARKER_RE)) {
37
+ const literal = input.slice(lastIndex, match.index)
38
+ output += literal.replace(/[`"$]/g, (char) => "`" + char)
39
+ output += "${env:PINOKIO_ARG_" + match[1] + "}"
40
+ lastIndex = match.index + match[0].length
41
+ }
42
+ output += input.slice(lastIndex).replace(/[`"$]/g, (char) => "`" + char)
43
+ output += '"'
44
+ return output
45
+ }
46
+
47
+ function quoteCmdComposite(value) {
48
+ const input = value == null ? "" : String(value)
49
+ ENV_ARG_MARKER_RE.lastIndex = 0
50
+ let output = '"'
51
+ let lastIndex = 0
52
+ for (const match of input.matchAll(ENV_ARG_MARKER_RE)) {
53
+ const literal = input.slice(lastIndex, match.index)
54
+ output += literal.replace(/([()%!^"<>&|])/g, '^$1')
55
+ output += "!PINOKIO_ARG_" + match[1] + "!"
56
+ lastIndex = match.index + match[0].length
57
+ }
58
+ output += input.slice(lastIndex).replace(/([()%!^"<>&|])/g, '^$1')
59
+ output += '"'
60
+ return output
61
+ }
62
+
63
+ function quoteEnvArgComposite(value, shellName) {
64
+ const input = value == null ? "" : String(value)
65
+ if (isCmdShellName(shellName)) {
66
+ return quoteCmdComposite(input)
67
+ }
68
+ if (isPowerShellName(shellName)) {
69
+ return quotePowerShellComposite(input)
70
+ }
71
+
72
+ ENV_ARG_MARKER_RE.lastIndex = 0
73
+ const parts = []
74
+ let lastIndex = 0
75
+ for (const match of input.matchAll(ENV_ARG_MARKER_RE)) {
76
+ const literal = input.slice(lastIndex, match.index)
77
+ if (literal) {
78
+ parts.push(quotePosixLiteral(literal))
79
+ }
80
+ parts.push('"$PINOKIO_ARG_' + match[1] + '"')
81
+ lastIndex = match.index + match[0].length
82
+ }
83
+ const tail = input.slice(lastIndex)
84
+ if (tail) {
85
+ parts.push(quotePosixLiteral(tail))
86
+ }
87
+ return parts.length > 0 ? parts.join("") : "''"
88
+ }
89
+
90
+ function shellNameFor(kernel, params) {
91
+ let shellName = kernel && kernel.platform === "win32" ? "cmd.exe" : "bash"
92
+ if (params && typeof params.shell === "string" && params.shell.trim()) {
93
+ shellName = params.shell
94
+ }
95
+ return shellName
96
+ }
97
+
98
+ function isPlainObject(value) {
99
+ return value && value.constructor === Object
100
+ }
101
+
102
+ function hasMultiline(value) {
103
+ return typeof value === "string" && /[\r\n]/.test(value)
104
+ }
105
+
106
+ function isStructuredArgvMessage(value) {
107
+ return isPlainObject(value) && Array.isArray(value._)
108
+ }
109
+
110
+ function hasStructuredArgvMessage(value) {
111
+ if (isStructuredArgvMessage(value)) {
112
+ return true
113
+ }
114
+ if (Array.isArray(value)) {
115
+ return value.some((item) => isStructuredArgvMessage(item))
116
+ }
117
+ return false
118
+ }
119
+
120
+ function protectStructuredString(value, state) {
121
+ if (!hasMultiline(value)) {
122
+ return value
123
+ }
124
+ const name = `PINOKIO_ARG_${state.args.length}`
125
+ state.args.push({
126
+ name,
127
+ value: value == null ? "" : String(value)
128
+ })
129
+ return envArgMarker(state.args.length - 1)
130
+ }
131
+
132
+ function protectStructuredValue(value, state) {
133
+ if (typeof value === "string") {
134
+ return protectStructuredString(value, state)
135
+ }
136
+ if (Array.isArray(value)) {
137
+ return value.map((item) => protectStructuredValue(item, state))
138
+ }
139
+ if (isPlainObject(value)) {
140
+ const rendered = {}
141
+ for (const [key, item] of Object.entries(value)) {
142
+ rendered[key] = protectStructuredValue(item, state)
143
+ }
144
+ return rendered
145
+ }
146
+ return value
147
+ }
148
+
149
+ function protectStructuredMessage(value, state) {
150
+ if (isStructuredArgvMessage(value)) {
151
+ return protectStructuredValue(value, state)
152
+ }
153
+ if (Array.isArray(value)) {
154
+ return value.map((item) => isStructuredArgvMessage(item) ? protectStructuredValue(item, state) : item)
155
+ }
156
+ return value
157
+ }
158
+
159
+ function renderEnvArgs(kernel, rpc, memory) {
160
+ if (!rpc || rpc.method !== "shell.run" || !rpc.params || !hasStructuredArgvMessage(rpc.params.message)) {
161
+ return rpc
162
+ }
163
+
164
+ const shellName = shellNameFor(kernel, rpc.params)
165
+ const state = { args: [] }
166
+ const message = protectStructuredMessage(rpc.params.message, state)
167
+
168
+ if (state.args.length === 0) {
169
+ return rpc
170
+ }
171
+
172
+ const env = Object.assign({}, rpc.params.env || {})
173
+ for (const arg of state.args) {
174
+ env[arg.name] = arg.value
175
+ }
176
+
177
+ return {
178
+ ...rpc,
179
+ params: {
180
+ ...rpc.params,
181
+ message,
182
+ env,
183
+ _pinokio_env_args: state.args,
184
+ _pinokio_cmd_delayed_expansion: isCmdShellName(shellName)
185
+ }
186
+ }
187
+ }
188
+
189
+ function envArgDetails(value) {
190
+ const normalized = String(value == null ? "" : value)
191
+ .replace(/\r\n/g, "\n")
192
+ .replace(/\r/g, "\n")
193
+ .replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, "?")
194
+ const lines = normalized.split("\n")
195
+ const previewLines = []
196
+ const maxLines = 8
197
+ const maxChars = 800
198
+ let used = 0
199
+
200
+ for (const line of lines.slice(0, maxLines)) {
201
+ const remaining = maxChars - used
202
+ if (remaining <= 0) {
203
+ break
204
+ }
205
+ if (line.length > remaining) {
206
+ previewLines.push(line.slice(0, remaining) + "...")
207
+ used = maxChars
208
+ break
209
+ }
210
+ previewLines.push(line)
211
+ used += line.length + 1
212
+ }
213
+
214
+ const preview = previewLines.join("\n")
215
+ const truncated = lines.length > previewLines.length || normalized.length > preview.length
216
+ if (truncated && previewLines[previewLines.length - 1] !== "...") {
217
+ previewLines.push("...")
218
+ }
219
+
220
+ return {
221
+ lineCount: normalized.length === 0 ? 0 : lines.length,
222
+ previewLines,
223
+ truncated
224
+ }
225
+ }
226
+
227
+ function formatEnvArgsPreview(args) {
228
+ if (!Array.isArray(args) || args.length === 0) {
229
+ return ""
230
+ }
231
+ const lines = ["\r\nPinokio shell args", ""]
232
+ for (const arg of args) {
233
+ const details = envArgDetails(arg.value)
234
+ lines.push(`${arg.name} ${details.lineCount} lines`)
235
+ for (const previewLine of details.previewLines) {
236
+ lines.push(` ${previewLine}`)
237
+ }
238
+ lines.push("")
239
+ }
240
+ return lines.join("\r\n") + "\r\n"
241
+ }
242
+
243
+ function envArgSummary(value) {
244
+ const details = envArgDetails(value)
245
+ return {
246
+ type: "pinokio env arg",
247
+ lines: details.lineCount,
248
+ preview: details.previewLines.join("\n"),
249
+ truncated: details.truncated
250
+ }
251
+ }
252
+
253
+ function redactEnvArgs(env) {
254
+ if (!env || typeof env !== "object") {
255
+ return env
256
+ }
257
+ const redacted = { ...env }
258
+ for (const key of Object.keys(redacted)) {
259
+ if (isPinokioEnvArgKey(key)) {
260
+ redacted[key] = envArgSummary(redacted[key])
261
+ }
262
+ }
263
+ return redacted
264
+ }
265
+
266
+ module.exports = {
267
+ renderEnvArgs,
268
+ quoteEnvArgComposite,
269
+ hasEnvArgMarker,
270
+ isPinokioEnvArgKey,
271
+ formatEnvArgsPreview,
272
+ redactEnvArgs
273
+ }
@@ -0,0 +1,51 @@
1
+ const Util = require('../../util')
2
+
3
+ const appendQueryParams = (uri, params) => {
4
+ if (!params || typeof params !== 'object' || Array.isArray(params)) {
5
+ return uri
6
+ }
7
+
8
+ const entries = []
9
+ for (const [key, value] of Object.entries(params)) {
10
+ const values = Array.isArray(value) ? value : [value]
11
+ for (const item of values) {
12
+ if (item === undefined || item === null) {
13
+ continue
14
+ }
15
+ const serialized = typeof item === 'object' ? JSON.stringify(item) : String(item)
16
+ entries.push(`${encodeURIComponent(key)}=${encodeURIComponent(serialized)}`)
17
+ }
18
+ }
19
+
20
+ if (entries.length === 0) {
21
+ return uri
22
+ }
23
+
24
+ const hashIndex = uri.indexOf('#')
25
+ const base = hashIndex === -1 ? uri : uri.slice(0, hashIndex)
26
+ const hash = hashIndex === -1 ? '' : uri.slice(hashIndex)
27
+ const separator = base.includes('?')
28
+ ? (base.endsWith('?') || base.endsWith('&') ? '' : '&')
29
+ : '?'
30
+
31
+ return `${base}${separator}${entries.join('&')}${hash}`
32
+ }
33
+
34
+ class URI {
35
+ build(params = {}) {
36
+ const uri = typeof params.uri === 'string' ? params.uri.trim() : ''
37
+ if (!uri) {
38
+ throw new Error('uri.open requires params.uri')
39
+ }
40
+ return appendQueryParams(uri, params.params)
41
+ }
42
+
43
+ async open(req, ondata, kernel) {
44
+ const uri = this.build(req.params)
45
+ ondata({ raw: `\r\nopening uri: ${uri}\r\n` })
46
+ const result = await Util.openURI(uri)
47
+ return { uri, result }
48
+ }
49
+ }
50
+
51
+ module.exports = URI
package/kernel/bin/git.js CHANGED
@@ -5,15 +5,15 @@ const semver = require('semver')
5
5
  const { rimraf } = require('rimraf')
6
6
  const path = require("path")
7
7
  class Git {
8
- description = "Installs Git, Git LFS, and GitHub CLI in the Pinokio environment."
8
+ description = "Installs Git, Git LFS, Git Credential Manager, and GitHub CLI in the Pinokio environment."
9
9
  cmd() {
10
+ const packages = "git=2.51.0 git-lfs git-credential-manager=2.7.3 gh=2.82.1"
10
11
  if (this.kernel.platform === "darwin") {
11
- return "git=2.51.0 git-lfs gh=2.82.1"
12
+ return packages
12
13
  } else if (this.kernel.platform === "win32") {
13
- //return "git git-lfs gh=2.82.1 git-bash"
14
- return "git=2.51.0 git-lfs gh=2.82.1 m2-base"
14
+ return `${packages} m2-base`
15
15
  } else {
16
- return "git=2.51.0 git-lfs gh=2.82.1"
16
+ return packages
17
17
  }
18
18
  }
19
19
  async install(req, ondata) {
@@ -42,16 +42,15 @@ class Git {
42
42
  }
43
43
  }
44
44
  if (this.kernel.platform === "darwin") {
45
- return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("gh")
45
+ return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("git-credential-manager") && this.kernel.bin.installed.conda.has("gh")
46
46
  } else if (this.kernel.platform === "win32") {
47
- //return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("gh") && this.kernel.bin.installed.conda.has("git-bash")
48
- return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("gh") && this.kernel.bin.installed.conda.has("m2-base")
47
+ return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("git-credential-manager") && this.kernel.bin.installed.conda.has("gh") && this.kernel.bin.installed.conda.has("m2-base")
49
48
  } else {
50
- return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("gh")
49
+ return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("git-credential-manager") && this.kernel.bin.installed.conda.has("gh")
51
50
  }
52
51
  }
53
52
  async uninstall(req, ondata) {
54
- await this.kernel.bin.exec({ message: "conda remove git gh" }, ondata)
53
+ await this.kernel.bin.exec({ message: "conda remove git git-credential-manager gh" }, ondata)
55
54
  }
56
55
  env() {
57
56
  let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
@@ -18,7 +18,7 @@ class Huggingface {
18
18
  let version = this.kernel.bin.installed.conda_versions.huggingface_hub
19
19
  if (version) {
20
20
  let coerced = semver.coerce(version)
21
- if (semver.satisfies(coerced, ">=1.0.1")) {
21
+ if (coerced && semver.eq(coerced, "1.0.1")) {
22
22
  return true
23
23
  }
24
24
  }
package/kernel/bin/zip.js CHANGED
@@ -1,9 +1,11 @@
1
+ const SEVEN_ZIP_VERSION = "23.01"
2
+
1
3
  class Zip {
2
4
  description = "Installs 7zip or p7zip for archive extraction."
3
5
  cmd() {
4
6
  let cmd
5
7
  if (this.kernel.platform === 'win32') {
6
- cmd = "7zip"
8
+ cmd = `7zip=${SEVEN_ZIP_VERSION}`
7
9
  } else {
8
10
  cmd = "p7zip"
9
11
  }
@@ -19,6 +21,12 @@ class Zip {
19
21
  }
20
22
  async installed() {
21
23
  if (this.kernel.platform === 'win32') {
24
+ if (this.kernel.bin.installed.conda_versions) {
25
+ let version = this.kernel.bin.installed.conda_versions["7zip"]
26
+ if (version !== SEVEN_ZIP_VERSION) {
27
+ return false
28
+ }
29
+ }
22
30
  return this.kernel.bin.installed.conda.has("7zip")
23
31
  } else {
24
32
  return this.kernel.bin.installed.conda.has("p7zip")
@@ -1,7 +1,8 @@
1
- When you log into Github here, the login will be used for the git installed within Pinokio.
1
+ When you log into GitHub here, Git Credential Manager stores the login for the git installed within Pinokio.
2
2
 
3
- Logging into Github lets you do things like:
3
+ Logging into GitHub lets you do things like:
4
4
 
5
5
  1. Cloning from Private Repositories
6
- 2. Publishing to Github
7
- 3. Use all `gh` CLI commands in all Pinokio shells ([Learn more](https://cli.github.com/))
6
+ 2. Publishing to GitHub
7
+ 3. Creating and forking GitHub repositories from Pinokio
8
+ 4. Running `git clone`, `git pull`, and `git push` in Pinokio shells without entering credentials again