pinokiod 3.271.0 → 3.272.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.
Files changed (55) hide show
  1. package/kernel/ansi_stream_tracker.js +115 -0
  2. package/kernel/api/app/index.js +422 -0
  3. package/kernel/api/htmlmodal/index.js +94 -0
  4. package/kernel/app_launcher/index.js +115 -0
  5. package/kernel/app_launcher/platform/base.js +276 -0
  6. package/kernel/app_launcher/platform/linux.js +229 -0
  7. package/kernel/app_launcher/platform/macos.js +163 -0
  8. package/kernel/app_launcher/platform/unsupported.js +34 -0
  9. package/kernel/app_launcher/platform/windows.js +247 -0
  10. package/kernel/bin/conda-meta.js +93 -0
  11. package/kernel/bin/conda.js +2 -4
  12. package/kernel/bin/index.js +2 -4
  13. package/kernel/index.js +7 -0
  14. package/kernel/shell.js +212 -1
  15. package/package.json +1 -1
  16. package/server/index.js +491 -6
  17. package/server/public/common.js +224 -741
  18. package/server/public/create-launcher.js +754 -0
  19. package/server/public/htmlmodal.js +292 -0
  20. package/server/public/logs.js +715 -0
  21. package/server/public/resizeSync.js +117 -0
  22. package/server/public/style.css +651 -6
  23. package/server/public/tab-idle-notifier.js +34 -59
  24. package/server/public/tab-link-popover.js +7 -10
  25. package/server/public/terminal-settings.js +723 -9
  26. package/server/public/terminal_input_utils.js +72 -0
  27. package/server/public/terminal_key_caption.js +187 -0
  28. package/server/public/urldropdown.css +120 -3
  29. package/server/public/xterm-inline-bridge.js +116 -0
  30. package/server/socket.js +29 -0
  31. package/server/views/agents.ejs +1 -2
  32. package/server/views/app.ejs +55 -28
  33. package/server/views/bookmarklet.ejs +1 -1
  34. package/server/views/bootstrap.ejs +1 -0
  35. package/server/views/connect.ejs +1 -2
  36. package/server/views/create.ejs +63 -0
  37. package/server/views/editor.ejs +36 -4
  38. package/server/views/index.ejs +1 -2
  39. package/server/views/index2.ejs +1 -2
  40. package/server/views/init/index.ejs +36 -28
  41. package/server/views/install.ejs +20 -22
  42. package/server/views/layout.ejs +2 -8
  43. package/server/views/logs.ejs +155 -0
  44. package/server/views/mini.ejs +0 -18
  45. package/server/views/net.ejs +2 -2
  46. package/server/views/network.ejs +1 -2
  47. package/server/views/network2.ejs +1 -2
  48. package/server/views/old_network.ejs +1 -2
  49. package/server/views/pro.ejs +26 -23
  50. package/server/views/prototype/index.ejs +30 -34
  51. package/server/views/screenshots.ejs +1 -2
  52. package/server/views/settings.ejs +1 -20
  53. package/server/views/shell.ejs +59 -66
  54. package/server/views/terminal.ejs +118 -73
  55. package/server/views/tools.ejs +1 -2
