hypeframe 0.8.1 → 0.8.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.
Files changed (2) hide show
  1. package/dist/index.js +258 -39
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -292,7 +292,29 @@ Tekan Esc untuk melewati satu langkah. Panduan ini bisa dibuka lagi dari Bantuan
292
292
  "agent.needLogin": "perlu masuk akun",
293
293
  "agent.notInstalled": "belum dipasang",
294
294
  "agent.add": "Pasang dan masuk akun",
295
- "agent.login": "Masuk akun lagi (ganti akun)",
295
+ "agent.login": "Ganti akun (keluar, lalu masuk dengan akun lain)",
296
+ "agent.logout": "Keluar akun",
297
+ "agent.ownApi": "Pakai URL API sendiri (alamat + kunci API)",
298
+ "agent.ownApiChange": "Ganti API sendiri ({host})",
299
+ "agent.ownApiOff": "Berhenti memakai API sendiri",
300
+ "agent.ownApiOffDone": "OpenCode kembali memakai penyedia bawaannya.",
301
+ "agent.ownApiTag": "API sendiri ({host})",
302
+ "agent.apiUrl": "Alamat API (kompatibel OpenAI, biasanya berakhiran /v1)",
303
+ "agent.apiUrlBad": "Alamat harus diawali http:// atau https://",
304
+ "agent.apiKey": "Kunci API (kosongkan kalau servernya tidak memakai kunci)",
305
+ "agent.apiModelsLoading": "Mengambil daftar model dari alamat itu...",
306
+ "agent.apiModelsFound": "{n} model ditemukan",
307
+ "agent.apiModelsNone": "Daftar model tidak bisa diambil, ketik nama modelnya",
308
+ "agent.apiModel": "Model utama (model lain di daftar tetap bisa dipilih di HypeFrame Web)",
309
+ "agent.apiModelType": "Nama model persis seperti di penyedianya (mis. gpt-4o-mini)",
310
+ "agent.apiSaved": "OpenCode memakai {host}, model {model}. Kunci disimpan di perangkat ini saja.",
311
+ "agent.apiNotReady": "OpenCode belum bisa membuka obrolan dengan API ini. Periksa alamat, kunci, dan nama modelnya, lalu coba lagi.",
312
+ "agent.logoutAsk": "Keluar dari akun {name} di perangkat ini?",
313
+ "agent.loggingOut": "Keluar dari akun {name}...",
314
+ "agent.loggedOut": "{name} sudah keluar akun. Pilih Masuk akun untuk memakai akun lain.",
315
+ "agent.keyRemoved": "Kunci {name} yang disimpan HypeFrame sudah dihapus.",
316
+ "agent.logoutUnsupported": "{name} tidak menyediakan keluar akun dari luar aplikasinya. Pilih Ganti akun: masuk dengan akun lain menggantikan akun lama.",
317
+ "agent.logoutRestart": "Mesin sedang menyala: matikan lalu nyalakan lagi supaya {name} berhenti memakai akun lama.",
296
318
  "agent.remove": "Hapus dari perangkat ini",
297
319
  "agent.back": "Kembali",
298
320
  "agent.installing": "Memasang {name} dari daftar resmi ACP...",
@@ -540,7 +562,29 @@ Press Esc to skip a step. You can open this guide again from Help & maintenance.
540
562
  "agent.needLogin": "needs login",
541
563
  "agent.notInstalled": "not installed",
542
564
  "agent.add": "Install and log in",
