@qablehq/atto 0.0.30 → 0.0.32
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/atto.js
CHANGED
|
@@ -1,50 +1,104 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Opens the built Atto desktop window. Installed as the `atto` command.
|
|
3
|
-
//
|
|
4
|
-
//
|
|
3
|
+
//
|
|
4
|
+
// Silent updates must NOT rewrite this package while Electron is loading it.
|
|
5
|
+
// If an update is pending, finish npm install first, then open the window.
|
|
5
6
|
const { spawn, spawnSync } = require("node:child_process");
|
|
6
7
|
const fs = require("node:fs");
|
|
7
8
|
const os = require("node:os");
|
|
8
9
|
const path = require("node:path");
|
|
9
10
|
|
|
10
11
|
const PENDING_FILE = path.join(os.homedir(), ".atto", "pending-npm-update.json");
|
|
12
|
+
const LOCK_FILE = path.join(os.homedir(), ".atto", "npm-update.lock");
|
|
11
13
|
|
|
12
|
-
function
|
|
13
|
-
let pending;
|
|
14
|
+
function readPending() {
|
|
14
15
|
try {
|
|
15
|
-
|
|
16
|
+
return JSON.parse(fs.readFileSync(PENDING_FILE, "utf8"));
|
|
16
17
|
} catch {
|
|
17
|
-
return;
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function clearPending() {
|
|
23
|
+
try {
|
|
24
|
+
fs.unlinkSync(PENDING_FILE);
|
|
25
|
+
} catch {
|
|
26
|
+
/* ignore */
|
|
18
27
|
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function clearLock() {
|
|
31
|
+
try {
|
|
32
|
+
fs.unlinkSync(LOCK_FILE);
|
|
33
|
+
} catch {
|
|
34
|
+
/* ignore */
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function appLooksComplete(appDir) {
|
|
39
|
+
return (
|
|
40
|
+
fs.existsSync(path.join(appDir, "package.json")) &&
|
|
41
|
+
fs.existsSync(path.join(appDir, "out", "renderer", "index.html")) &&
|
|
42
|
+
fs.existsSync(path.join(appDir, "out", "main", "index.js"))
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Apply a queued npm update before Electron starts.
|
|
48
|
+
* In-place `npm install -g` replaces files under this package — never race that
|
|
49
|
+
* with window open (clients would see missing package.json / index.html).
|
|
50
|
+
*/
|
|
51
|
+
function applyPendingUpdateBeforeOpen(appDir) {
|
|
52
|
+
const pending = readPending();
|
|
19
53
|
if (!pending?.name || !pending?.version) {
|
|
20
|
-
|
|
21
|
-
fs.unlinkSync(PENDING_FILE);
|
|
22
|
-
} catch {
|
|
23
|
-
/* ignore */
|
|
24
|
-
}
|
|
54
|
+
if (pending) clearPending();
|
|
25
55
|
return;
|
|
26
56
|
}
|
|
27
57
|
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// Fire-and-forget: this session keeps the current build; next `atto` gets the update.
|
|
33
|
-
// Do not wait — spawnSync here used to delay open by minutes on slow networks.
|
|
34
|
-
try {
|
|
35
|
-
const child = spawn(npm, args, {
|
|
36
|
-
detached: true,
|
|
58
|
+
// Another atto may already be installing; wait briefly for lock, then proceed.
|
|
59
|
+
const started = Date.now();
|
|
60
|
+
while (fs.existsSync(LOCK_FILE) && Date.now() - started < 120_000) {
|
|
61
|
+
spawnSync(process.execPath, ["-e", "Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,500)"], {
|
|
37
62
|
stdio: "ignore",
|
|
38
|
-
windowsHide: true,
|
|
39
63
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
64
|
+
if (appLooksComplete(appDir) && !readPending()) return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
fs.mkdirSync(path.dirname(LOCK_FILE), { recursive: true });
|
|
69
|
+
fs.writeFileSync(
|
|
70
|
+
LOCK_FILE,
|
|
71
|
+
JSON.stringify({ version: pending.version, pid: process.pid, at: new Date().toISOString() }),
|
|
72
|
+
"utf8",
|
|
73
|
+
);
|
|
46
74
|
} catch {
|
|
47
|
-
/*
|
|
75
|
+
/* best effort */
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
console.log(`Updating Atto to ${pending.version}…`);
|
|
79
|
+
const npm = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
80
|
+
const args = ["install", "-g", `${pending.name}@${pending.version}`, "--no-fund", "--no-audit"];
|
|
81
|
+
if (pending.prefix) args.push("--prefix", pending.prefix);
|
|
82
|
+
|
|
83
|
+
const result = spawnSync(npm, args, {
|
|
84
|
+
stdio: "inherit",
|
|
85
|
+
windowsHide: true,
|
|
86
|
+
// Large Electron download can take a while on slow networks.
|
|
87
|
+
timeout: 10 * 60 * 1000,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
clearLock();
|
|
91
|
+
if (result.status === 0 && appLooksComplete(appDir)) {
|
|
92
|
+
clearPending();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Keep pending so the next open retries; only open if current files are still usable.
|
|
97
|
+
if (!appLooksComplete(appDir)) {
|
|
98
|
+
console.error(
|
|
99
|
+
"Atto update did not finish cleanly. Try again, or run:\n npm install -g @qablehq/atto@latest --prefix \"$HOME/.local\"",
|
|
100
|
+
);
|
|
101
|
+
process.exit(1);
|
|
48
102
|
}
|
|
49
103
|
}
|
|
50
104
|
|
|
@@ -73,13 +127,12 @@ function ensureElectronBinary(electronPkgDir) {
|
|
|
73
127
|
return result.status === 0 && electronLooksReady(electronPkgDir);
|
|
74
128
|
}
|
|
75
129
|
|
|
76
|
-
kickPendingSilentUpdate();
|
|
77
|
-
|
|
78
130
|
const appDir = path.resolve(__dirname, "..");
|
|
79
|
-
|
|
80
|
-
|
|
131
|
+
applyPendingUpdateBeforeOpen(appDir);
|
|
132
|
+
|
|
133
|
+
if (!appLooksComplete(appDir)) {
|
|
81
134
|
console.error(
|
|
82
|
-
"Atto UI files are missing
|
|
135
|
+
"Atto UI files are missing. Reinstall with:\n npm install -g @qablehq/atto@latest --prefix \"$HOME/.local\"",
|
|
83
136
|
);
|
|
84
137
|
process.exit(1);
|
|
85
138
|
}
|
|
@@ -92,7 +145,7 @@ try {
|
|
|
92
145
|
console.error(
|
|
93
146
|
"Electron failed to install. Fix with:\n cd \"" +
|
|
94
147
|
path.join(appDir, "node_modules", "electron") +
|
|
95
|
-
'" && node install.js'
|
|
148
|
+
'" && node install.js',
|
|
96
149
|
);
|
|
97
150
|
process.exit(1);
|
|
98
151
|
}
|
package/out/main/index.js
CHANGED
|
@@ -659,7 +659,6 @@ function listPcFolderEntries(requestPath) {
|
|
|
659
659
|
const parentPath = parent === abs ? null : parent;
|
|
660
660
|
return { path: abs, parentPath, entries };
|
|
661
661
|
}
|
|
662
|
-
|
|
663
662
|
function createPcFolder(parentPath, name) {
|
|
664
663
|
const parent = node_path.resolve(String(parentPath || "").trim());
|
|
665
664
|
const folderName = String(name || "").trim();
|
|
@@ -715,7 +714,6 @@ async function pullAndHandleDesktopCommands() {
|
|
|
715
714
|
}
|
|
716
715
|
continue;
|
|
717
716
|
}
|
|
718
|
-
|
|
719
717
|
if (command.type === "create_folder") {
|
|
720
718
|
const parentPath = String(command.parentPath || "").trim();
|
|
721
719
|
const name = String(command.name || "").trim();
|
|
@@ -12685,26 +12683,11 @@ function setupNpmUpdater() {
|
|
|
12685
12683
|
const name = readPackageName();
|
|
12686
12684
|
let pending = null;
|
|
12687
12685
|
const prefix = detectNpmPrefix();
|
|
12688
|
-
const installQuietly = (version) => {
|
|
12689
|
-
const npm = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
12690
|
-
const args = ["install", "-g", `${name}@${version}`, "--silent", "--no-fund", "--no-audit"];
|
|
12691
|
-
if (prefix) args.push("--prefix", prefix);
|
|
12692
|
-
console.log(
|
|
12693
|
-
`[npm-updater] installing ${name}@${version}${prefix ? ` --prefix ${prefix}` : ""} after quit`
|
|
12694
|
-
);
|
|
12695
|
-
const child = node_child_process.spawn(npm, args, {
|
|
12696
|
-
detached: true,
|
|
12697
|
-
stdio: "ignore",
|
|
12698
|
-
windowsHide: true
|
|
12699
|
-
});
|
|
12700
|
-
child.unref();
|
|
12701
|
-
};
|
|
12702
12686
|
electron.app.on("before-quit", () => {
|
|
12703
12687
|
if (!pending) return;
|
|
12704
|
-
|
|
12688
|
+
writePendingUpdate(name, pending, prefix);
|
|
12689
|
+
console.log(`[npm-updater] ${pending} queued — will install on next atto launch`);
|
|
12705
12690
|
pending = null;
|
|
12706
|
-
writePendingUpdate(name, version, prefix);
|
|
12707
|
-
installQuietly(version);
|
|
12708
12691
|
});
|
|
12709
12692
|
const current = electron.app.getVersion();
|
|
12710
12693
|
void (async () => {
|
|
@@ -12717,7 +12700,7 @@ function setupNpmUpdater() {
|
|
|
12717
12700
|
if (!body.version || !isNewerVersion(body.version, current)) return;
|
|
12718
12701
|
pending = body.version;
|
|
12719
12702
|
writePendingUpdate(name, body.version, prefix);
|
|
12720
|
-
console.log(`[npm-updater] ${body.version} queued for
|
|
12703
|
+
console.log(`[npm-updater] ${body.version} queued for install on next launch`);
|
|
12721
12704
|
} catch (error) {
|
|
12722
12705
|
console.error("[npm-updater] check failed", error);
|
|
12723
12706
|
} finally {
|
|
@@ -33189,17 +33189,9 @@ function TesboPanel() {
|
|
|
33189
33189
|
]
|
|
33190
33190
|
}
|
|
33191
33191
|
) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 grid gap-3", children: [
|
|
33192
|
-
status.projects.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: "No project is turned on for this code. It appears here when the project is turned on." }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("
|
|
33193
|
-
"Project",
|
|
33194
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
33195
|
-
"select",
|
|
33196
|
-
{
|
|
33197
|
-
value: projectId,
|
|
33198
|
-
onChange: (event) => setProjectId(event.target.value),
|
|
33199
|
-
className: "h-9 rounded-md border border-border bg-background px-3 text-sm text-foreground",
|
|
33200
|
-
children: status.projects.map((project) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: project.id, children: project.name }, project.id))
|
|
33201
|
-
}
|
|
33202
|
-
)
|
|
33192
|
+
status.projects.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: "No project is turned on for this code. It appears here when the project is turned on." }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid max-w-md gap-1 text-xs text-muted-foreground", children: [
|
|
33193
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Project" }),
|
|
33194
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm font-medium text-foreground", children: status.projects.find((project) => project.id === projectId)?.name ?? status.projects[0]?.name })
|
|
33203
33195
|
] }),
|
|
33204
33196
|
agents && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2", children: agents.agents.map((agent) => /* @__PURE__ */ jsxRuntimeExports.jsxs("article", { className: "rounded-md border border-border p-3", children: [
|
|
33205
33197
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
package/out/renderer/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/>
|
|
9
9
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
10
10
|
<title>Tesbo Automate</title>
|
|
11
|
-
<script type="module" crossorigin src="./assets/index-
|
|
11
|
+
<script type="module" crossorigin src="./assets/index-Dw8pr3mG.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./assets/index-DyJdhPcb.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|