palmier 0.4.1 → 0.4.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/dist/commands/serve.js +0 -4
- package/dist/rpc-handler.js +1 -2
- package/dist/update-checker.d.ts +0 -8
- package/dist/update-checker.js +0 -36
- package/package.json +1 -1
- package/src/commands/serve.ts +0 -5
- package/src/rpc-handler.ts +1 -2
- package/src/update-checker.ts +0 -36
package/dist/commands/serve.js
CHANGED
|
@@ -7,7 +7,6 @@ import { startNatsTransport } from "../transports/nats-transport.js";
|
|
|
7
7
|
import { getTaskDir, readTaskStatus, writeTaskStatus, appendHistory, parseTaskFile } from "../task.js";
|
|
8
8
|
import { publishHostEvent } from "../events.js";
|
|
9
9
|
import { getPlatform } from "../platform/index.js";
|
|
10
|
-
import { checkForUpdate } from "../update-checker.js";
|
|
11
10
|
import { detectAgents } from "../agents/agent.js";
|
|
12
11
|
import { saveConfig } from "../config.js";
|
|
13
12
|
import { CONFIG_DIR } from "../config.js";
|
|
@@ -88,9 +87,6 @@ export async function serveCommand() {
|
|
|
88
87
|
console.error("[monitor] Error checking stale tasks:", err);
|
|
89
88
|
});
|
|
90
89
|
}, POLL_INTERVAL_MS);
|
|
91
|
-
// Check for updates on startup and every 24 hours
|
|
92
|
-
checkForUpdate().catch(() => { });
|
|
93
|
-
setInterval(() => { checkForUpdate().catch(() => { }); }, 24 * 60 * 60 * 1000);
|
|
94
90
|
const handleRpc = createRpcHandler(config, nc);
|
|
95
91
|
await startNatsTransport(config, handleRpc, nc);
|
|
96
92
|
}
|
package/dist/rpc-handler.js
CHANGED
|
@@ -10,7 +10,7 @@ import { spawnCommand } from "./spawn-command.js";
|
|
|
10
10
|
import { getAgent } from "./agents/agent.js";
|
|
11
11
|
import { validateSession } from "./session-store.js";
|
|
12
12
|
import { publishHostEvent } from "./events.js";
|
|
13
|
-
import { currentVersion,
|
|
13
|
+
import { currentVersion, performUpdate } from "./update-checker.js";
|
|
14
14
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
15
15
|
const PLAN_GENERATION_PROMPT = fs.readFileSync(path.join(__dirname, "commands", "plan-generation.md"), "utf-8");
|
|
16
16
|
/**
|
|
@@ -109,7 +109,6 @@ export function createRpcHandler(config, nc) {
|
|
|
109
109
|
tasks: tasks.map((task) => flattenTask(task)),
|
|
110
110
|
agents: config.agents ?? [],
|
|
111
111
|
version: currentVersion,
|
|
112
|
-
latest_version: getLatestVersion(),
|
|
113
112
|
};
|
|
114
113
|
}
|
|
115
114
|
case "task.create": {
|
package/dist/update-checker.d.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
/** True when running from a source checkout (has .git) rather than a global npm install. */
|
|
2
2
|
export declare const isDevBuild: boolean;
|
|
3
3
|
export declare const currentVersion: string;
|
|
4
|
-
/**
|
|
5
|
-
* Check the npm registry for the latest version of palmier.
|
|
6
|
-
*/
|
|
7
|
-
export declare function checkForUpdate(): Promise<void>;
|
|
8
|
-
/**
|
|
9
|
-
* Get the latest version from npm, or null if not yet checked.
|
|
10
|
-
*/
|
|
11
|
-
export declare function getLatestVersion(): string | null;
|
|
12
4
|
/**
|
|
13
5
|
* Run the update and restart the daemon.
|
|
14
6
|
* Returns an error message if the update fails.
|
package/dist/update-checker.js
CHANGED
|
@@ -9,41 +9,6 @@ const pkg = JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "
|
|
|
9
9
|
/** True when running from a source checkout (has .git) rather than a global npm install. */
|
|
10
10
|
export const isDevBuild = fs.existsSync(path.join(packageRoot, ".git"));
|
|
11
11
|
export const currentVersion = isDevBuild ? `${pkg.version}-dev` : pkg.version;
|
|
12
|
-
let latestVersion = null;
|
|
13
|
-
let lastCheckTime = 0;
|
|
14
|
-
const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
15
|
-
/**
|
|
16
|
-
* Check the npm registry for the latest version of palmier.
|
|
17
|
-
*/
|
|
18
|
-
export async function checkForUpdate() {
|
|
19
|
-
if (isDevBuild)
|
|
20
|
-
return;
|
|
21
|
-
const now = Date.now();
|
|
22
|
-
if (now - lastCheckTime < CHECK_INTERVAL_MS)
|
|
23
|
-
return;
|
|
24
|
-
lastCheckTime = now;
|
|
25
|
-
try {
|
|
26
|
-
const res = await fetch("https://registry.npmjs.org/palmier/latest", {
|
|
27
|
-
signal: AbortSignal.timeout(10_000),
|
|
28
|
-
});
|
|
29
|
-
if (!res.ok)
|
|
30
|
-
return;
|
|
31
|
-
const data = (await res.json());
|
|
32
|
-
if (data.version) {
|
|
33
|
-
latestVersion = data.version;
|
|
34
|
-
console.log(`[update] Latest version: ${data.version} (current: ${currentVersion})`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
// Network errors are expected (offline, etc.)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Get the latest version from npm, or null if not yet checked.
|
|
43
|
-
*/
|
|
44
|
-
export function getLatestVersion() {
|
|
45
|
-
return latestVersion;
|
|
46
|
-
}
|
|
47
12
|
/**
|
|
48
13
|
* Run the update and restart the daemon.
|
|
49
14
|
* Returns an error message if the update fails.
|
|
@@ -60,7 +25,6 @@ export async function performUpdate() {
|
|
|
60
25
|
return `Update failed. Please run manually:\nnpm update -g palmier`;
|
|
61
26
|
}
|
|
62
27
|
console.log("[update] Update installed, restarting daemon...");
|
|
63
|
-
latestVersion = null;
|
|
64
28
|
// Small delay to allow the RPC response to be sent
|
|
65
29
|
setTimeout(() => {
|
|
66
30
|
getPlatform().restartDaemon().catch((err) => {
|
package/package.json
CHANGED
package/src/commands/serve.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { startNatsTransport } from "../transports/nats-transport.js";
|
|
|
7
7
|
import { getTaskDir, readTaskStatus, writeTaskStatus, appendHistory, parseTaskFile } from "../task.js";
|
|
8
8
|
import { publishHostEvent } from "../events.js";
|
|
9
9
|
import { getPlatform } from "../platform/index.js";
|
|
10
|
-
import { checkForUpdate } from "../update-checker.js";
|
|
11
10
|
import { detectAgents } from "../agents/agent.js";
|
|
12
11
|
import { saveConfig } from "../config.js";
|
|
13
12
|
import type { HostConfig } from "../types.js";
|
|
@@ -109,10 +108,6 @@ export async function serveCommand(): Promise<void> {
|
|
|
109
108
|
});
|
|
110
109
|
}, POLL_INTERVAL_MS);
|
|
111
110
|
|
|
112
|
-
// Check for updates on startup and every 24 hours
|
|
113
|
-
checkForUpdate().catch(() => {});
|
|
114
|
-
setInterval(() => { checkForUpdate().catch(() => {}); }, 24 * 60 * 60 * 1000);
|
|
115
|
-
|
|
116
111
|
const handleRpc = createRpcHandler(config, nc);
|
|
117
112
|
await startNatsTransport(config, handleRpc, nc);
|
|
118
113
|
}
|
package/src/rpc-handler.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { spawnCommand } from "./spawn-command.js";
|
|
|
11
11
|
import { getAgent } from "./agents/agent.js";
|
|
12
12
|
import { validateSession } from "./session-store.js";
|
|
13
13
|
import { publishHostEvent } from "./events.js";
|
|
14
|
-
import { currentVersion,
|
|
14
|
+
import { currentVersion, performUpdate } from "./update-checker.js";
|
|
15
15
|
import type { HostConfig, ParsedTask, RpcMessage } from "./types.js";
|
|
16
16
|
|
|
17
17
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -124,7 +124,6 @@ export function createRpcHandler(config: HostConfig, nc?: NatsConnection) {
|
|
|
124
124
|
tasks: tasks.map((task) => flattenTask(task)),
|
|
125
125
|
agents: config.agents ?? [],
|
|
126
126
|
version: currentVersion,
|
|
127
|
-
latest_version: getLatestVersion(),
|
|
128
127
|
};
|
|
129
128
|
}
|
|
130
129
|
|
package/src/update-checker.ts
CHANGED
|
@@ -12,41 +12,6 @@ const pkg = JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "
|
|
|
12
12
|
export const isDevBuild = fs.existsSync(path.join(packageRoot, ".git"));
|
|
13
13
|
export const currentVersion = isDevBuild ? `${pkg.version}-dev` : pkg.version;
|
|
14
14
|
|
|
15
|
-
let latestVersion: string | null = null;
|
|
16
|
-
let lastCheckTime = 0;
|
|
17
|
-
const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Check the npm registry for the latest version of palmier.
|
|
21
|
-
*/
|
|
22
|
-
export async function checkForUpdate(): Promise<void> {
|
|
23
|
-
if (isDevBuild) return;
|
|
24
|
-
const now = Date.now();
|
|
25
|
-
if (now - lastCheckTime < CHECK_INTERVAL_MS) return;
|
|
26
|
-
lastCheckTime = now;
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
const res = await fetch("https://registry.npmjs.org/palmier/latest", {
|
|
30
|
-
signal: AbortSignal.timeout(10_000),
|
|
31
|
-
});
|
|
32
|
-
if (!res.ok) return;
|
|
33
|
-
const data = (await res.json()) as { version?: string };
|
|
34
|
-
if (data.version) {
|
|
35
|
-
latestVersion = data.version;
|
|
36
|
-
console.log(`[update] Latest version: ${data.version} (current: ${currentVersion})`);
|
|
37
|
-
}
|
|
38
|
-
} catch {
|
|
39
|
-
// Network errors are expected (offline, etc.)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Get the latest version from npm, or null if not yet checked.
|
|
45
|
-
*/
|
|
46
|
-
export function getLatestVersion(): string | null {
|
|
47
|
-
return latestVersion;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
15
|
/**
|
|
51
16
|
* Run the update and restart the daemon.
|
|
52
17
|
* Returns an error message if the update fails.
|
|
@@ -63,7 +28,6 @@ export async function performUpdate(): Promise<string | null> {
|
|
|
63
28
|
return `Update failed. Please run manually:\nnpm update -g palmier`;
|
|
64
29
|
}
|
|
65
30
|
console.log("[update] Update installed, restarting daemon...");
|
|
66
|
-
latestVersion = null;
|
|
67
31
|
// Small delay to allow the RPC response to be sent
|
|
68
32
|
setTimeout(() => {
|
|
69
33
|
getPlatform().restartDaemon().catch((err) => {
|