@@ -0,0 +1,292 @@
1
+ (function () {
2
+ const createElement = (tag, className) => {
3
+ const el = document.createElement(tag)
4
+ if (className) {
5
+ el.className = className
6
+ }
7
+ return el
8
+ }
9
+
10
+ const ensureStyle = () => {
11
+ if (document.getElementById('htmlmodal-style')) {
12
+ return
13
+ }
14
+ const style = document.createElement('style')
15
+ style.id = 'htmlmodal-style'
16
+ style.textContent = `
17
+ .htmlmodal-overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; background: rgba(15, 23, 42, 0.72); backdrop-filter: blur(6px); z-index: 1000000000005; padding: 32px; display: flex; align-items: center; justify-content: center; box-sizing: border-box; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.18s ease, visibility 0.18s ease; }
18
+ .htmlmodal-overlay.visible { opacity: 1; visibility: visible; pointer-events: auto; }
19
+ .htmlmodal-window { width: min(560px, 100%); max-height: calc(100vh - 64px); background: #0f172a; color: #f8fafc; border-radius: 18px; box-shadow: 0 30px 60px rgba(0,0,0,0.45); display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(148,163,184,0.2); }
20
+ .htmlmodal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 12px; }
21
+ .htmlmodal-title { font-size: 1.15rem; font-weight: 600; }
22
+ .htmlmodal-close { background: none; border: none; color: #cbd5f5; font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
23
+ .htmlmodal-close:hover { background: rgba(255,255,255,0.08); }
24
+ .htmlmodal-body { padding: 0 24px 16px; overflow-y: auto; font-size: 0.95rem; line-height: 1.5; }
25
+ .htmlmodal-body p { margin: 0 0 0.85rem; }
26
+ .htmlmodal-status { padding: 0 24px 18px; font-size: 0.9rem; color: #cbd5f5; display: flex; align-items: center; gap: 10px; }
27
+ .htmlmodal-status.hidden { display: none; }
28
+ .htmlmodal-status.error { color: #fecaca; }
29
+ .htmlmodal-status.success { color: #bbf7d0; }
30
+ .htmlmodal-status .spinner { width: 18px; height: 18px; border: 2px solid rgba(248, 250, 252, 0.2); border-top-color: #38bdf8; border-radius: 50%; animation: htmlmodal-spin 0.9s linear infinite; }
31
+ @keyframes htmlmodal-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
32
+ .htmlmodal-actions { padding: 0 24px 24px; display: flex; flex-wrap: wrap; gap: 10px; }
33
+ .htmlmodal-actions .btn { border-radius: 999px; border: 1px solid transparent; padding: 10px 18px; font-size: 0.9rem; cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease; }
34
+ .htmlmodal-actions .btn.primary { background: #38bdf8; color: #0f172a; }
35
+ .htmlmodal-actions .btn.primary:hover { background: #0ea5e9; transform: translateY(-1px); }
36
+ .htmlmodal-actions .btn.secondary { background: rgba(148,163,184,0.18); color: #f8fafc; border-color: rgba(148,163,184,0.35); }
37
+ .htmlmodal-actions .btn.secondary:hover { background: rgba(148,163,184,0.3); }
38
+ .htmlmodal-actions .btn.link { background: transparent; border-color: transparent; color: #38bdf8; padding-left: 0; }
39
+ .htmlmodal-actions .btn.link:hover { color: #7dd3fc; }
40
+ .htmlmodal-actions .btn:disabled { opacity: 0.6; cursor: not-allowed; }
41
+ `
42
+ document.head.appendChild(style)
43
+ }
44
+
45
+ class HtmlModalManager {
46
+ constructor() {
47
+ ensureStyle()
48
+ this.overlay = createElement('div', 'htmlmodal-overlay')
49
+ this.window = createElement('div', 'htmlmodal-window')
50
+ this.header = createElement('div', 'htmlmodal-header')
51
+ this.titleEl = createElement('div', 'htmlmodal-title')
52
+ this.closeBtn = createElement('button', 'htmlmodal-close')
53
+ this.closeBtn.setAttribute('aria-label', 'Close dialog')
54
+ this.closeBtn.innerHTML = '×'
55
+ this.body = createElement('div', 'htmlmodal-body')
56
+ this.status = createElement('div', 'htmlmodal-status')
57
+ this.actions = createElement('div', 'htmlmodal-actions')
58
+
59
+ this.header.appendChild(this.titleEl)
60
+ this.header.appendChild(this.closeBtn)
61
+ this.window.appendChild(this.header)
62
+ this.window.appendChild(this.body)
63
+ this.window.appendChild(this.status)
64
+ this.window.appendChild(this.actions)
65
+ this.overlay.appendChild(this.window)
66
+ document.body.appendChild(this.overlay)
67
+
68
+ this.closeBtn.addEventListener('click', () => {
69
+ this.emitResponse({ action: 'dismissed' })
70
+ this.hide()
71
+ })
72
+
73
+ this.current = {
74
+ id: null,
75
+ title: '',
76
+ awaiting: null,
77
+ actions: [],
78
+ socket: null,
79
+ dismissible: true
80
+ }
81
+ }
82
+
83
+ handle(packet, socket) {
84
+ const payload = packet.data || {}
85
+ const action = payload.action || 'update'
86
+ this.current.socket = socket
87
+ if (!payload.id) {
88
+ payload.id = this.current.id || 'htmlmodal'
89
+ }
90
+ if (action === 'close') {
91
+ this.hide()
92
+ this.current.awaiting = null
93
+ return
94
+ }
95
+ if (action === 'open') {
96
+ this.current.id = payload.id
97
+ this.show()
98
+ this.render(payload)
99
+ } else if (action === 'update') {
100
+ if (!this.current.id) {
101
+ this.current.id = payload.id
102
+ this.show()
103
+ }
104
+ this.render(payload)
105
+ }
106
+ if (Object.prototype.hasOwnProperty.call(payload, 'await')) {
107
+ if (payload.await) {
108
+ this.current.awaiting = packet.id
109
+ } else if (this.current.awaiting === packet.id) {
110
+ this.current.awaiting = null
111
+ }
112
+ }
113
+ }
114
+
115
+ show() {
116
+ this.overlay.classList.add('visible')
117
+ }
118
+
119
+ hide() {
120
+ this.overlay.classList.remove('visible')
121
+ this.current.id = null
122
+ this.current.actions = []
123
+ }
124
+
125
+ setTitle(title) {
126
+ if (typeof title === 'string') {
127
+ this.titleEl.textContent = title
128
+ }
129
+ }
130
+
131
+ setBody(html) {
132
+ if (typeof html === 'string') {
133
+ this.body.innerHTML = html
134
+ }
135
+ }
136
+
137
+ setStatus(payload) {
138
+ if (typeof payload === 'undefined') {
139
+ this.status.classList.add('hidden')
140
+ this.status.innerHTML = ''
141
+ return
142
+ }
143
+ this.status.innerHTML = ''
144
+ this.status.className = 'htmlmodal-status'
145
+ if (!payload) {
146
+ this.status.classList.add('hidden')
147
+ return
148
+ }
149
+ this.status.classList.remove('hidden')
150
+ if (payload.variant) {
151
+ this.status.classList.add(payload.variant)
152
+ }
153
+ if (payload.waiting) {
154
+ const spinner = createElement('span', 'spinner')
155
+ this.status.appendChild(spinner)
156
+ }
157
+ const text = payload.text || ''
158
+ if (text) {
159
+ const span = createElement('span')
160
+ span.innerHTML = text
161
+ this.status.appendChild(span)
162
+ }
163
+ }
164
+
165
+ renderActions(list) {
166
+ if (!Array.isArray(list)) {
167
+ return
168
+ }
169
+ this.current.actions = list
170
+ this.actions.innerHTML = ''
171
+ list.forEach((action) => {
172
+ const btn = this.createActionButton(action)
173
+ if (btn) {
174
+ this.actions.appendChild(btn)
175
+ }
176
+ })
177
+ }
178
+
179
+ createActionButton(action) {
180
+ if (!action) {
181
+ return null
182
+ }
183
+ if (action.type === 'link' && action.href) {
184
+ const link = createElement('a', this.buildButtonClass(action, 'link'))
185
+ link.href = action.href
186
+ link.target = action.target || '_blank'
187
+ link.rel = action.rel || 'noopener noreferrer'
188
+ link.textContent = action.label || action.id || 'Open'
189
+ if (action.icon) {
190
+ link.innerHTML = `<i class="${action.icon}"></i> ${link.textContent}`
191
+ }
192
+ link.addEventListener('click', () => {
193
+ // keep modal open, just open link
194
+ })
195
+ return link
196
+ }
197
+ const button = createElement('button', this.buildButtonClass(action))
198
+ button.type = 'button'
199
+ button.textContent = action.label || action.id || 'Action'
200
+ if (action.icon) {
201
+ button.innerHTML = `<i class="${action.icon}"></i> ${button.textContent}`
202
+ }
203
+ if (action.disabled) {
204
+ button.disabled = true
205
+ }
206
+ button.addEventListener('click', () => {
207
+ this.handleAction(action)
208
+ })
209
+ return button
210
+ }
211
+
212
+ buildButtonClass(action, fallback = 'secondary') {
213
+ const classes = ['btn']
214
+ if (action && action.variant) {
215
+ classes.push(action.variant)
216
+ } else {
217
+ classes.push(fallback)
218
+ }
219
+ if (action && action.primary) {
220
+ classes.push('primary')
221
+ }
222
+ return classes.join(' ')
223
+ }
224
+
225
+ handleAction(action) {
226
+ if (!action) {
227
+ return
228
+ }
229
+ if (action.type === 'link' && action.href) {
230
+ const target = action.target || '_blank'
231
+ window.open(action.href, target, action.features || 'noopener')
232
+ return
233
+ }
234
+ if (action.type === 'submit' && this.current.awaiting && this.current.socket) {
235
+ this.emitResponse({ action: action.id || 'submit', payload: action.payload || null })
236
+ if (action.close !== false) {
237
+ this.hide()
238
+ }
239
+ } else if (action.type === 'button' && this.current.socket && this.current.awaiting) {
240
+ this.emitResponse({ action: action.id || 'button', payload: action.payload || null })
241
+ } else if (action.type === 'button' && action.href) {
242
+ window.open(action.href, action.target || '_blank')
243
+ }
244
+ }
245
+
246
+ emitResponse(data) {
247
+ if (!this.current.socket || !this.current.awaiting) {
248
+ return
249
+ }
250
+ this.current.socket.respond({
251
+ response: data,
252
+ uri: this.current.awaiting
253
+ })
254
+ this.current.awaiting = null
255
+ }
256
+
257
+ render(payload) {
258
+ if (payload.title) {
259
+ this.current.title = payload.title
260
+ this.setTitle(payload.title)
261
+ }
262
+ if (Object.prototype.hasOwnProperty.call(payload, 'html')) {
263
+ this.setBody(payload.html || '')
264
+ }
265
+ if (Object.prototype.hasOwnProperty.call(payload, 'status') || Object.prototype.hasOwnProperty.call(payload, 'statusText')) {
266
+ const statusPayload = Object.prototype.hasOwnProperty.call(payload, 'status')
267
+ ? payload.status
268
+ : { text: payload.statusText, waiting: payload.waiting, variant: payload.statusVariant }
269
+ this.setStatus(statusPayload)
270
+ }
271
+ if (Array.isArray(payload.actions)) {
272
+ this.renderActions(payload.actions)
273
+ }
274
+ if (Object.prototype.hasOwnProperty.call(payload, 'dismissible')) {
275
+ this.current.dismissible = Boolean(payload.dismissible)
276
+ this.closeBtn.style.display = this.current.dismissible ? 'inline-flex' : 'none'
277
+ }
278
+ }
279
+ }
280
+
281
+ const bootHtmlModal = () => {
282
+ if (!window.HtmlModal) {
283
+ window.HtmlModal = new HtmlModalManager()
284
+ }
285
+ }
286
+
287
+ if (document.readyState === 'loading') {
288
+ document.addEventListener('DOMContentLoaded', bootHtmlModal, { once: true })
289
+ } else {
290
+ bootHtmlModal()
291
+ }
292
+ })()