turnzero 0.16.0-next.1 → 0.16.1-next.1
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/dist/turnzero-cloud.mjs +20 -15
- package/package.json +1 -1
package/dist/turnzero-cloud.mjs
CHANGED
|
@@ -5214,6 +5214,7 @@ var endedSentence = (minutes, line) => `No approval arrived within ${minutesWord
|
|
|
5214
5214
|
var stoppedSentence = (line) => `The code prompt was stopped, so nothing was minted. Run ${line} again to log this computer in.`;
|
|
5215
5215
|
var notCodeSentence = (line) => `What was pasted is not a token code, so nothing was sent and nothing was minted. Run ${line} again to log this computer in.`;
|
|
5216
5216
|
var CODE_PROMPT_WORDS = "Code (not shown), then Enter: ";
|
|
5217
|
+
var LINE_PIECES = /[^\r\n]*(?:\r\n|\r|\n)|[^\r\n]+/g;
|
|
5217
5218
|
var escaped = (text) => text.replace(/[&<>"']/g, (character) => `&#${character.charCodeAt(0)};`);
|
|
5218
5219
|
var browserPageOf = (title, sentence) => `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${escaped(title)}</title></head><body style="font-family: system-ui, sans-serif; max-width: 36rem; margin: 3rem auto; padding: 0 1rem; line-height: 1.5"><h1>${escaped(title)}</h1><p>${escaped(sentence)}</p></body></html>`;
|
|
5219
5220
|
var answerHeaders = (origin, html) => ({
|
|
@@ -5222,7 +5223,7 @@ var answerHeaders = (origin, html) => ({
|
|
|
5222
5223
|
"cache-control": "no-store",
|
|
5223
5224
|
...html ? { "content-type": "text/html; charset=utf-8" } : {}
|
|
5224
5225
|
});
|
|
5225
|
-
var
|
|
5226
|
+
var stateOnlyAnswer = (origin) => ({ status: 204, headers: answerHeaders(origin, false), body: "" });
|
|
5226
5227
|
var outcomeAnswer = (origin, authorized) => ({
|
|
5227
5228
|
status: 200,
|
|
5228
5229
|
headers: answerHeaders(origin, true),
|
|
@@ -5242,12 +5243,12 @@ var notFoundAnswer = (origin) => ({ status: 404, headers: answerHeaders(origin,
|
|
|
5242
5243
|
var loopbackHandlerOf = (origin, state, arrive) => {
|
|
5243
5244
|
return async (request) => {
|
|
5244
5245
|
if (request.path !== "/") return notFoundAnswer(origin);
|
|
5245
|
-
if (request.method === "OPTIONS") return
|
|
5246
|
+
if (request.method === "OPTIONS") return stateOnlyAnswer(origin);
|
|
5246
5247
|
if (request.method !== "GET") return notFoundAnswer(origin);
|
|
5247
5248
|
const named = request.query[COMPUTER_LOGIN_QUERY.state];
|
|
5248
5249
|
if (named === void 0 || !LOGIN_STATE_FORM.test(named) || named !== state) return wrongStateAnswer(origin);
|
|
5249
5250
|
const code = request.query.code;
|
|
5250
|
-
if (code === void 0) return
|
|
5251
|
+
if (code === void 0) return stateOnlyAnswer(origin);
|
|
5251
5252
|
const outcome = arrive(code);
|
|
5252
5253
|
if (outcome === null) return endedAnswer(origin);
|
|
5253
5254
|
return outcomeAnswer(origin, await outcome);
|
|
@@ -5321,20 +5322,24 @@ async function login(call, io2) {
|
|
|
5321
5322
|
prompt = { close };
|
|
5322
5323
|
terminal.write(CODE_PROMPT_WORDS);
|
|
5323
5324
|
terminal.keys((chunk) => {
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5325
|
+
for (const piece of chunk.match(LINE_PIECES) ?? []) {
|
|
5326
|
+
if (!open || taken) return;
|
|
5327
|
+
const step = promptKeys(typed, piece, "the code prompt", "a fresh login");
|
|
5328
|
+
if ("refusal" in step) {
|
|
5329
|
+
close();
|
|
5330
|
+
take({ ended: "stopped" });
|
|
5331
|
+
return;
|
|
5332
|
+
}
|
|
5333
|
+
typed = step.typed;
|
|
5334
|
+
if (!step.ended) continue;
|
|
5335
|
+
const code = typed.trim();
|
|
5336
|
+
typed = "";
|
|
5337
|
+
if (code === "") continue;
|
|
5327
5338
|
close();
|
|
5328
|
-
|
|
5339
|
+
io2.hide(code, REDACTED_TOKEN_CODE);
|
|
5340
|
+
take(isTokenCode(code) ? { code, from: "paste" } : { ended: "not code" });
|
|
5329
5341
|
return;
|
|
5330
5342
|
}
|
|
5331
|
-
typed = step.typed;
|
|
5332
|
-
if (!step.ended) return;
|
|
5333
|
-
close();
|
|
5334
|
-
const code = typed.trim();
|
|
5335
|
-
if (code === "") return;
|
|
5336
|
-
io2.hide(code, REDACTED_TOKEN_CODE);
|
|
5337
|
-
take(isTokenCode(code) ? { code, from: "paste" } : { ended: "not code" });
|
|
5338
5343
|
});
|
|
5339
5344
|
};
|
|
5340
5345
|
const cancels = [];
|
|
@@ -5410,7 +5415,7 @@ var LOGIN_ROW = Object.freeze({
|
|
|
5410
5415
|
done: "this computer logged in",
|
|
5411
5416
|
failed: "a token was minted and not kept, or the token this computer held before was not revoked: the printed lines name revoke_token",
|
|
5412
5417
|
unknown: "the exchange drew no answer, or an answer that is not a refusal: list_tokens shows whether a token was minted",
|
|
5413
|
-
nothing_started: "nothing was minted: an option or the credential file was refused, no code arrived in time or could arrive, the prompt was stopped or given
|
|
5418
|
+
nothing_started: "nothing was minted: an option or the credential file was refused, no code arrived in time or could arrive, the prompt was stopped or given what is not a token code, the platform was too old, or the exchange was refused"
|
|
5414
5419
|
},
|
|
5415
5420
|
variables: [[ORIGIN_VARIABLE, AUTHORIZATION_ORIGIN_VARIABLE_LINE]],
|
|
5416
5421
|
note: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turnzero",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.1-next.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The Turn Zero Cloud command, which an AI coding tool runs on your machine to deploy an application, store a secret, upload a file, download an export, take a library entry, write a local run's settings, start the application locally, and scaffold a new service from a template.",
|
|
6
6
|
"license": "Apache-2.0",
|