agent-sin 0.1.2 → 0.1.3

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/CHANGELOG.md CHANGED
@@ -15,6 +15,18 @@ See the [compatibility policy](https://agent.shingoirie.com/versioning) for deta
15
15
 
16
16
  ---
17
17
 
18
+ ## [0.1.3] — 2026-05-14
19
+
20
+ ### Added
21
+
22
+ - The long-running `agent-sin gateway` (the launchd / Task Scheduler service) now self-detects upgrades. Every 5 minutes it re-reads its own `package.json` version, and if it differs from the version it started with, it exits gracefully so launchd / Task Scheduler restarts it on the new code. This means `npm i -g agent-sin@latest` is enough — no manual `service restart` is required.
23
+
24
+ ### Fixed
25
+
26
+ - The CLI banner used to print a hard-coded `v0.1.0` because the version string was inlined. It now reads `package.json` at runtime, so the displayed version always matches the installed one.
27
+
28
+ ---
29
+
18
30
  ## [0.1.2] — 2026-05-14
19
31
 
20
32
  ### Fixed
package/dist/cli/index.js CHANGED
@@ -26,6 +26,7 @@ import { extractTelegramIdentityCandidates, runTelegramBot, } from "../telegram/
26
26
  import { Spinner } from "./spinner.js";
27
27
  import { formatModelRow, modelSummary, modelsLines, skillsLines, } from "../core/info-lines.js";
28
28
  import { inferLocaleFromText, l, lLines, t, withLocale } from "../core/i18n.js";
29
+ import { agentSinVersion, agentSinVersionFresh } from "../core/version.js";
29
30
  import { appendHistory, chatRespond, makeSpinnerProgress, } from "../core/chat-engine.js";
30
31
  async function main() {
31
32
  const [command, ...args] = process.argv.slice(2);
@@ -1436,7 +1437,7 @@ function formatAssistantNarrative(text) {
1436
1437
  .map((line, idx) => (idx === 0 ? `${bullet} ${line}` : ` ${line}`))
1437
1438
  .join("\n");
1438
1439
  }
1439
- const AGENT_SIN_VERSION = "0.1.0";
1440
+ const AGENT_SIN_VERSION = agentSinVersion();
1440
1441
  async function withCliBuildHooks(config, trimmed, run) {
1441
1442
  const hooks = cliBuildHooks(config, trimmed);
1442
1443
  try {
@@ -2382,6 +2383,16 @@ macOS で常駐させるには agent-sin service install を使ってくださ
2382
2383
  return 0;
2383
2384
  }
2384
2385
  console.log(l(`agent-sin gateway: starting (${startScheduler ? `${enabled.length} schedule(s)` : "scheduler idle"}, ${startDiscord ? "discord on" : "discord off"}, ${startTelegram ? "telegram on" : "telegram off"})`, `agent-sin gateway: 起動します (${startScheduler ? `${enabled.length}件のスケジュール` : "scheduler 待機"}, ${startDiscord ? "discord 有効" : "discord 無効"}, ${startTelegram ? "telegram 有効" : "telegram 無効"})`));
2386
+ const startupVersion = agentSinVersionFresh();
2387
+ const versionCheckInterval = setInterval(() => {
2388
+ const current = agentSinVersionFresh();
2389
+ if (current !== startupVersion && current !== "unknown") {
2390
+ console.log(l(`agent-sin gateway: detected upgrade ${startupVersion} -> ${current}, exiting so launchd restarts with the new code.`, `agent-sin gateway: アップデートを検知 (${startupVersion} -> ${current}). launchd が新しいコードで再起動できるように終了します。`));
2391
+ clearInterval(versionCheckInterval);
2392
+ process.exit(0);
2393
+ }
2394
+ }, 5 * 60 * 1000);
2395
+ versionCheckInterval.unref?.();
2385
2396
  const tasks = [];
2386
2397
  if (startScheduler) {
2387
2398
  tasks.push(runScheduleDaemon(config, { once: Boolean(options.once) }));
@@ -2399,6 +2410,7 @@ macOS で常駐させるには agent-sin service install を使ってくださ
2399
2410
  console.log(l("agent-sin gateway: Telegram not configured.", "agent-sin gateway: Telegram は未設定です。"));
2400
2411
  }
2401
2412
  const results = await Promise.all(tasks);
2413
+ clearInterval(versionCheckInterval);
2402
2414
  return Math.max(...results);
2403
2415
  }
2404
2416
  async function cmdService(args) {
@@ -0,0 +1,2 @@
1
+ export declare function agentSinVersion(): string;
2
+ export declare function agentSinVersionFresh(): string;
@@ -0,0 +1,25 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { fileURLToPath } from "node:url";
3
+ import path from "node:path";
4
+ const FILENAME = fileURLToPath(import.meta.url);
5
+ const PKG_PATH = path.resolve(path.dirname(FILENAME), "..", "..", "package.json");
6
+ let cached = null;
7
+ function readVersionFromDisk() {
8
+ try {
9
+ const raw = readFileSync(PKG_PATH, "utf8");
10
+ const parsed = JSON.parse(raw);
11
+ return typeof parsed.version === "string" ? parsed.version : "unknown";
12
+ }
13
+ catch {
14
+ return "unknown";
15
+ }
16
+ }
17
+ export function agentSinVersion() {
18
+ if (cached === null) {
19
+ cached = readVersionFromDisk();
20
+ }
21
+ return cached;
22
+ }
23
+ export function agentSinVersionFresh() {
24
+ return readVersionFromDisk();
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-sin",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Program Skill-first personal AI agent OS CLI.",
5
5
  "type": "module",
6
6
  "license": "MIT",