inplan 0.3.4 → 0.3.6

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.
@@ -1204,7 +1204,7 @@ function startCloudSignIn(cloudBase, timeoutMs = 5 * 6e4) {
1204
1204
  const __dirname$1 = node_path.dirname(node_url.fileURLToPath(require("url").pathToFileURL(__filename).href));
1205
1205
  widenConnectAttemptBudget();
1206
1206
  registerPluginScheme();
1207
- const pluginToken = () => runCli(["token"]).then((r) => {
1207
+ const pluginToken = () => runCli(["token"], void 0, 15e3).then((r) => {
1208
1208
  try {
1209
1209
  return JSON.parse(r.stdout.trim() || "{}").token ?? null;
1210
1210
  } catch {
@@ -1229,7 +1229,7 @@ function resolveTargetFile() {
1229
1229
  return node_fs.existsSync(abs) ? abs : null;
1230
1230
  }
1231
1231
  const nav = createNavTracker();
1232
- const pluginRefreshes = createSerialQueue((err) => console.error("[inplan] refreshing the plugin after a navigation failed", err));
1232
+ const pluginRefreshes = createSerialQueue((err) => console.error("[inplan] starting or refreshing the plugin failed", err));
1233
1233
  let session = null;
1234
1234
  let win = null;
1235
1235
  let stopWatching = null;
@@ -1682,7 +1682,22 @@ ${body.replace(/\s*$/, "")}
1682
1682
  return { ok: false };
1683
1683
  }
1684
1684
  });
1685
- electron.ipcMain.handle("app:restart", () => {
1685
+ electron.ipcMain.handle("app:restart", async () => {
1686
+ const file = session?.paths.file;
1687
+ if (file) {
1688
+ const r = await runCli(["launch-editor", file], void 0, 2e4);
1689
+ let launched = false;
1690
+ try {
1691
+ launched = JSON.parse(r.stdout.trim() || "{}").status === "launched";
1692
+ } catch {
1693
+ }
1694
+ if (launched) {
1695
+ electron.app.exit(0);
1696
+ return;
1697
+ }
1698
+ process.stderr.write(`[inplan] restart: launch-editor failed (${r.code}): ${r.stderr.trim() || r.stdout.trim()}
1699
+ `);
1700
+ }
1686
1701
  electron.app.relaunch();
1687
1702
  electron.app.exit(0);
1688
1703
  });
@@ -1734,7 +1749,9 @@ ${body.replace(/\s*$/, "")}
1734
1749
  });
1735
1750
  electron.ipcMain.handle("i18n:get", () => i18n.getSnapshot());
1736
1751
  electron.ipcMain.handle("i18n:set-locale", (_e, code) => i18n.setLocale(code));
1737
- electron.ipcMain.handle("plugin:info", () => {
1752
+ electron.ipcMain.handle("plugin:info", async () => {
1753
+ await pluginRefreshes.run(async () => {
1754
+ });
1738
1755
  const info = pluginInfo();
1739
1756
  nav.rendererActivated(info !== null);
1740
1757
  return info;
@@ -1749,8 +1766,7 @@ void electron.app.whenReady().then(async () => {
1749
1766
  session.logEditorPid(process.pid);
1750
1767
  navHistory.push(target);
1751
1768
  navIdx = 0;
1752
- await startDesktopPlugin(target, pluginToken);
1753
- nav.rendererActivated(pluginInfo() !== null);
1769
+ void pluginRefreshes.run(() => startDesktopPlugin(target, pluginToken));
1754
1770
  track("app_opened", session.getSettings().telemetry === true);
1755
1771
  }
1756
1772
  registerIpc();
@@ -49,6 +49,10 @@ function createI18nController() {
49
49
  }
50
50
  };
51
51
  }
52
+ let lastUpdate = null;
53
+ ipcRenderer.on("app:update-available", (_e, info) => {
54
+ lastUpdate = info;
55
+ });
52
56
  const api = {
53
57
  load: () => ipcRenderer.invoke("doc:load"),
54
58
  save: (content, options) => ipcRenderer.invoke("doc:save", content, options),
@@ -130,6 +134,7 @@ const api = {
130
134
  onUpdateAvailable: (cb) => {
131
135
  const h = (_e, info) => cb(info);
132
136
  ipcRenderer.on("app:update-available", h);
137
+ if (lastUpdate) cb(lastUpdate);
133
138
  return () => ipcRenderer.removeListener("app:update-available", h);
134
139
  },
135
140
  applyUpdate: () => ipcRenderer.invoke("app:apply-update"),
@@ -48662,12 +48662,15 @@ function Shell() {
48662
48662
  return /* @__PURE__ */ jsxRuntimeExports.jsx(AppRoot, {}, epoch);
48663
48663
  }
48664
48664
  async function bootstrap() {
48665
+ const el2 = document.getElementById("root");
48666
+ if (!el2) return;
48667
+ const root = createRoot(el2);
48668
+ root.render(
48669
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-loading", role: "status", "aria-label": "Loading", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-spinner", "aria-hidden": "true" }) })
48670
+ );
48665
48671
  await plugin.activate();
48666
- const root = document.getElementById("root");
48667
- if (root) {
48668
- createRoot(root).render(
48669
- /* @__PURE__ */ jsxRuntimeExports.jsx(React.StrictMode, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Shell, {}) })
48670
- );
48671
- }
48672
+ root.render(
48673
+ /* @__PURE__ */ jsxRuntimeExports.jsx(React.StrictMode, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Shell, {}) })
48674
+ );
48672
48675
  }
