agent-sin 0.1.1 → 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,27 @@ 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
+
30
+ ## [0.1.2] — 2026-05-14
31
+
32
+ ### Fixed
33
+
34
+ - `agent-sin setup` no longer writes `defaults.locale` into `config.toml`. The locale is now resolved fresh on every run from `AGENT_SIN_LOCALE` or the OS-level Intl locale. This prevents a stale `locale = "ja"` from being pinned at first setup (for example via `curl ... install.sh | bash` on a Mac whose shell still inherits `LANG=ja_JP.UTF-8`) and surviving subsequent re-installs.
35
+ - Existing workspaces with the wrong locale: remove the `locale` line from `~/.agent-sin/config.toml`, or run with `AGENT_SIN_LOCALE=en`. `sed -i '' '/^locale = /d' ~/.agent-sin/config.toml` works on macOS.
36
+
37
+ ---
38
+
18
39
  ## [0.1.1] — 2026-05-14
19
40
 
20
41
  ### 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) {
@@ -131,35 +131,14 @@ export function defaultConfig(workspace = defaultWorkspace()) {
131
131
  event_log_retention_days: 90,
132
132
  defaults: {
133
133
  note_format: "daily_markdown",
134
- locale: detectInstallLocale(),
134
+ // locale is intentionally not persisted: every run detects it fresh from
135
+ // AGENT_SIN_LOCALE / Intl, so users who switch their OS language never
136
+ // get stuck with a stale ja/en pinned at first setup.
135
137
  },
136
138
  chat_model_id: "codex-low",
137
139
  builder_model_id: "codex-xhigh",
138
140
  };
139
141
  }
140
- function detectInstallLocale() {
141
- const explicit = (process.env.AGENT_SIN_LOCALE || "").trim().toLowerCase();
142
- if (explicit === "ja" || explicit === "en")
143
- return explicit;
144
- // Prefer the OS-level locale (Intl) over shell LANG: when a user switches the
145
- // macOS system language, the shell's LANG often keeps its old value, which
146
- // would otherwise persist a stale ja locale into config.toml.
147
- try {
148
- const intlLocale = (Intl.DateTimeFormat().resolvedOptions().locale || "").toLowerCase();
149
- if (/^ja(-|$)/.test(intlLocale))
150
- return "ja";
151
- if (/^en(-|$)/.test(intlLocale))
152
- return "en";
153
- }
154
- catch {
155
- // ignored
156
- }
157
- const lang = (process.env.LC_ALL || process.env.LANG || "").trim();
158
- if (lang) {
159
- return /^ja(_|$|-)/i.test(lang) ? "ja" : "en";
160
- }
161
- return undefined;
162
- }
163
142
  export function defaultModels() {
164
143
  return {
165
144
  roles: {
@@ -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.1",
3
+ "version": "0.1.3",
4
4
  "description": "Program Skill-first personal AI agent OS CLI.",
5
5
  "type": "module",
6
6
  "license": "MIT",