@minimalcorp/tsunagi 0.1.55 → 0.2.0
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/.next/standalone/apps/web/.next/BUILD_ID +1 -1
- package/.next/standalone/apps/web/.next/build-manifest.json +3 -3
- package/.next/standalone/apps/web/.next/prerender-manifest.json +3 -3
- package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +14 -14
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_index.segment.rsc +9 -9
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/index.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.rsc +16 -16
- package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +16 -16
- package/.next/standalone/apps/web/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/index.segments/_index.segment.rsc +9 -9
- package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.rsc +16 -16
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_full.segment.rsc +16 -16
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_index.segment.rsc +9 -9
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/tasks/[id]/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0qjafjt._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{_05_5y28._.js → _053072t._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{_0ncpk6b._.js → _07i72iz._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_09eooml._.js +7 -0
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_0bru-z.._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_0i8ojdw._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_0mtw02l._.js +3 -0
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_12aa-fs._.js +7 -0
- package/.next/standalone/apps/web/.next/server/chunks/ssr/apps_web_src_app_settings_page_tsx_0i6itlb._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_09nusj_._.js → node_modules_0-g_j5j._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0axuayq._.js → node_modules_04pfam-._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_10v5lct._.js → node_modules_0_1re~9._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0h_hear._.js → node_modules_0_huoqd._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0c8sp_9._.js → node_modules_0a9pqes._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_09e0q95._.js → node_modules_0bfjoue._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0s3mkxs._.js → node_modules_0e.hm5q._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0la1a4x._.js → node_modules_0krwgny._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0zv4e8x._.js → node_modules_0l23gkf._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0w8sswp._.js → node_modules_0mpkxmv._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_06gyfuv._.js → node_modules_0oip5a1._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_117mm7f._.js → node_modules_0q_xfyl._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0nji2bx._.js → node_modules_0tod6y8._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0o9t~hh._.js → node_modules_0xp9nhx._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0_876x4._.js → node_modules_0zstt1y._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0mt.8za._.js → node_modules_0~2ubpz._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
- package/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
- package/.next/standalone/apps/web/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/0.qz1zt1c.y.n.js +5 -0
- package/.next/standalone/apps/web/.next/static/chunks/0ajw1mjy3owa4.js +1 -0
- package/.next/standalone/apps/web/.next/static/chunks/0fe4v5dh3whem.js +5 -0
- package/.next/standalone/apps/web/.next/static/chunks/{0vxoeg5sfua~3.js → 0gzt~9euv6u2y.js} +2 -2
- package/.next/standalone/apps/web/.next/static/chunks/0jcorj3-aambm.js +1 -0
- package/.next/standalone/apps/web/.next/static/chunks/{0p3_2uc39mlse.js → 0s7g4uwmm49t..js} +2 -2
- package/.next/standalone/apps/web/.next/static/chunks/0wnto9g4i0s3h.css +4 -0
- package/.next/standalone/apps/web/.next/static/chunks/{0jc3jwed_8vre.js → 0~_c.mwboavrv.js} +2 -2
- package/dist/app.d.ts +1 -0
- package/dist/app.js +375 -0
- package/dist/cli.js +152 -290
- package/dist/plugin-lifecycle.d.ts +9 -10
- package/dist/plugin-lifecycle.js +77 -65
- package/dist/server/index.js +18 -3
- package/dist/server/lib/auto-update.d.ts +18 -0
- package/dist/server/lib/auto-update.js +208 -0
- package/dist/server/lib/restart.d.ts +8 -0
- package/dist/server/lib/restart.js +13 -0
- package/dist/server/lib/update-check.js +14 -4
- package/dist/server/pty-manager.d.ts +2 -0
- package/dist/server/pty-manager.js +31 -2
- package/dist/server/routes/version.js +16 -0
- package/dist/single-instance-lock.js +3 -17
- package/dist/update-lifecycle.d.ts +19 -0
- package/dist/update-lifecycle.js +93 -0
- package/dist/versions.d.ts +60 -0
- package/dist/versions.js +95 -0
- package/dist/with-plugin.js +6 -8
- package/npm-shrinkwrap.json +8 -8
- package/package.json +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_0hqrmyz._.js +0 -3
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_0m.hvms._.js +0 -7
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_0mljs_s._.js +0 -7
- package/.next/standalone/apps/web/.next/static/chunks/08-d-ag2euha9.js +0 -5
- package/.next/standalone/apps/web/.next/static/chunks/0c.dwezn5qjvs.css +0 -4
- package/.next/standalone/apps/web/.next/static/chunks/0gpkw.1e6kcpn.js +0 -1
- package/.next/standalone/apps/web/.next/static/chunks/0v6gxm~ldhmma.js +0 -1
- package/.next/standalone/apps/web/.next/static/chunks/13y6z-vus9yvr.js +0 -5
- /package/.next/standalone/apps/web/.next/static/{EOnxRuFun6cfXk-y9KPq5 → OXWK1FxsZh6lcEQawkL6h}/_buildManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{EOnxRuFun6cfXk-y9KPq5 → OXWK1FxsZh6lcEQawkL6h}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{EOnxRuFun6cfXk-y9KPq5 → OXWK1FxsZh6lcEQawkL6h}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* entry が古く、再インストールで更新してほしいか。
|
|
3
|
+
* 古い entry でも取り決めの範囲内で自動更新は続ける(versions.ts 参照)。
|
|
4
|
+
*/
|
|
5
|
+
export declare function isEntryOutdated(): boolean;
|
|
6
|
+
/** entry が npm でインストールされたパッケージから起動しており、自動更新を使うか */
|
|
7
|
+
export declare function isAutoUpdateEnabled(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* 前回正常に起動した版と違う版(初めて起動する版)なら、マイグレーション前に DB を退避する。
|
|
10
|
+
* 起動に失敗すると entry がこの退避を戻して前の版で起動し直す。
|
|
11
|
+
*/
|
|
12
|
+
export declare function snapshotDbBeforeFirstStart(version: string): void;
|
|
13
|
+
/** 前の版が使っていたポートが空くまで待つ(上限付き) */
|
|
14
|
+
export declare function waitForPortsFree(ports: number[], timeoutMs?: number): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* 起動完了後、実行中より古いバージョンを消す(インストール済み・途中とも)。
|
|
17
|
+
* 実行中より新しいものはインストール中・再起動待ちの可能性があるため残す。
|
|
18
|
+
*/
|
|
19
|
+
export declare function removeVersionsOlderThan(version: string): void;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as net from 'node:net';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { ENTRY_PROTOCOL, compareVersions, getTsunagiDataDir, getVersionsDir, parseVersion, updateEntryState, } from './versions.js';
|
|
5
|
+
/**
|
|
6
|
+
* App-side part of the auto-update: everything the entry (cli.ts) leaves to
|
|
7
|
+
* the app, so that it can change with each version.
|
|
8
|
+
*/
|
|
9
|
+
/** 初めて起動するバージョンが書き換える可能性のあるファイル(データディレクトリからの相対パス) */
|
|
10
|
+
const DB_FILES = ['state/tsunagi.db', 'state/tsunagi.db-wal', 'state/tsunagi.db-shm'];
|
|
11
|
+
const SNAPSHOT_PREFIX = 'pre-update-';
|
|
12
|
+
const SNAPSHOT_RETENTION = 3;
|
|
13
|
+
/** entry から起動されたか。dev 起動(with-plugin.ts)や直接実行では null */
|
|
14
|
+
function getEntryProtocol() {
|
|
15
|
+
const value = Number(process.env.TSUNAGI_ENTRY_PROTOCOL);
|
|
16
|
+
return Number.isInteger(value) && value > 0 ? value : null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* entry が古く、再インストールで更新してほしいか。
|
|
20
|
+
* 古い entry でも取り決めの範囲内で自動更新は続ける(versions.ts 参照)。
|
|
21
|
+
*/
|
|
22
|
+
export function isEntryOutdated() {
|
|
23
|
+
const protocol = getEntryProtocol();
|
|
24
|
+
return protocol !== null && protocol < ENTRY_PROTOCOL;
|
|
25
|
+
}
|
|
26
|
+
/** entry が npm でインストールされたパッケージから起動しており、自動更新を使うか */
|
|
27
|
+
export function isAutoUpdateEnabled() {
|
|
28
|
+
return getEntryProtocol() !== null && process.env.TSUNAGI_AUTO_UPDATE === '1';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 前回正常に起動した版と違う版(初めて起動する版)なら、マイグレーション前に DB を退避する。
|
|
32
|
+
* 起動に失敗すると entry がこの退避を戻して前の版で起動し直す。
|
|
33
|
+
*/
|
|
34
|
+
export function snapshotDbBeforeFirstStart(version) {
|
|
35
|
+
const lastGood = process.env.TSUNAGI_LAST_GOOD;
|
|
36
|
+
if (!lastGood || lastGood === version || getEntryProtocol() === null)
|
|
37
|
+
return;
|
|
38
|
+
const dataDir = getTsunagiDataDir();
|
|
39
|
+
const backupsDir = path.join(dataDir, 'backups');
|
|
40
|
+
const dir = path.join(backupsDir, `${SNAPSHOT_PREFIX}${Date.now()}-v${version}`);
|
|
41
|
+
const files = {};
|
|
42
|
+
for (const file of DB_FILES) {
|
|
43
|
+
const src = path.join(dataDir, file);
|
|
44
|
+
files[file] = fs.existsSync(src);
|
|
45
|
+
if (!files[file])
|
|
46
|
+
continue;
|
|
47
|
+
fs.mkdirSync(path.dirname(path.join(dir, file)), { recursive: true });
|
|
48
|
+
fs.copyFileSync(src, path.join(dir, file));
|
|
49
|
+
}
|
|
50
|
+
updateEntryState((state) => ({ ...state, snapshot: { version, dir, files } }));
|
|
51
|
+
const snapshots = fs
|
|
52
|
+
.readdirSync(backupsDir)
|
|
53
|
+
.filter((name) => name.startsWith(SNAPSHOT_PREFIX))
|
|
54
|
+
.sort();
|
|
55
|
+
while (snapshots.length > SNAPSHOT_RETENTION) {
|
|
56
|
+
const oldest = snapshots.shift();
|
|
57
|
+
if (oldest)
|
|
58
|
+
fs.rmSync(path.join(backupsDir, oldest), { recursive: true, force: true });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** 前の版が使っていたポートが空くまで待つ(上限付き) */
|
|
62
|
+
export async function waitForPortsFree(ports, timeoutMs = 10_000) {
|
|
63
|
+
const isFree = (port) => new Promise((resolve) => {
|
|
64
|
+
const server = net.createServer();
|
|
65
|
+
server.once('error', () => resolve(false));
|
|
66
|
+
server.listen(port, '0.0.0.0', () => server.close(() => resolve(true)));
|
|
67
|
+
});
|
|
68
|
+
const deadline = Date.now() + timeoutMs;
|
|
69
|
+
while (Date.now() < deadline) {
|
|
70
|
+
const results = await Promise.all(ports.map(isFree));
|
|
71
|
+
if (results.every(Boolean))
|
|
72
|
+
return;
|
|
73
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 起動完了後、実行中より古いバージョンを消す(インストール済み・途中とも)。
|
|
78
|
+
* 実行中より新しいものはインストール中・再起動待ちの可能性があるため残す。
|
|
79
|
+
*/
|
|
80
|
+
export function removeVersionsOlderThan(version) {
|
|
81
|
+
let entries;
|
|
82
|
+
try {
|
|
83
|
+
entries = fs.readdirSync(getVersionsDir());
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
for (const name of entries) {
|
|
89
|
+
if (!parseVersion(name) || compareVersions(name, version) >= 0)
|
|
90
|
+
continue;
|
|
91
|
+
fs.rmSync(path.join(getVersionsDir(), name), { recursive: true, force: true });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract between the entry (dist/cli.js) and the app (dist/app.js).
|
|
3
|
+
*
|
|
4
|
+
* The entry ships only with a manually installed package, so an old entry may
|
|
5
|
+
* run a newer app for a long time. Keep everything here backward compatible:
|
|
6
|
+
* add fields and messages, never change or remove them.
|
|
7
|
+
*
|
|
8
|
+
* Layout:
|
|
9
|
+
* ~/.tsunagi/versions/<version>/ ← `npm install --prefix` target
|
|
10
|
+
* ~/.tsunagi/versions/<version>/.complete ← written after a verified install
|
|
11
|
+
* ~/.tsunagi/versions/<version>/node_modules/@minimalcorp/tsunagi/ ← package root (dist/app.js)
|
|
12
|
+
* ~/.tsunagi/versions/state.json ← EntryState
|
|
13
|
+
*
|
|
14
|
+
* Process:
|
|
15
|
+
* - The app sends `{ type: 'ready' }` over IPC once it serves requests.
|
|
16
|
+
* - The app exits with RESTART_EXIT_CODE to be started again (on `next`).
|
|
17
|
+
* - The entry passes TSUNAGI_ENTRY_PROTOCOL, TSUNAGI_ENTRY_PACKAGE_ROOT,
|
|
18
|
+
* TSUNAGI_LAST_GOOD, TSUNAGI_AUTO_UPDATE and TSUNAGI_RESTARTED to the app.
|
|
19
|
+
*
|
|
20
|
+
* The server (apps/server/src/lib/auto-update.ts) writes `next` after an install.
|
|
21
|
+
*/
|
|
22
|
+
/** app が「起動し直してほしい」ことを entry に伝える終了コード(EX_TEMPFAIL) */
|
|
23
|
+
export declare const RESTART_EXIT_CODE = 75;
|
|
24
|
+
/** entry と app の取り決めのバージョン。取り決めを足したら上げる */
|
|
25
|
+
export declare const ENTRY_PROTOCOL = 1;
|
|
26
|
+
export declare function getTsunagiDataDir(): string;
|
|
27
|
+
export declare function getVersionsDir(): string;
|
|
28
|
+
export declare function getPackageRootOf(version: string): string;
|
|
29
|
+
/** 検証済みのインストールがあり、app を起動できるか */
|
|
30
|
+
export declare function isInstalled(version: string): boolean;
|
|
31
|
+
export declare function parseVersion(version: string): number[] | null;
|
|
32
|
+
/** a と b の大小(x.y.z 以外は最も古い扱い) */
|
|
33
|
+
export declare function compareVersions(a: string, b: string): number;
|
|
34
|
+
/**
|
|
35
|
+
* 新しいバージョンを初めて起動する前に app が退避した DB。
|
|
36
|
+
* files はデータディレクトリからの相対パスと、退避時点で存在したか。
|
|
37
|
+
* 起動に失敗したら entry がこの一覧どおりに戻す(存在しなかったファイルは消す)。
|
|
38
|
+
*/
|
|
39
|
+
export interface DbSnapshot {
|
|
40
|
+
version: string;
|
|
41
|
+
dir: string;
|
|
42
|
+
files: Record<string, boolean>;
|
|
43
|
+
}
|
|
44
|
+
export interface EntryState {
|
|
45
|
+
/** 次に起動するバージョン(インストールが完了したら server が書く) */
|
|
46
|
+
next?: string | null;
|
|
47
|
+
/** 最後に起動完了(ready)まで到達したバージョン */
|
|
48
|
+
lastGood?: string | null;
|
|
49
|
+
/** 起動に失敗したため以後選ばないバージョン */
|
|
50
|
+
broken?: string[];
|
|
51
|
+
snapshot?: DbSnapshot | null;
|
|
52
|
+
/** 新しいバージョンが足したフィールドは消さずに残す */
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}
|
|
55
|
+
export declare function readEntryState(): EntryState;
|
|
56
|
+
export declare function getBrokenVersions(state: EntryState): string[];
|
|
57
|
+
/** 一時ファイルに書いてから rename で置き換える(書きかけの state を残さない) */
|
|
58
|
+
export declare function updateEntryState(update: (state: EntryState) => EntryState): void;
|
|
59
|
+
/** snapshot の一覧どおりにデータディレクトリのファイルを戻す */
|
|
60
|
+
export declare function restoreSnapshot(snapshot: DbSnapshot): void;
|
package/dist/versions.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as os from 'node:os';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
/**
|
|
5
|
+
* Contract between the entry (dist/cli.js) and the app (dist/app.js).
|
|
6
|
+
*
|
|
7
|
+
* The entry ships only with a manually installed package, so an old entry may
|
|
8
|
+
* run a newer app for a long time. Keep everything here backward compatible:
|
|
9
|
+
* add fields and messages, never change or remove them.
|
|
10
|
+
*
|
|
11
|
+
* Layout:
|
|
12
|
+
* ~/.tsunagi/versions/<version>/ ← `npm install --prefix` target
|
|
13
|
+
* ~/.tsunagi/versions/<version>/.complete ← written after a verified install
|
|
14
|
+
* ~/.tsunagi/versions/<version>/node_modules/@minimalcorp/tsunagi/ ← package root (dist/app.js)
|
|
15
|
+
* ~/.tsunagi/versions/state.json ← EntryState
|
|
16
|
+
*
|
|
17
|
+
* Process:
|
|
18
|
+
* - The app sends `{ type: 'ready' }` over IPC once it serves requests.
|
|
19
|
+
* - The app exits with RESTART_EXIT_CODE to be started again (on `next`).
|
|
20
|
+
* - The entry passes TSUNAGI_ENTRY_PROTOCOL, TSUNAGI_ENTRY_PACKAGE_ROOT,
|
|
21
|
+
* TSUNAGI_LAST_GOOD, TSUNAGI_AUTO_UPDATE and TSUNAGI_RESTARTED to the app.
|
|
22
|
+
*
|
|
23
|
+
* The server (apps/server/src/lib/auto-update.ts) writes `next` after an install.
|
|
24
|
+
*/
|
|
25
|
+
/** app が「起動し直してほしい」ことを entry に伝える終了コード(EX_TEMPFAIL) */
|
|
26
|
+
export const RESTART_EXIT_CODE = 75;
|
|
27
|
+
/** entry と app の取り決めのバージョン。取り決めを足したら上げる */
|
|
28
|
+
export const ENTRY_PROTOCOL = 1;
|
|
29
|
+
const PACKAGE_PATH = path.join('node_modules', '@minimalcorp', 'tsunagi');
|
|
30
|
+
const COMPLETE_MARKER = '.complete';
|
|
31
|
+
export function getTsunagiDataDir() {
|
|
32
|
+
return process.env.TSUNAGI_DATA_DIR || path.join(os.homedir(), '.tsunagi');
|
|
33
|
+
}
|
|
34
|
+
export function getVersionsDir() {
|
|
35
|
+
return path.join(getTsunagiDataDir(), 'versions');
|
|
36
|
+
}
|
|
37
|
+
export function getPackageRootOf(version) {
|
|
38
|
+
return path.join(getVersionsDir(), version, PACKAGE_PATH);
|
|
39
|
+
}
|
|
40
|
+
/** 検証済みのインストールがあり、app を起動できるか */
|
|
41
|
+
export function isInstalled(version) {
|
|
42
|
+
return (fs.existsSync(path.join(getVersionsDir(), version, COMPLETE_MARKER)) &&
|
|
43
|
+
fs.existsSync(path.join(getPackageRootOf(version), 'dist', 'app.js')));
|
|
44
|
+
}
|
|
45
|
+
export function parseVersion(version) {
|
|
46
|
+
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version.trim());
|
|
47
|
+
return match ? match.slice(1).map(Number) : null;
|
|
48
|
+
}
|
|
49
|
+
/** a と b の大小(x.y.z 以外は最も古い扱い) */
|
|
50
|
+
export function compareVersions(a, b) {
|
|
51
|
+
const va = parseVersion(a);
|
|
52
|
+
const vb = parseVersion(b);
|
|
53
|
+
if (!va || !vb)
|
|
54
|
+
return (va ? 1 : 0) - (vb ? 1 : 0);
|
|
55
|
+
for (let i = 0; i < 3; i++) {
|
|
56
|
+
if (va[i] !== vb[i])
|
|
57
|
+
return va[i] - vb[i];
|
|
58
|
+
}
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
function getStatePath() {
|
|
62
|
+
return path.join(getVersionsDir(), 'state.json');
|
|
63
|
+
}
|
|
64
|
+
export function readEntryState() {
|
|
65
|
+
try {
|
|
66
|
+
const raw = JSON.parse(fs.readFileSync(getStatePath(), 'utf-8'));
|
|
67
|
+
return raw && typeof raw === 'object' ? raw : {};
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return {};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export function getBrokenVersions(state) {
|
|
74
|
+
return Array.isArray(state.broken) ? state.broken.filter((v) => typeof v === 'string') : [];
|
|
75
|
+
}
|
|
76
|
+
/** 一時ファイルに書いてから rename で置き換える(書きかけの state を残さない) */
|
|
77
|
+
export function updateEntryState(update) {
|
|
78
|
+
const next = update(readEntryState());
|
|
79
|
+
const statePath = getStatePath();
|
|
80
|
+
fs.mkdirSync(path.dirname(statePath), { recursive: true });
|
|
81
|
+
const tmpPath = `${statePath}.${process.pid}.tmp`;
|
|
82
|
+
fs.writeFileSync(tmpPath, JSON.stringify(next, null, 2), 'utf-8');
|
|
83
|
+
fs.renameSync(tmpPath, statePath);
|
|
84
|
+
}
|
|
85
|
+
/** snapshot の一覧どおりにデータディレクトリのファイルを戻す */
|
|
86
|
+
export function restoreSnapshot(snapshot) {
|
|
87
|
+
const dataDir = getTsunagiDataDir();
|
|
88
|
+
for (const [file, existed] of Object.entries(snapshot.files)) {
|
|
89
|
+
const dest = path.join(dataDir, file);
|
|
90
|
+
if (existed)
|
|
91
|
+
fs.copyFileSync(path.join(snapshot.dir, file), dest);
|
|
92
|
+
else
|
|
93
|
+
fs.rmSync(dest, { force: true });
|
|
94
|
+
}
|
|
95
|
+
}
|
package/dist/with-plugin.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { spawn } from 'node:child_process';
|
|
3
|
-
import {
|
|
3
|
+
import { assertClaudeSupportsPluginDirs, getPluginDir, removeLegacyPluginInstall, } from './plugin-lifecycle.js';
|
|
4
4
|
/**
|
|
5
5
|
* Development wrapper:
|
|
6
|
-
* 1.
|
|
6
|
+
* 1. Pass the Claude Code plugin dir to the server via TSUNAGI_PLUGIN_DIR
|
|
7
7
|
* 2. Spawn `npm run dev -w @minimalcorp/tsunagi-web` and
|
|
8
8
|
* `npm run dev -w @minimalcorp/tsunagi-server` concurrently
|
|
9
9
|
*
|
|
@@ -15,7 +15,10 @@ if (mode !== 'dev' && mode !== 'start') {
|
|
|
15
15
|
console.error('Usage: tsx src/with-plugin.ts <dev|start>');
|
|
16
16
|
process.exit(1);
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
assertClaudeSupportsPluginDirs();
|
|
19
|
+
removeLegacyPluginInstall();
|
|
20
|
+
// 子プロセス(concurrently → server)に継承させる
|
|
21
|
+
process.env.TSUNAGI_PLUGIN_DIR = getPluginDir();
|
|
19
22
|
const webCmd = mode === 'dev'
|
|
20
23
|
? 'npm run dev -w @minimalcorp/tsunagi-web'
|
|
21
24
|
: 'npm run start -w @minimalcorp/tsunagi-web';
|
|
@@ -48,15 +51,10 @@ function shutdown(code) {
|
|
|
48
51
|
// ignore
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
|
-
cleanupPluginState();
|
|
52
54
|
process.exit(code);
|
|
53
55
|
}
|
|
54
56
|
process.on('SIGINT', () => shutdown(0));
|
|
55
57
|
process.on('SIGTERM', () => shutdown(0));
|
|
56
|
-
process.on('exit', () => {
|
|
57
|
-
if (!shuttingDown)
|
|
58
|
-
cleanupPluginState();
|
|
59
|
-
});
|
|
60
58
|
process.on('uncaughtException', (err) => {
|
|
61
59
|
console.error('[tsunagi] Uncaught exception:', err);
|
|
62
60
|
shutdown(1);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minimalcorp/tsunagi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@minimalcorp/tsunagi",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.2.0",
|
|
10
10
|
"license": "SEE LICENSE IN LICENSE",
|
|
11
11
|
"os": [
|
|
12
12
|
"darwin",
|
|
@@ -2252,9 +2252,9 @@
|
|
|
2252
2252
|
}
|
|
2253
2253
|
},
|
|
2254
2254
|
"node_modules/exsolve": {
|
|
2255
|
-
"version": "1.1.
|
|
2256
|
-
"resolved": "https://registry.npmjs.org/exsolve/-/exsolve-1.1.
|
|
2257
|
-
"integrity": "sha512-
|
|
2255
|
+
"version": "1.1.3",
|
|
2256
|
+
"resolved": "https://registry.npmjs.org/exsolve/-/exsolve-1.1.3.tgz",
|
|
2257
|
+
"integrity": "sha512-kuzL9zherLQoqDeQaS55AiiIg1kb4KYXaSusTtgZTPlvKP2gGCI82LNmBNh5RjDVUXIcmgx+/Mx7vPwRzBbhJA==",
|
|
2258
2258
|
"license": "MIT"
|
|
2259
2259
|
},
|
|
2260
2260
|
"node_modules/fast-check": {
|
|
@@ -2659,9 +2659,9 @@
|
|
|
2659
2659
|
}
|
|
2660
2660
|
},
|
|
2661
2661
|
"node_modules/hono": {
|
|
2662
|
-
"version": "4.13.
|
|
2663
|
-
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.
|
|
2664
|
-
"integrity": "sha512-
|
|
2662
|
+
"version": "4.13.13",
|
|
2663
|
+
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.13.tgz",
|
|
2664
|
+
"integrity": "sha512-CQ46U0ZkAGmbT/4UxdzzGJpacP2IeKgY4a5/tOI9AABbpOMfK739wfDXmv1usCk+3RkKj1hQy4/fjhiwa2xlrA==",
|
|
2665
2665
|
"license": "MIT",
|
|
2666
2666
|
"engines": {
|
|
2667
2667
|
"node": ">=16.9.0"
|
package/package.json
CHANGED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[84454,65486,80056,43715,a=>{"use strict";var b=a.i(30685),c=(0,a.i(17508).default)(Object.keys,Object),d=Object.prototype.hasOwnProperty;let e=function(a){if(!(0,b.default)(a))return c(a);var e=[];for(var f in Object(a))d.call(a,f)&&"constructor"!=f&&e.push(f);return e};a.s(["default",0,e],65486);var f=a.i(37991),g=a.i(11253),h=(0,f.default)(g.default,"DataView"),i=a.i(38141),j=(0,f.default)(g.default,"Promise"),k=(0,f.default)(g.default,"Set");a.s(["default",0,k],80056);var l=(0,f.default)(g.default,"WeakMap"),m=a.i(35102),n=a.i(12098),o="[object Map]",p="[object Promise]",q="[object Set]",r="[object WeakMap]",s="[object DataView]",t=(0,n.default)(h),u=(0,n.default)(i.default),v=(0,n.default)(j),w=(0,n.default)(k),x=(0,n.default)(l),y=m.default;(h&&y(new h(new ArrayBuffer(1)))!=s||i.default&&y(new i.default)!=o||j&&y(j.resolve())!=p||k&&y(new k)!=q||l&&y(new l)!=r)&&(y=function(a){var b=(0,m.default)(a),c="[object Object]"==b?a.constructor:void 0,d=c?(0,n.default)(c):"";if(d)switch(d){case t:return s;case u:return o;case v:return p;case w:return q;case x:return r}return b});let z=y;a.s(["default",0,z],43715);var A=a.i(62244),B=a.i(66723),C=a.i(68378),D=a.i(12999),E=a.i(56814),F=Object.prototype.hasOwnProperty;a.s(["default",0,function(a){if(null==a)return!0;if((0,C.default)(a)&&((0,B.default)(a)||"string"==typeof a||"function"==typeof a.splice||(0,D.default)(a)||(0,E.default)(a)||(0,A.default)(a)))return!a.length;var c=z(a);if("[object Map]"==c||"[object Set]"==c)return!a.size;if((0,b.default)(a))return!e(a).length;for(var d in a)if(F.call(a,d))return!1;return!0}],84454)},73160,a=>{"use strict";var b=a.i(14562),c=a.i(34603);a.i(75930);var d=a.i(71731),e=(0,c.__name)(a=>{let{securityLevel:c}=(0,b.getConfig2)(),e=(0,d.select)("body");if("sandbox"===c){let b=(0,d.select)(`#i${a}`),c=b.node()?.contentDocument??document;e=(0,d.select)(c.body)}return e.select(`#${a}`)},"selectSvgElement");a.s(["selectSvgElement",0,e])},210,a=>{"use strict";let b=(0,a.i(60137).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);a.s(["ArrowLeft",0,b],210)},99464,92e3,4975,a=>{"use strict";var b=a.i(60137);let c=(0,b.default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);a.s(["Pencil",0,c],99464);let d=(0,b.default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);a.s(["AlertCircle",0,d],92e3);let e=(0,b.default)("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]);a.s(["Mic",0,e],4975)},94392,a=>{"use strict";let b=(0,a.i(60137).default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);a.s(["Cpu",0,b],94392)},1464,a=>{"use strict";var b=a.i(87924),c=a.i(94392);function d(a){return(0,b.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...a,children:(0,b.jsx)("path",{d:"M16.361 10.26a.894.894 0 0 0-.558.47l-.072.148.001.207c0 .193.004.217.059.353.076.193.152.312.291.448.24.238.51.3.872.205a.86.86 0 0 0 .517-.436.752.752 0 0 0 .08-.498c-.064-.453-.33-.782-.724-.897a1.06 1.06 0 0 0-.466 0zm-9.203.005c-.305.096-.533.32-.65.639a1.187 1.187 0 0 0-.06.52c.057.309.31.59.598.667.362.095.632.033.872-.205.14-.136.215-.255.291-.448.055-.136.059-.16.059-.353l.001-.207-.072-.148a.894.894 0 0 0-.565-.472 1.02 1.02 0 0 0-.474.007Zm4.184 2c-.131.071-.223.25-.195.383.031.143.157.288.353.407.105.063.112.072.117.136.004.038-.01.146-.029.243-.02.094-.036.194-.036.222.002.074.07.195.143.253.064.052.076.054.255.059.164.005.198.001.264-.03.169-.082.212-.234.15-.525-.052-.243-.042-.28.087-.355.137-.08.281-.219.324-.314a.365.365 0 0 0-.175-.48.394.394 0 0 0-.181-.033c-.126 0-.207.03-.355.124l-.085.053-.053-.032c-.219-.13-.259-.145-.391-.143a.396.396 0 0 0-.193.032zm.39-2.195c-.373.036-.475.05-.654.086-.291.06-.68.195-.951.328-.94.46-1.589 1.226-1.787 2.114-.04.176-.045.234-.045.53 0 .294.005.357.043.524.264 1.16 1.332 2.017 2.714 2.173.3.033 1.596.033 1.896 0 1.11-.125 2.064-.727 2.493-1.571.114-.226.169-.372.22-.602.039-.167.044-.23.044-.523 0-.297-.005-.355-.045-.531-.288-1.29-1.539-2.304-3.072-2.497a6.873 6.873 0 0 0-.855-.031zm.645.937a3.283 3.283 0 0 1 1.44.514c.223.148.537.458.671.662.166.251.26.508.303.82.02.143.01.251-.043.482-.08.345-.332.705-.672.957a3.115 3.115 0 0 1-.689.348c-.382.122-.632.144-1.525.138-.582-.006-.686-.01-.853-.042-.57-.107-1.022-.334-1.35-.68-.264-.28-.385-.535-.45-.946-.03-.192.025-.509.137-.776.136-.326.488-.73.836-.963.403-.269.934-.46 1.422-.512.187-.02.586-.02.773-.002zm-5.503-11a1.653 1.653 0 0 0-.683.298C5.617.74 5.173 1.666 4.985 2.819c-.07.436-.119 1.04-.119 1.503 0 .544.064 1.24.155 1.721.02.107.031.202.023.208a8.12 8.12 0 0 1-.187.152 5.324 5.324 0 0 0-.949 1.02 5.49 5.49 0 0 0-.94 2.339 6.625 6.625 0 0 0-.023 1.357c.091.78.325 1.438.727 2.04l.13.195-.037.064c-.269.452-.498 1.105-.605 1.732-.084.496-.095.629-.095 1.294 0 .67.009.803.088 1.266.095.555.288 1.143.503 1.534.071.128.243.393.264.407.007.003-.014.067-.046.141a7.405 7.405 0 0 0-.548 1.873c-.062.417-.071.552-.071.991 0 .56.031.832.148 1.279L3.42 24h1.478l-.05-.091c-.297-.552-.325-1.575-.068-2.597.117-.472.25-.819.498-1.296l.148-.29v-.177c0-.165-.003-.184-.057-.293a.915.915 0 0 0-.194-.25 1.74 1.74 0 0 1-.385-.543c-.424-.92-.506-2.286-.208-3.451.124-.486.329-.918.544-1.154a.787.787 0 0 0 .223-.531c0-.195-.07-.355-.224-.522a3.136 3.136 0 0 1-.817-1.729c-.14-.96.114-2.005.69-2.834.563-.814 1.353-1.336 2.237-1.475.199-.033.57-.028.776.01.226.04.367.028.512-.041.179-.085.268-.19.374-.431.093-.215.165-.333.36-.576.234-.29.46-.489.822-.729.413-.27.884-.467 1.352-.561.17-.035.25-.04.569-.04.319 0 .398.005.569.04a4.07 4.07 0 0 1 1.914.997c.117.109.398.457.488.602.034.057.095.177.132.267.105.241.195.346.374.43.14.068.286.082.503.045.343-.058.607-.053.943.016 1.144.23 2.14 1.173 2.581 2.437.385 1.108.276 2.267-.296 3.153-.097.15-.193.27-.333.419-.301.322-.301.722-.001 1.053.493.539.801 1.866.708 3.036-.062.772-.26 1.463-.533 1.854a2.096 2.096 0 0 1-.224.258.916.916 0 0 0-.194.25c-.054.109-.057.128-.057.293v.178l.148.29c.248.476.38.823.498 1.295.253 1.008.231 2.01-.059 2.581a.845.845 0 0 0-.044.098c0 .006.329.009.732.009h.73l.02-.074.036-.134c.019-.076.057-.3.088-.516.029-.217.029-1.016 0-1.258-.11-.875-.295-1.57-.597-2.226-.032-.074-.053-.138-.046-.141.008-.005.057-.074.108-.152.376-.569.607-1.284.724-2.228.031-.26.031-1.378 0-1.628-.083-.645-.182-1.082-.348-1.525a6.083 6.083 0 0 0-.329-.7l-.038-.064.131-.194c.402-.604.636-1.262.727-2.04a6.625 6.625 0 0 0-.024-1.358 5.512 5.512 0 0 0-.939-2.339 5.325 5.325 0 0 0-.95-1.02 8.097 8.097 0 0 1-.186-.152.692.692 0 0 1 .023-.208c.208-1.087.201-2.443-.017-3.503-.19-.924-.535-1.658-.98-2.082-.354-.338-.716-.482-1.15-.455-.996.059-1.8 1.205-2.116 3.01a6.805 6.805 0 0 0-.097.726c0 .036-.007.066-.015.066a.96.96 0 0 1-.149-.078A4.857 4.857 0 0 0 12 3.03c-.832 0-1.687.243-2.456.698a.958.958 0 0 1-.148.078c-.008 0-.015-.03-.015-.066a6.71 6.71 0 0 0-.097-.725C8.997 1.392 8.337.319 7.46.048a2.096 2.096 0 0 0-.585-.041Zm.293 1.402c.248.197.523.759.682 1.388.03.113.06.244.069.292.007.047.026.152.041.233.067.365.098.76.102 1.24l.002.475-.12.175-.118.178h-.278c-.324 0-.646.041-.954.124l-.238.06c-.033.007-.038-.003-.057-.144a8.438 8.438 0 0 1 .016-2.323c.124-.788.413-1.501.696-1.711.067-.05.079-.049.157.013zm9.825-.012c.17.126.358.46.498.888.28.854.36 2.028.212 3.145-.019.14-.024.151-.057.144l-.238-.06a3.693 3.693 0 0 0-.954-.124h-.278l-.119-.178-.119-.175.002-.474c.004-.669.066-1.19.214-1.772.157-.623.434-1.185.68-1.382.078-.062.09-.063.159-.012z"})})}function e(a){return(0,b.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...a,children:(0,b.jsx)("path",{d:"M14.025 0c3.492 0 5.237 0 6.571.68a6.24 6.24 0 0 1 2.725 2.724C24 4.738 24 6.484 24 9.975v4.05c0 3.492 0 5.237-.68 6.571a6.24 6.24 0 0 1-2.724 2.725c-1.334.679-3.08.679-6.571.679h-4.05c-3.492 0-5.237 0-6.571-.68A6.24 6.24 0 0 1 .68 20.597C0 19.262 0 17.516 0 14.025v-4.05c0-3.492 0-5.237.68-6.571A6.23 6.23 0 0 1 3.404.68C4.738 0 6.484 0 9.975 0zM7.688 16.313a1.313 1.313 0 0 0 0 2.625h11.625a1.313 1.313 0 0 0 0-2.625zm-3-3.75a1.313 1.313 0 0 0 0 2.624h11.625a1.313 1.313 0 0 0 0-2.624zm3-3.75a1.313 1.313 0 0 0 0 2.624h11.625a1.313 1.313 0 0 0 0-2.624zm-3-3.75a1.313 1.313 0 0 0 0 2.625h11.625a1.313 1.313 0 0 0 0-2.625z"})})}let f={ollama:d,lmstudio:e};function g({provider:a,...c}){let d=f[a];return(0,b.jsx)(d,{...c})}a.s(["ClaudeIcon",0,function(a){return(0,b.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...a,children:(0,b.jsx)("path",{d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"})})},"LmStudioIcon",0,e,"LocalLlmIcon",0,g,"LocalLlmTabIcon",0,function({provider:a,className:d}){return a?(0,b.jsx)(g,{provider:a,className:d}):(0,b.jsx)(c.Cpu,{className:d})},"OllamaIcon",0,d])},29801,a=>{"use strict";let b={ollama:"Ollama",lmstudio:"LM Studio"};a.s(["LOCAL_LLM_PROVIDER_LABEL",0,b,"localLlmTabLabel",0,function(a){return a?b[a]:"ローカルLLM"}])},46057,a=>{"use strict";a.s(["VOICE_INPUT_ENABLED_STORAGE_KEY",0,"tsunagi:voice-input-enabled","WHISPER_PROMPT_STORAGE_KEY",0,"tsunagi:whisper-prompt"])},25015,a=>{"use strict";let b=(0,a.i(60137).default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);a.s(["Play",0,b],25015)},12223,a=>{"use strict";var b=a.i(72131),c=a.i(91399);function d(a){let[d,e]=(0,b.useState)(null),f=(0,b.useCallback)(async()=>{try{let b=await fetch((0,c.apiUrl)(`/api/settings/${a}`));if(!b.ok)throw Error(`HTTP ${b.status}`);let d=await b.json();e(d.data)}catch(b){console.error(`Failed to fetch ${a} settings:`,b),e(null)}},[a]);return(0,b.useEffect)(()=>{f()},[f]),{settings:d,setSettings:e,reload:f}}a.s(["useLmStudioSettings",0,function(){return d("lmstudio")},"useLocalLlmSettings",0,function(){return d("local-llm")},"useOllamaSettings",0,function(){return d("ollama")}])},11989,a=>{"use strict";let b=(0,a.i(60137).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);a.s(["default",0,b])},92025,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_katex_dist_katex_mjs_0zuygmo._.js"].map(b=>a.l(b))).then(()=>b(48986)))},69e3,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_lodash-es_0yap81y._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_dagre-KV5264BT_mjs_0aqvo3i._.js","server/chunks/ssr/node_modules_lodash-es_091xgk5._.js","server/chunks/ssr/node_modules_dagre-d3-es_src_dagre_index_097t5l0.js","server/chunks/ssr/node_modules_103v9xp._.js"].map(b=>a.l(b))).then(()=>b(55868)))},71331,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_0hsalo_._.js","server/chunks/ssr/node_modules_cytoscape_dist_cytoscape_esm_mjs_0642y5z._.js"].map(b=>a.l(b))).then(()=>b(3671)))},99987,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-YZCP3GAM_mjs_04sswi2._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_c4Diagram-AHTNJAMY_mjs_0mw4ioe._.js"].map(b=>a.l(b))).then(()=>b(42357)))},48308,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_08av5m5._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_flowDiagram-DWJPFMVM_mjs_11yfm2v._.js"].map(b=>a.l(b))).then(()=>b(26594)))},74667,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_07xyphe._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_erDiagram-SMLLAGMA_mjs_0ti8x~s._.js"].map(b=>a.l(b))).then(()=>b(35543)))},15498,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_0s3mkxs._.js","server/chunks/ssr/[root-of-the-server]__0qtqq5d._.js","server/chunks/ssr/node_modules_0gvdioh._.js","server/chunks/ssr/node_modules_lodash-es_01jun1r._.js","server/chunks/ssr/0_lp_modules_mermaid_dist_chunks_mermaid_core_gitGraphDiagram-UUTBAWPF_mjs_0dvv8~.._.js"].map(b=>a.l(b))).then(()=>b(2421)))},24500,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_0q8gl61._.js","server/chunks/ssr/node_modules_0t03q3z._.js"].map(b=>a.l(b))).then(()=>b(37521)))},78102,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_09nusj_._.js","server/chunks/ssr/[root-of-the-server]__0ff1foz._.js","server/chunks/ssr/node_modules_lodash-es_01jun1r._.js","server/chunks/ssr/node_modules_0gvdioh._.js"].map(b=>a.l(b))).then(()=>b(86618)))},94433,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_0mt.8za._.js","server/chunks/ssr/[root-of-the-server]__0n2qong._.js","server/chunks/ssr/node_modules_lodash-es_01jun1r._.js","server/chunks/ssr/node_modules_0gvdioh._.js"].map(b=>a.l(b))).then(()=>b(28018)))},65122,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_0m8d9.a._.js","server/chunks/ssr/0_lp_modules_mermaid_dist_chunks_mermaid_core_quadrantDiagram-34T5L4WZ_mjs_05wge~v._.js"].map(b=>a.l(b))).then(()=>b(40628)))},6687,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_0j1i92p._.js","server/chunks/ssr/0_lp_modules_mermaid_dist_chunks_mermaid_core_xychartDiagram-5P7HB3ND_mjs_0wwuvw2._.js"].map(b=>a.l(b))).then(()=>b(7451)))},18402,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_04x.vut._.js","server/chunks/ssr/0t6k_mermaid_dist_chunks_mermaid_core_requirementDiagram-MS252O5E_mjs_048lezu._.js"].map(b=>a.l(b))).then(()=>b(90431)))},92739,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_0w_54yy._.js","server/chunks/ssr/0_lp_modules_mermaid_dist_chunks_mermaid_core_sequenceDiagram-FGHM5R23_mjs_12c7k-5._.js"].map(b=>a.l(b))).then(()=>b(67397)))},32256,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_0o900rn._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-4TB4RGXK_mjs_0ie15wz._.js"].map(b=>a.l(b))).then(()=>b(55252)))},51050,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_03f~che._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-4TB4RGXK_mjs_0ie15wz._.js"].map(b=>a.l(b))).then(()=>b(12084)))},33430,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_0mwl~df._.js","server/chunks/ssr/node_modules_lodash-es_091xgk5._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_stateDiagram-FHFEXIEX_mjs_0mg2~ri._.js","server/chunks/ssr/node_modules_dagre-d3-es_src_dagre_index_097t5l0.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-OYMX7WX6_mjs_087i3.l._.js","server/chunks/ssr/node_modules_103v9xp._.js"].map(b=>a.l(b))).then(()=>b(55905)))},43021,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_0cje6no._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-OYMX7WX6_mjs_087i3.l._.js"].map(b=>a.l(b))).then(()=>b(79891)))},21261,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_0_09.d-._.js","server/chunks/ssr/0_lp_modules_mermaid_dist_chunks_mermaid_core_journeyDiagram-VCZTEJTY_mjs_0q7b_tk._.js"].map(b=>a.l(b))).then(()=>b(47598)))},50244,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_d3-shape_src_arc_135n374.js","server/chunks/ssr/0t6k_mermaid_dist_chunks_mermaid_core_timeline-definition-GMOUNBTQ_mjs_0y7flug._.js"].map(b=>a.l(b))).then(()=>b(98138)))},54532,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_04x.vut._.js","server/chunks/ssr/0t6k_mermaid_dist_chunks_mermaid_core_mindmap-definition-QFDTVHPH_mjs_0ie03qp._.js"].map(b=>a.l(b))).then(()=>b(73348)))},42598,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-FMBD7UC4_mjs_0dox0y0._.js","server/chunks/ssr/0_lp_modules_mermaid_dist_chunks_mermaid_core_kanban-definition-6JOO6SKY_mjs_0b8_92c._.js"].map(b=>a.l(b))).then(()=>b(78776)))},18652,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_d3-scale_src_0~kn3a6._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_sankeyDiagram-XADWPNL6_mjs_0akor_o._.js"].map(b=>a.l(b))).then(()=>b(88909)))},9099,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_09e0q95._.js","server/chunks/ssr/[root-of-the-server]__0hhfi7s._.js","server/chunks/ssr/node_modules_lodash-es_01jun1r._.js","server/chunks/ssr/node_modules_0gvdioh._.js"].map(b=>a.l(b))).then(()=>b(20145)))},35140,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_0axuayq._.js","server/chunks/ssr/[root-of-the-server]__0hhfi7s._.js","server/chunks/ssr/node_modules_lodash-es_01jun1r._.js","server/chunks/ssr/node_modules_0gvdioh._.js"].map(b=>a.l(b))).then(()=>b(42910)))},56125,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_0omx0o-._.js","server/chunks/ssr/node_modules_0heie6p._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_blockDiagram-DXYQGD6D_mjs_13mbtfc._.js","server/chunks/ssr/node_modules_lodash-es_0egjqeu._.js"].map(b=>a.l(b))).then(()=>b(68669)))},54269,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_10v5lct._.js","server/chunks/ssr/[root-of-the-server]__0cl-0al._.js","server/chunks/ssr/node_modules_lodash-es_01jun1r._.js","server/chunks/ssr/node_modules_0gvdioh._.js"].map(b=>a.l(b))).then(()=>b(58204)))},97375,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_0w8sswp._.js","server/chunks/ssr/node_modules_lodash-es_01jun1r._.js","server/chunks/ssr/[root-of-the-server]__0e2_bho._.js","server/chunks/ssr/node_modules_0gvdioh._.js","server/chunks/ssr/node_modules_0sqcrg2._.js","server/chunks/ssr/node_modules_cytoscape_dist_cytoscape_esm_mjs_0642y5z._.js"].map(b=>a.l(b))).then(()=>b(29821)))},70868,a=>{a.v(b=>Promise.all(["server/chunks/ssr/0_lp_modules_mermaid_dist_chunks_mermaid_core_ishikawaDiagram-UXIWVN3A_mjs_0gpauwj._.js"].map(b=>a.l(b))).then(()=>b(5822)))},5494,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_vennDiagram-DHZGUBPP_mjs_013wte~._.js"].map(b=>a.l(b))).then(()=>b(65580)))},41872,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_06gyfuv._.js","server/chunks/ssr/[root-of-the-server]__0sha5xx._.js","server/chunks/ssr/node_modules_lodash-es_01jun1r._.js","server/chunks/ssr/node_modules_0gvdioh._.js","server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_diagram-G4DWMVQ6_mjs_108p.po._.js"].map(b=>a.l(b))).then(()=>b(52172)))},40744,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_0w8sswp._.js","server/chunks/ssr/[root-of-the-server]__0e2_bho._.js","server/chunks/ssr/node_modules_0gvdioh._.js","server/chunks/ssr/node_modules_lodash-es_01jun1r._.js","server/chunks/ssr/0_lp_modules_mermaid_dist_chunks_mermaid_core_wardleyDiagram-NUSXRM2D_mjs_0579rrr._.js"].map(b=>a.l(b))).then(()=>b(2410)))},43985,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[root-of-the-server]__11y.qj~._.js"].map(b=>a.l(b))).then(()=>b(92377)))}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=_0hqrmyz._.js.map
|