48673
48676
  void bootstrap();
@@ -21,7 +21,7 @@
21
21
  content="default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' inplan-plugin:; img-src 'self' file: https:; connect-src 'self' inplan-plugin: ws://127.0.0.1:* ws://localhost:*; frame-src https://inplan.ai http://127.0.0.1:* http://localhost:*"
22
22
  />
23
23
  <title>inplan</title>
24
- <script type="module" crossorigin src="./assets/index-C1AH6VQU.js"></script>
24
+ <script type="module" crossorigin src="./assets/index-Dm0uGzyR.js"></script>
25
25
  <link rel="stylesheet" crossorigin href="./assets/index-DziuyBKZ.css">
26
26
  </head>
27
27
  <body>
package/bin/cli.js CHANGED
@@ -2880,7 +2880,8 @@ function resolveBundledApp() {
2880
2880
  return { appMain, error: "Electron's binary isn't installed \u2014 its download was likely blocked (proxy/AV), and path.txt is missing" };
2881
2881
  }
2882
2882
  function spawnApp(file) {
2883
- const env = { ...process.env, INPLAN_CLI: process.argv[1] ?? "" };
2883
+ const { ELECTRON_RUN_AS_NODE: _runAsNode, ...inherited } = process.env;
2884
+ const env = { ...inherited, INPLAN_CLI: process.argv[1] ?? "" };
2884
2885
  const override = process.env.INPLAN_APP_CMD;
2885
2886
  if (override) {
2886
2887
  const child = spawn3(override, [file], { detached: true, stdio: "ignore", shell: true, env });
@@ -4658,6 +4659,25 @@ async function main() {
4658
4659
  doLogout();
4659
4660
  return;
4660
4661
  }
4662
+ if (cmd === "launch-editor") {
4663
+ const target = argv[1] ? resolve3(argv[1]) : "";
4664
+ if (!target || !existsSync11(target)) {
4665
+ output({ status: "launch_failed", message: `file not found: ${target || "(none)"}` });
4666
+ process.exitCode = 1;
4667
+ return;
4668
+ }
4669
+ const pid = spawnApp(target);
4670
+ if (pid === null) {
4671
+ output({ status: "launch_failed", message: "the editor could not be started" });
4672
+ process.exitCode = 1;
4673
+ return;
4674
+ }
4675
+ const p = docPaths(target);
4676
+ mkdirSync10(p.controlDir, { recursive: true });
4677
+ await new FsControlChannel(p).append({ actor: "agent", type: LogEventType.EditorPid, payload: { pid, v: CONTROL_LOG_VERSION } });
4678
+ output({ status: "launched", pid });
4679
+ return;
4680
+ }
4661
4681
  if (cmd === "update") {
4662
4682
  const updArgs = argv.slice(1);
4663
4683
  const pkg = getFlag(updArgs, "pkg") ?? UPDATE_PKG;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inplan",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "inplan — a Markdown editor for human ⇄ coding-agent planning. CLI + desktop editor.",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "repository": {