orchestrating 0.1.0 → 0.1.2
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/bin/orch +17 -4
- package/package.json +3 -3
package/bin/orch
CHANGED
|
@@ -89,8 +89,8 @@ async function handleLogin() {
|
|
|
89
89
|
refresh_token: refreshToken || "",
|
|
90
90
|
expires_at: expiresAt ? Number(expiresAt) : 0,
|
|
91
91
|
});
|
|
92
|
-
res.writeHead(
|
|
93
|
-
res.end(
|
|
92
|
+
res.writeHead(302, { Location: "https://app.orchestrat.ing" });
|
|
93
|
+
res.end();
|
|
94
94
|
console.log("\x1b[32mLogged in successfully.\x1b[0m");
|
|
95
95
|
} else {
|
|
96
96
|
res.writeHead(400, { "Content-Type": "text/html" });
|
|
@@ -231,6 +231,7 @@ const BUFFER_MAX = 50 * 1024; // 50KB reconnect buffer
|
|
|
231
231
|
let ws = null;
|
|
232
232
|
let wsReady = false;
|
|
233
233
|
let reconnectTimer = null;
|
|
234
|
+
let authFailed = false;
|
|
234
235
|
const sendBuffer = [];
|
|
235
236
|
let bufferSize = 0;
|
|
236
237
|
|
|
@@ -276,7 +277,9 @@ function readPermissions() {
|
|
|
276
277
|
|
|
277
278
|
function broadcastPermissions() {
|
|
278
279
|
const perms = readPermissions();
|
|
279
|
-
process.
|
|
280
|
+
if (process.env.DEBUG) {
|
|
281
|
+
process.stderr.write(`${DIM}[perms] Broadcasting: ${perms.project.length} project${RESET}\n`);
|
|
282
|
+
}
|
|
280
283
|
sendToServer({ type: "agent_event", sessionId, event: { kind: "permission_state", ...perms } });
|
|
281
284
|
}
|
|
282
285
|
|
|
@@ -796,6 +799,14 @@ function connectWs() {
|
|
|
796
799
|
ws.on("message", (raw) => {
|
|
797
800
|
try {
|
|
798
801
|
const msg = JSON.parse(raw.toString());
|
|
802
|
+
if (msg.type === "error") {
|
|
803
|
+
process.stderr.write(`${RED}Server error: ${msg.error}${RESET}\n`);
|
|
804
|
+
if (/unauthorized|auth|token/i.test(msg.error || "")) {
|
|
805
|
+
process.stderr.write(`${RED}Run 'orch login' to authenticate.${RESET}\n`);
|
|
806
|
+
authFailed = true;
|
|
807
|
+
}
|
|
808
|
+
return;
|
|
809
|
+
}
|
|
799
810
|
handleServerMessage(msg);
|
|
800
811
|
} catch {}
|
|
801
812
|
});
|
|
@@ -803,7 +814,9 @@ function connectWs() {
|
|
|
803
814
|
ws.on("close", () => {
|
|
804
815
|
wsReady = false;
|
|
805
816
|
ws = null;
|
|
806
|
-
|
|
817
|
+
if (!authFailed) {
|
|
818
|
+
reconnectTimer = setTimeout(connectWs, 2000);
|
|
819
|
+
}
|
|
807
820
|
});
|
|
808
821
|
|
|
809
822
|
ws.on("error", () => {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orchestrating",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Stream terminal sessions to the orchestrat.ing dashboard",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"orch": "
|
|
7
|
+
"orch": "bin/orch"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"bin/orch",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"homepage": "https://orchestrat.ing",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "https://github.com/orchestrating/orchestrating"
|
|
20
|
+
"url": "git+https://github.com/orchestrating/orchestrating.git"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"keywords": [
|