pinokiod 3.19.61 → 3.19.63
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/kernel/api/index.js +0 -1
- package/kernel/bin/cli.js +0 -1
- package/kernel/bin/index.js +2 -0
- package/kernel/bin/registry.js +0 -1
- package/kernel/prototype.js +2 -0
- package/kernel/util.js +24 -19
- package/package.json +1 -1
- package/server/index.js +12 -4
- package/server/views/prototype/init.ejs +4 -1
package/kernel/api/index.js
CHANGED
|
@@ -1315,7 +1315,6 @@ class Api {
|
|
|
1315
1315
|
// if the path is
|
|
1316
1316
|
let relative = path.relative(this.kernel.homedir, request.path)
|
|
1317
1317
|
let chunks = relative.split(path.sep)
|
|
1318
|
-
console.log({ chunks })
|
|
1319
1318
|
if (chunks.length == 2) {
|
|
1320
1319
|
// the script is requesting a uri of the git repo
|
|
1321
1320
|
// look for pinokio.js
|
package/kernel/bin/cli.js
CHANGED
package/kernel/bin/index.js
CHANGED
package/kernel/bin/registry.js
CHANGED
package/kernel/prototype.js
CHANGED
|
@@ -7,6 +7,7 @@ class Proto {
|
|
|
7
7
|
this.kernel = kernel
|
|
8
8
|
}
|
|
9
9
|
async init() {
|
|
10
|
+
console.log("Proto init")
|
|
10
11
|
this.items = []
|
|
11
12
|
this.kv = {}
|
|
12
13
|
if (this.kernel.bin.installed && this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git")) {
|
|
@@ -46,6 +47,7 @@ class Proto {
|
|
|
46
47
|
})
|
|
47
48
|
}
|
|
48
49
|
}
|
|
50
|
+
console.log("Proto init done")
|
|
49
51
|
}
|
|
50
52
|
async reset() {
|
|
51
53
|
await fs.promises.rm(this.kernel.path("prototype"), { recursive: true })
|
package/kernel/util.js
CHANGED
|
@@ -159,27 +159,32 @@ const exists= (abspath) => {
|
|
|
159
159
|
return new Promise(r=>fs.access(abspath, fs.constants.F_OK, e => r(!e)))
|
|
160
160
|
}
|
|
161
161
|
const log = async (filepath, str, session) => {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
if (str && str.trim().length > 0) {
|
|
163
|
+
try {
|
|
164
|
+
await fs.promises.mkdir(filepath, { recursive: true })
|
|
165
|
+
} catch (e) {
|
|
166
|
+
}
|
|
166
167
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
let output = '';
|
|
169
|
+
for (let line of str.split('\n')) {
|
|
170
|
+
line = line.split('\r').pop(); // handle overwriting lines
|
|
171
|
+
output += line + '\n';
|
|
172
|
+
}
|
|
172
173
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
174
|
+
const pattern = [
|
|
175
|
+
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
|
176
|
+
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-Za-z=><~]))'
|
|
177
|
+
].join('|');
|
|
178
|
+
const regex = new RegExp(pattern, 'gi')
|
|
179
|
+
let stripped = str.replaceAll(regex, '');
|
|
180
|
+
let logpath = path.resolve(filepath, session)
|
|
181
|
+
console.log("> write log", logpath)
|
|
182
|
+
await fs.promises.writeFile(logpath, stripped)
|
|
183
|
+
let latest_logpath = path.resolve(filepath, "latest")
|
|
184
|
+
console.log("> write latest log", latest_logpath)
|
|
185
|
+
await fs.promises.writeFile(latest_logpath, stripped)
|
|
186
|
+
console.log("> all logs written")
|
|
187
|
+
}
|
|
183
188
|
}
|
|
184
189
|
const run = (cmd, cwd, kernel) => {
|
|
185
190
|
// console.log("Util.run", { cmd, cwd })
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -2973,6 +2973,7 @@ class Server {
|
|
|
2973
2973
|
}))
|
|
2974
2974
|
|
|
2975
2975
|
this.app.get("/init/:name", ex(async (req, res) => {
|
|
2976
|
+
console.log("Rnder init", req.params.name)
|
|
2976
2977
|
/*
|
|
2977
2978
|
option 1: new vs. clone
|
|
2978
2979
|
- new|clone
|
|
@@ -2989,6 +2990,17 @@ class Server {
|
|
|
2989
2990
|
- prompt
|
|
2990
2991
|
|
|
2991
2992
|
*/
|
|
2993
|
+
|
|
2994
|
+
let { requirements, install_required, requirements_pending, error } = await this.kernel.bin.check({
|
|
2995
|
+
bin: this.kernel.bin.preset("dev"),
|
|
2996
|
+
})
|
|
2997
|
+
if (!requirements_pending && install_required) {
|
|
2998
|
+
res.redirect(`/setup/dev?callback=${req.originalUrl}`)
|
|
2999
|
+
return
|
|
3000
|
+
}
|
|
3001
|
+
|
|
3002
|
+
// console.log("this.kernel.proto.init")
|
|
3003
|
+
// await this.kernel.proto.init()
|
|
2992
3004
|
res.render("prototype/init", {
|
|
2993
3005
|
cwd: this.kernel.path("api"),
|
|
2994
3006
|
name: req.params.name,
|
|
@@ -3022,7 +3034,6 @@ class Server {
|
|
|
3022
3034
|
})
|
|
3023
3035
|
*/
|
|
3024
3036
|
}))
|
|
3025
|
-
|
|
3026
3037
|
this.app.get("/check_router_up", ex(async (req, res) => {
|
|
3027
3038
|
let response = await this.check_router_up()
|
|
3028
3039
|
res.json(response)
|
|
@@ -3062,7 +3073,6 @@ class Server {
|
|
|
3062
3073
|
let { requirements, install_required, requirements_pending, error } = await this.kernel.bin.check({
|
|
3063
3074
|
bin: this.kernel.bin.preset("connect"),
|
|
3064
3075
|
})
|
|
3065
|
-
console.log("1", { requirements_pending, install_required })
|
|
3066
3076
|
if (!requirements_pending && install_required) {
|
|
3067
3077
|
console.log("REDIRECT", req.params.provider)
|
|
3068
3078
|
res.redirect("/setup/connect?callback=/connect/" + req.params.provider)
|
|
@@ -3627,7 +3637,6 @@ class Server {
|
|
|
3627
3637
|
let { requirements, install_required, requirements_pending, error } = await this.kernel.bin.check({
|
|
3628
3638
|
bin: this.kernel.bin.preset(req.params.name)
|
|
3629
3639
|
})
|
|
3630
|
-
console.log({ requirements, install_required, requirements_pending })
|
|
3631
3640
|
res.json({
|
|
3632
3641
|
requirements,
|
|
3633
3642
|
install_required,
|
|
@@ -5240,7 +5249,6 @@ class Server {
|
|
|
5240
5249
|
}))
|
|
5241
5250
|
this.app.get("/pinokio/requirements_ready", ex((req, res) => {
|
|
5242
5251
|
let requirements_pending = !this.kernel.bin.installed_initialized
|
|
5243
|
-
console.log({ requirements_pending })
|
|
5244
5252
|
res.json({ requirements_pending })
|
|
5245
5253
|
}))
|
|
5246
5254
|
this.app.get("/check_peer", ex((req, res) => {
|
|
@@ -216,6 +216,9 @@ body.dark .conditional-options {
|
|
|
216
216
|
display: block;
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
body.dark textarea, body.dark input[type="url"], body.dark input[type="text"] {
|
|
220
|
+
background: white;
|
|
221
|
+
}
|
|
219
222
|
textarea, input[type="url"], input[type="text"] {
|
|
220
223
|
width: 100%;
|
|
221
224
|
padding: 10px;
|
|
@@ -1275,7 +1278,7 @@ body.dark .command-fields {
|
|
|
1275
1278
|
<div class="step-content" id="step-3">
|
|
1276
1279
|
<h2>Step 3: AI Prompt (Optional)</h2>
|
|
1277
1280
|
<p>Enter a prompt to build your app with AI assistance.</p>
|
|
1278
|
-
<blockquote>The prompt will be stored in README.md,
|
|
1281
|
+
<blockquote>The prompt will be stored in README.md, and ANY AI coding tool will be automatically instructed about the project (Just say "build the app").</blockquote>
|
|
1279
1282
|
<textarea
|
|
1280
1283
|
name="aiPrompt"
|
|
1281
1284
|
id="aiPrompt"
|