543
- "agent.login": "Log in again (switch account)",
565
+ "agent.login": "Switch account (sign out, then sign in with another account)",
566
+ "agent.logout": "Sign out",
567
+ "agent.ownApi": "Use your own API URL (address + API key)",
568
+ "agent.ownApiChange": "Change own API ({host})",
569
+ "agent.ownApiOff": "Stop using own API",
570
+ "agent.ownApiOffDone": "OpenCode is back on its own providers.",
571
+ "agent.ownApiTag": "own API ({host})",
572
+ "agent.apiUrl": "API address (OpenAI-compatible, usually ending in /v1)",
573
+ "agent.apiUrlBad": "The address must start with http:// or https://",
574
+ "agent.apiKey": "API key (leave empty if the server needs none)",
575
+ "agent.apiModelsLoading": "Getting the model list from that address...",
576
+ "agent.apiModelsFound": "{n} models found",
577
+ "agent.apiModelsNone": "Could not get the model list, type the model name",
578
+ "agent.apiModel": "Main model (the other models in the list stay pickable in HypeFrame Web)",
579
+ "agent.apiModelType": "Model name exactly as the provider calls it (e.g. gpt-4o-mini)",
580
+ "agent.apiSaved": "OpenCode uses {host}, model {model}. The key is kept on this device only.",
581
+ "agent.apiNotReady": "OpenCode cannot open a chat with this API yet. Check the address, key and model name, then try again.",
582
+ "agent.logoutAsk": "Sign out of {name} on this device?",
583
+ "agent.loggingOut": "Signing out of {name}...",
584
+ "agent.loggedOut": "{name} is signed out. Pick Log in to use another account.",
585
+ "agent.keyRemoved": "The {name} key saved by HypeFrame was removed.",
586
+ "agent.logoutUnsupported": "{name} offers no sign-out from outside its own app. Pick Switch account: signing in with another account replaces the old one.",
587
+ "agent.logoutRestart": "The engine is running: stop it and start it again so {name} stops using the old account.",
544
588
  "agent.remove": "Remove from this device",
545
589
  "agent.back": "Back",
546
590
  "agent.installing": "Installing {name} from the official ACP registry...",
@@ -781,7 +825,7 @@ import path7 from "node:path";
781
825
  // package.json
782
826
  var package_default = {
783
827
  name: "hypeframe",
784
- version: "0.8.1",
828
+ version: "0.8.2",
785
829
  description: "Local engine for HypeFrame Web: code clips, video renders and AI agents run on your own machine; the web is just the view.",
786
830
  keywords: [
787
831
  "hypeframe",
@@ -1285,8 +1329,14 @@ class AgentSessions {
1285
1329
  const proc = new AcpProcess;
1286
1330
  proc.onRequest = (m, p) => this.fromAgent(agentId, m, p);
1287
1331
  proc.onNotification = (m, p) => {
1288
- if (m === "session/update")
1289
- this.queue(`${agentId}/${String(p?.sessionId ?? "")}`, p?.update);
1332
+ if (m !== "session/update")
1333
+ return;
1334
+ const key = `${agentId}/${String(p?.sessionId ?? "")}`;
1335
+ const u = p?.update;
1336
+ const s = this.sessions.get(key);
1337
+ if (s && /^config_options?_update$/.test(String(u?.sessionUpdate ?? "")) && Array.isArray(u?.configOptions))
1338
+ s.opsi = { ...s.opsi, configOptions: safeConfig(u.configOptions) };
1339
+ this.queue(key, u);
1290
1340
  };
1291
1341
  proc.on("exit", (code) => {
1292
1342
  if (this.procs.get(agentId)?.proc === proc)
@@ -1387,9 +1437,17 @@ class AgentSessions {
1387
1437
  const e = this.procs.get(s.agentId);
1388
1438
  if (!e)
1389
1439
  throw new Error("Agent stopped");
1390
- const id = String(o.id ?? "").slice(0, 100);
1440
+ let id = String(o.id ?? "").slice(0, 100);
1391
1441
  const value = String(o.nilai ?? "").slice(0, 200);
1392
- const config = s.opsi?.configOptions?.find((c) => c.id === id);
1442
+ const current = s.opsi?.configOptions ?? [];
1443
+ let config = current.find((c) => c.id === id);
1444
+ if (!config && current.length && o.jenis !== "model" && o.jenis !== "mode") {
1445
+ const hint = String(o.nama ?? "").trim().toLowerCase();
1446
+ config = hint ? current.find((c) => String(c.name ?? "").trim().toLowerCase() === hint || String(c.category ?? "").toLowerCase() === hint) : undefined;
1447
+ if (!config)
1448
+ throw new Error("This choice is no longer offered by the agent. Start a new chat to see its current choices.");
1449
+ id = String(config.id);
1450
+ }
1393
1451
  const modeLike = o.jenis === "mode" || o.jenis !== "model" && (isModeOption(config) || /mode/i.test(id));
1394
1452
  if (modeLike && UNSAFE_MODE.test(value))
1395
1453
  throw new Error("A mode that skips asking is not allowed in HypeFrame");
@@ -1543,6 +1601,22 @@ function agentEnv(id) {
1543
1601
  return {};
1544
1602
  }
1545
1603
  }
1604
+ var SECRET_NAME = /KEY|TOKEN|SECRET|PASSWORD/i;
1605
+ function forgetAgentSecrets(id) {
1606
+ const gone = Object.keys(agentEnv(id)).filter((k) => SECRET_NAME.test(k));
1607
+ removeAgentEnv(id, gone);
1608
+ return gone;
1609
+ }
1610
+ function removeAgentEnv(id, names) {
1611
+ const env = agentEnv(id);
1612
+ if (!names.some((k) => (k in env)))
1613
+ return;
1614
+ for (const k of names)
1615
+ delete env[k];
1616
+ const f = path6.join(folder(id), "env.json");
1617
+ fs9.writeFileSync(`${f}.tmp`, JSON.stringify(env), { mode: 384 });
1618
+ fs9.renameSync(`${f}.tmp`, f);
1619
+ }
1546
1620
  function saveAgentEnv(id, env) {
1547
1621
  fs9.mkdirSync(folder(id), { recursive: true });
1548
1622
  const f = path6.join(folder(id), "env.json");
@@ -1838,7 +1912,7 @@ function createAgentService(o) {
1838
1912
  const macam = text(c, "macam");
1839
1913
  if (!["model", "mode", "opsi"].includes(macam))
1840
1914
  throw new Error("Pilihan tidak dikenal.");
1841
- const r = await sessions.setOption(text(c, "sessionId"), { jenis: macam, id: text(c, "id"), nilai: text(c, "nilai") });
1915
+ const r = await sessions.setOption(text(c, "sessionId"), { jenis: macam, id: text(c, "id"), nilai: text(c, "nilai"), nama: text(c, "nama") });
1842
1916
  emit({ type: "option", agent: nameOf(sessions.agentOf(text(c, "sessionId"))), what: macam === "opsi" ? text(c, "id") : macam, value: text(c, "nilai") });
1843
1917
  return r;
1844
1918
  },
@@ -4198,6 +4272,25 @@ var isKey = (m) => m.type === "env_var" || !!m.varName;
4198
4272
  function pick(methods) {
4199
4273
  return methods.find((m) => m.type === "terminal") ?? methods.find((m) => (!m.type || m.type === "agent") && !isKey(m)) ?? methods.find(isKey);
4200
4274
  }
4275
+ async function logoutAgent(id) {
4276
+ const a = readInstalled().find((x) => x.id === id);
4277
+ if (!a)
4278
+ throw new Error(`Agent ${id} is not installed`);
4279
+ let signedOut = false;
4280
+ const proc = new AcpProcess;
4281
+ try {
4282
+ const init = await proc.start(a, projectDir("_cek"), agentEnv(id));
4283
+ if (init.agentCapabilities?.auth?.logout)
4284
+ signedOut = await proc.request("logout", {}, 60000).then(() => true, () => false) || false;
4285
+ } finally {
4286
+ await proc.stop();
4287
+ }
4288
+ const keys = forgetAgentSecrets(id).length > 0;
4289
+ if (!signedOut && !keys)
4290
+ return "unsupported";
4291
+ setReady(id, false);
4292
+ return signedOut ? "signed-out" : "key-removed";
4293
+ }
4201
4294
  async function loginAgent(id, io) {
4202
4295
  const a = readInstalled().find((x) => x.id === id);
4203
4296
  if (!a)
@@ -4229,6 +4322,72 @@ async function loginAgent(id, io) {
4229
4322
  return checkReady(id);
4230
4323
  }
4231
4324
 
4325
+ // src/agent/opencode.ts
4326
+ import fs21 from "node:fs";
4327
+ import path17 from "node:path";
4328
+ var OPENCODE = "opencode";
4329
+ var OPENCODE_KEY = "HF_OPENCODE_KEY";
4330
+ var PROVIDER = "hypeframe";
4331
+ var configFile = () => path17.join(dataDir(), "opencode.json");
4332
+ var cleanUrl = (u) => u.trim().replace(/\/+$/, "");
4333
+ function saveOpencodeApi(api) {
4334
+ const url = cleanUrl(api.url);
4335
+ if (!/^https?:\/\/[^\s/]+/i.test(url))
4336
+ throw new Error("The API address must start with http:// or https://");
4337
+ const models = [...new Set(api.models.map((m) => m.trim()).filter(Boolean))].slice(0, 50);
4338
+ if (!models.length)
4339
+ throw new Error("Pick at least one model");
4340
+ const key = api.key.trim();
4341
+ const config = {
4342
+ $schema: "https://opencode.ai/config.json",
4343
+ provider: {
4344
+ [PROVIDER]: {
4345
+ npm: "@ai-sdk/openai-compatible",
4346
+ name: (api.name || new URL(url).hostname).slice(0, 60),
4347
+ options: { baseURL: url, ...key ? { apiKey: `{env:${OPENCODE_KEY}}` } : {} },
4348
+ models: Object.fromEntries(models.map((m) => [m, { name: m }]))
4349
+ }
4350
+ },
4351
+ model: `${PROVIDER}/${models[0]}`
4352
+ };
4353
+ const f = configFile();
4354
+ fs21.writeFileSync(`${f}.tmp`, `${JSON.stringify(config, null, 2)}
4355
+ `, { mode: 384 });
4356
+ fs21.renameSync(`${f}.tmp`, f);
4357
+ if (key)
4358
+ saveAgentEnv(OPENCODE, { [OPENCODE_KEY]: key, OPENCODE_CONFIG: f });
4359
+ else
4360
+ removeAgentEnv(OPENCODE, [OPENCODE_KEY]), saveAgentEnv(OPENCODE, { OPENCODE_CONFIG: f });
4361
+ return f;
4362
+ }
4363
+ function opencodeApi() {
4364
+ try {
4365
+ const c = JSON.parse(fs21.readFileSync(configFile(), "utf8"));
4366
+ const p = c?.provider?.[PROVIDER];
4367
+ if (!p?.options?.baseURL)
4368
+ return null;
4369
+ return { url: String(p.options.baseURL), name: String(p.name ?? ""), model: String(c.model ?? "").replace(`${PROVIDER}/`, "") };
4370
+ } catch {
4371
+ return null;
4372
+ }
4373
+ }
4374
+ function removeOpencodeApi() {
4375
+ fs21.rmSync(configFile(), { force: true });
4376
+ removeAgentEnv(OPENCODE, [OPENCODE_KEY, "OPENCODE_CONFIG"]);
4377
+ }
4378
+ async function fetchApiModels(url, key, timeoutMs = 1e4) {
4379
+ try {
4380
+ const r = await fetch(`${cleanUrl(url)}/models`, { headers: key.trim() ? { authorization: `Bearer ${key.trim()}` } : {}, signal: AbortSignal.timeout(timeoutMs) });
4381
+ if (!r.ok)
4382
+ return [];
4383
+ const j = await r.json();
4384
+ const ids = (Array.isArray(j?.data) ? j.data : []).map((m) => typeof m?.id === "string" ? m.id : "").filter((x) => x && x.length < 200);
4385
+ return [...new Set(ids)].sort();
4386
+ } catch {
4387
+ return [];
4388
+ }
4389
+ }
4390
+
4232
4391
  // src/cli/commands/agent.ts
4233
4392
  var NAMES = { "antigravity-acp": "Antigravity", "codex-acp": "Codex", opencode: "OpenCode" };
4234
4393
  var agentName = (id) => NAMES[id] ?? readInstalled().find((a) => a.id === id)?.name ?? id;
@@ -4243,7 +4402,39 @@ var stateText = (s) => s === "ready" ? color.ok(t("agent.ready")) : s === "login
4243
4402
  function agentHint(id, s) {
4244
4403
  const mark = s === "ready" ? "✔" : s === "login" ? "▲" : "○";
4245
4404
  const state = t(s === "ready" ? "agent.ready" : s === "login" ? "agent.needLogin" : "agent.notInstalled");
4246
- return `${mark} ${state}${ACCOUNT[id] ? ` · ${t(ACCOUNT[id])}` : ""}`;
4405
+ const api = id === OPENCODE && s !== "none" ? opencodeApi() : null;
4406
+ const account = api ? t("agent.ownApiTag", { host: hostOf(api.url) }) : ACCOUNT[id] ? t(ACCOUNT[id]) : "";
4407
+ return `${mark} ${state}${account ? ` · ${account}` : ""}`;
4408
+ }
4409
+ var hostOf = (u) => {
4410
+ try {
4411
+ return new URL(u).host;
4412
+ } catch {
4413
+ return u;
4414
+ }
4415
+ };
4416
+ async function ownApi() {
4417
+ const now = opencodeApi();
4418
+ const url = await p.text({ message: t("agent.apiUrl"), placeholder: "https://api.contoh.com/v1", initialValue: now?.url ?? "", validate: (v) => /^https?:\/\/\S+$/i.test(String(v ?? "").trim()) ? undefined : t("agent.apiUrlBad") });
4419
+ if (p.isCancel(url))
4420
+ return;
4421
+ const key = await p.password({ message: t("agent.apiKey") });
4422
+ if (p.isCancel(key))
4423
+ return;
4424
+ const s = p.spinner();
4425
+ s.start(t("agent.apiModelsLoading"));
4426
+ const list = await fetchApiModels(String(url), String(key ?? ""));
4427
+ s.stop(list.length ? t("agent.apiModelsFound", { n: list.length }) : t("agent.apiModelsNone"));
4428
+ const model = list.length ? await p.select({ message: t("agent.apiModel"), options: list.slice(0, 300).map((m) => ({ value: m, label: m })), initialValue: now && list.includes(now.model) ? now.model : list[0], maxItems: 12 }) : await p.text({ message: t("agent.apiModelType"), placeholder: "gpt-4o-mini", initialValue: now?.model ?? "", validate: (v) => String(v ?? "").trim() ? undefined : "—" });
4429
+ if (p.isCancel(model))
4430
+ return;
4431
+ const main = String(model).trim();
4432
+ saveOpencodeApi({ url: String(url), key: String(key ?? ""), models: [main, ...list.filter((m) => m !== main).slice(0, 40)] });
4433
+ log.ok(t("agent.apiSaved", { host: hostOf(String(url).trim()), model: main }));
4434
+ if (await checkReady(OPENCODE))
4435
+ log.detail(t(runningPid() ? "agent.nextRunning" : "agent.nextStart", { name: agentName(OPENCODE) }));
4436
+ else
4437
+ log.warn(t("agent.apiNotReady"));
4247
4438
  }
4248
4439
  var io = {
4249
4440
  ask: async (label) => {
@@ -4318,13 +4509,24 @@ async function loginOne(id) {
4318
4509
  log.warn(t("agent.loginFailed", { name: agentName(id) }));
4319
4510
  return ok;
4320
4511
  }
4512
+ async function logoutOne(id) {
4513
+ const name = agentName(id);
4514
+ log.info(t("agent.loggingOut", { name }));
4515
+ const r = await logoutAgent(id);
4516
+ if (r === "unsupported")
4517
+ return log.warn(t("agent.logoutUnsupported", { name })), false;
4518
+ log.ok(t(r === "signed-out" ? "agent.loggedOut" : "agent.keyRemoved", { name }));
4519
+ if (runningPid())
4520
+ log.detail(t("agent.logoutRestart", { name }));
4521
+ return true;
4522
+ }
4321
4523
  async function agentCommand(args) {
4322
4524
  const [sub, raw] = args.rest;
4323
4525
  const id = raw ? resolveAgentId(raw) : raw;
4324
4526
  if (!sub || sub === "list")
4325
4527
  return listAgents();
4326
4528
  if (!id)
4327
- return log.error("hypeframe agent add|login|remove <id>");
4529
+ return log.error("hypeframe agent add|login|logout|remove <id>");
4328
4530
  if (sub === "add")
4329
4531
  return void await addAgent(id, args.flags.download === true);
4330
4532
  if (sub === "login") {
@@ -4332,11 +4534,16 @@ async function agentCommand(args) {
4332
4534
  return log.error(t("agent.notInstalledYet", { name: agentName(id) }));
4333
4535
  return void await loginOne(id);
4334
4536
  }
4537
+ if (sub === "logout") {
4538
+ if (agentState(id) === "none")
4539
+ return log.error(t("agent.notInstalledYet", { name: agentName(id) }));
4540
+ return void await logoutOne(id);
4541
+ }
4335
4542
  if (sub === "remove") {
4336
4543
  removeAgent(id);
4337
4544
  return log.ok(t("agent.removed", { name: agentName(id) }));
4338
4545
  }
4339
- log.error("hypeframe agent list|add|login|remove codex|antigravity|opencode");
4546
+ log.error("hypeframe agent list|add|login|logout|remove codex|antigravity|opencode");
4340
4547
  }
4341
4548
  async function agentMenu() {
4342
4549
  for (;; ) {
@@ -4352,7 +4559,8 @@ async function agentMenu() {
4352
4559
  options: [
4353
4560
  ...state === "none" ? [{ value: "add", label: t("agent.add") }] : [],
4354
4561
  ...state === "login" ? [{ value: "login", label: t("agent.loginNow") }] : [],
4355
- ...state === "ready" ? [{ value: "login", label: t("agent.login") }] : [],
4562
+ ...state === "ready" ? [{ value: "switch", label: t("agent.login") }, { value: "logout", label: t("agent.logout") }] : [],
4563
+ ...choice === OPENCODE && state !== "none" ? [{ value: "api", label: opencodeApi() ? t("agent.ownApiChange", { host: hostOf(opencodeApi().url) }) : t("agent.ownApi") }, ...opencodeApi() ? [{ value: "api-off", label: t("agent.ownApiOff") }] : []] : [],
4356
4564
  ...state !== "none" ? [{ value: "remove", label: t("agent.remove") }] : [],
4357
4565
  { value: "", label: color.muted(t("agent.back")) }
4358
4566
  ]
@@ -4364,6 +4572,17 @@ async function agentMenu() {
4364
4572
  await addAgent(choice);
4365
4573
  if (action === "login")
4366
4574
  await loginOne(choice);
4575
+ if (action === "switch")
4576
+ await logoutAgent(choice).catch(() => "unsupported"), await loginOne(choice);
4577
+ if (action === "api")
4578
+ await ownApi();
4579
+ if (action === "api-off")
4580
+ removeOpencodeApi(), log.ok(t("agent.ownApiOffDone"));
4581
+ if (action === "logout") {
4582
+ const sure = await p.confirm({ message: t("agent.logoutAsk", { name: agentName(choice) }), initialValue: false });
4583
+ if (sure === true)
4584
+ await logoutOne(choice);
4585
+ }
4367
4586
  if (action === "remove") {
4368
4587
  const sure = await p.confirm({ message: t("agent.removeAsk", { name: agentName(choice) }), initialValue: false });
4369
4588
  if (sure === true)
@@ -4443,8 +4662,8 @@ async function config(args) {
4443
4662
 
4444
4663
  // src/cli/commands/doctor.ts
4445
4664
  import { spawnSync as spawnSync4 } from "node:child_process";
4446
- import fs21 from "node:fs";
4447
- import path17 from "node:path";
4665
+ import fs22 from "node:fs";
4666
+ import path18 from "node:path";
4448
4667
  var mark = { ok: color.ok(icon.ok), warn: color.warn(icon.warn), error: color.error(icon.error) };
4449
4668
  async function reach(url) {
4450
4669
  const t0 = Date.now();
@@ -4473,10 +4692,10 @@ async function doctor(args) {
4473
4692
  show({ label: "Node.js", result: maj > 20 || maj === 20 && min >= 3 ? "ok" : "error", detail: `${process.versions.node}${maj < 20 || maj === 20 && min < 3 ? ` ${t("doctor.nodeOld")}` : ""}` });
4474
4693
  }
4475
4694
  try {
4476
- const probe = path17.join(dataDir(), `.probe-${process.pid}`);
4477
- fs21.writeFileSync(probe, "x");
4478
- fs21.rmSync(probe);
4479
- const st = fs21.statfsSync(dataDir());
4695
+ const probe = path18.join(dataDir(), `.probe-${process.pid}`);
4696
+ fs22.writeFileSync(probe, "x");
4697
+ fs22.rmSync(probe);
4698
+ const st = fs22.statfsSync(dataDir());
4480
4699
  const free = st.bavail * st.bsize;
4481
4700
  show({ label: t("doctor.disk"), result: free > 2 * 1024 ** 3 ? "ok" : "warn", detail: `${dataDir()} ${color.muted(icon.dot)} ${t("doctor.free", { size: bytes2(free) })}` });
4482
4701
  } catch (e) {
@@ -4523,21 +4742,21 @@ async function doctor(args) {
4523
4742
  }
4524
4743
 
4525
4744
  // src/cli/commands/history.ts
4526
- import fs22 from "node:fs";
4527
- import path18 from "node:path";
4745
+ import fs23 from "node:fs";
4746
+ import path19 from "node:path";
4528
4747
  function readHistory2(hours = 24) {
4529
4748
  const root = renderDir();
4530
4749
  const since = Date.now() - hours * 3600000;
4531
4750
  const out = [];
4532
- for (const name of fs22.readdirSync(root)) {
4751
+ for (const name of fs23.readdirSync(root)) {
4533
4752
  if (!JOB_ID.test(name))
4534
4753
  continue;
4535
4754
  try {
4536
- const j = JSON.parse(fs22.readFileSync(path18.join(root, name, "status.json"), "utf8"));
4755
+ const j = JSON.parse(fs23.readFileSync(path19.join(root, name, "status.json"), "utf8"));
4537
4756
  if ((j.diperbarui || j.dibuat) < since)
4538
4757
  continue;
4539
- const f = j.hasilBerkas ? path18.join(root, name, j.hasilBerkas) : null;
4540
- out.push({ job: j, file: f && fs22.existsSync(f) ? f : null });
4758
+ const f = j.hasilBerkas ? path19.join(root, name, j.hasilBerkas) : null;
4759
+ out.push({ job: j, file: f && fs23.existsSync(f) ? f : null });
4541
4760
  } catch {}
4542
4761
  }
4543
4762
  return out.sort((a, b) => (b.job.diperbarui || 0) - (a.job.diperbarui || 0));
@@ -4564,30 +4783,30 @@ function history() {
4564
4783
 
4565
4784
  // src/cli/commands/maintenance.ts
4566
4785
  import { spawnSync as spawnSync5 } from "node:child_process";
4567
- import fs23 from "node:fs";
4786
+ import fs24 from "node:fs";
4568
4787
  import os4 from "node:os";
4569
- import path19 from "node:path";
4788
+ import path20 from "node:path";
4570
4789
  async function clean() {
4571
4790
  if (runningPid()) {
4572
4791
  log.warn(t("clean.running"));
4573
4792
  return;
4574
4793
  }
4575
- const targets = [path19.join(cacheDir(), "chrome"), path19.join(cacheDir(), "halaman"), path19.join(logDir(), "hypeframe.log.1")];
4576
- for (const job of fs23.readdirSync(renderDir())) {
4794
+ const targets = [path20.join(cacheDir(), "chrome"), path20.join(cacheDir(), "halaman"), path20.join(logDir(), "hypeframe.log.1")];
4795
+ for (const job of fs24.readdirSync(renderDir())) {
4577
4796
  if (!JOB_ID.test(job))
4578
4797
  continue;
4579
4798
  try {
4580
- const s = JSON.parse(fs23.readFileSync(path19.join(renderDir(), job, "status.json"), "utf8")).status;
4799
+ const s = JSON.parse(fs24.readFileSync(path20.join(renderDir(), job, "status.json"), "utf8")).status;
4581
4800
  if (s === "gagal" || s === "batal" || s === "unggah")
4582
- targets.push(path19.join(renderDir(), job));
4801
+ targets.push(path20.join(renderDir(), job));
4583
4802
  } catch {
4584
- targets.push(path19.join(renderDir(), job));
4803
+ targets.push(path20.join(renderDir(), job));
4585
4804
  }
4586
4805
  }
4587
4806
  let freed = 0;
4588
4807
  for (const p of targets) {
4589
4808
  freed += await sizeOf(p);
4590
- fs23.rmSync(p, { recursive: true, force: true });
4809
+ fs24.rmSync(p, { recursive: true, force: true });
4591
4810
  }
4592
4811
  log.ok(t("clean.done", { size: bytes2(freed) }));
4593
4812
  }
@@ -4596,7 +4815,7 @@ function report() {
4596
4815
  const a = readAccount();
4597
4816
  let recent = "";
4598
4817
  try {
4599
- recent = fs23.readFileSync(path19.join(logDir(), "hypeframe.log"), "utf8").split(`
4818
+ recent = fs24.readFileSync(path20.join(logDir(), "hypeframe.log"), "utf8").split(`
4600
4819
  `).slice(-400).join(`
4601
4820
  `);
4602
4821
  } catch {
@@ -4617,8 +4836,8 @@ function report() {
4617
4836
  recent
4618
4837
  ];
4619
4838
  const stamp = new Date().toISOString().slice(0, 19).replace(/[-:T]/g, "");
4620
- const file = path19.join(dataDir(), `laporan-${stamp}.txt`);
4621
- fs23.writeFileSync(file, mask(lines.join(`
4839
+ const file = path20.join(dataDir(), `laporan-${stamp}.txt`);
4840
+ fs24.writeFileSync(file, mask(lines.join(`
4622
4841
  `)), { mode: 384 });
4623
4842
  log.ok(t("report.done", { file }));
4624
4843
  log.detail(t("report.hint"));
@@ -4654,13 +4873,13 @@ function openWeb(args) {
4654
4873
  }
4655
4874
 
4656
4875
  // src/cli/commands/status.ts
4657
- import fs24 from "node:fs";
4658
- import path20 from "node:path";
4876
+ import fs25 from "node:fs";
4877
+ import path21 from "node:path";
4659
4878
  function statusRows(args) {
4660
4879
  const s = resolveSettings(args?.flags);
4661
4880
  const a = readAccount();
4662
4881
  const pid = runningPid();
4663
- const chrome = findChrome() || fs24.existsSync(path20.join(cacheDir(), "chrome"));
4882
+ const chrome = findChrome() || fs25.existsSync(path21.join(cacheDir(), "chrome"));
4664
4883
  const recent = readHistory2();
4665
4884
  const k = (key) => color.muted(t(key));
4666
4885
  return [
@@ -4882,7 +5101,7 @@ function help() {
4882
5101
  ["open", t("help.open")],
4883
5102
  ["doctor", t("help.doctor")],
4884
5103
  ["bench", t("help.bench")],
4885
- ["agent list|add|login|remove", t("help.agent")],
5104
+ ["agent list|add|login|logout|remove", t("help.agent")],
4886
5105
  ["chromium", t("help.chromium")],
4887
5106
  ["history", t("help.history")],
4888
5107
  ["autostart on|off", t("help.autostart")],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypeframe",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Local engine for HypeFrame Web: code clips, video renders and AI agents run on your own machine; the web is just the view.",
5
5
  "keywords": [
6
6
  "hypeframe",