inplan 0.3.9 → 0.3.10

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.
@@ -1497,7 +1497,17 @@ function createWindow() {
1497
1497
  if (!w.isDestroyed()) w.show();
1498
1498
  };
1499
1499
  const revealFallback = setTimeout(reveal, 5e3);
1500
- w.once("ready-to-show", reveal);
1500
+ w.once("ready-to-show", () => {
1501
+ reveal();
1502
+ const readyPath = process.env.INPLAN_RESTART_READY;
1503
+ if (readyPath && w === win && !w.isDestroyed()) {
1504
+ delete process.env.INPLAN_RESTART_READY;
1505
+ try {
1506
+ node_fs.writeFileSync(readyPath, "ready");
1507
+ } catch {
1508
+ }
1509
+ }
1510
+ });
1501
1511
  w.webContents.once("did-fail-load", reveal);
1502
1512
  w.webContents.once("render-process-gone", reveal);
1503
1513
  win.on("page-title-updated", (e) => e.preventDefault());
@@ -1684,24 +1694,45 @@ ${body.replace(/\s*$/, "")}
1684
1694
  return { ok: false };
1685
1695
  }
1686
1696
  });
1697
+ let restarting = false;
1687
1698
  electron.ipcMain.handle("app:restart", async () => {
1688
1699
  const file = session?.paths.file;
1689
- if (file) {
1690
- const r = await runCli(["launch-editor", file], void 0, 2e4);
1691
- let launched = false;
1692
- try {
1693
- launched = JSON.parse(r.stdout.trim() || "{}").status === "launched";
1694
- } catch {
1700
+ const cli = process.env.INPLAN_CLI;
1701
+ if (!file || !cli || restarting) return { ok: false };
1702
+ restarting = true;
1703
+ let dir;
1704
+ try {
1705
+ dir = node_fs.mkdtempSync(node_path.join(node_os.tmpdir(), "inplan-restart-"));
1706
+ const readyPath = node_path.join(dir, "ready");
1707
+ const { ELECTRON_RUN_AS_NODE: _runAsNode, ...env } = process.env;
1708
+ const launched = await new Promise((done) => {
1709
+ node_child_process.execFile("node", [cli, "launch-editor", file], { env: { ...env, INPLAN_RESTART_READY: readyPath }, timeout: 2e4 }, (err, stdout) => {
1710
+ try {
1711
+ done(!err && JSON.parse(stdout.trim()).status === "launched");
1712
+ } catch {
1713
+ done(false);
1714
+ }
1715
+ });
1716
+ });
1717
+ if (!launched) return { ok: false };
1718
+ const deadline = Date.now() + 15e3;
1719
+ while (!node_fs.existsSync(readyPath)) {
1720
+ if (Date.now() >= deadline) return { ok: false };
1721
+ await new Promise((done) => setTimeout(done, 100));
1695
1722
  }
1696
- if (launched) {
1697
- electron.app.exit(0);
1698
- return;
1723
+ } catch {
1724
+ return { ok: false };
1725
+ } finally {
1726
+ restarting = false;
1727
+ if (dir) {
1728
+ try {
1729
+ node_fs.rmSync(dir, { recursive: true, force: true });
1730
+ } catch {
1731
+ }
1699
1732
  }
1700
- process.stderr.write(`[inplan] restart: launch-editor failed (${r.code}): ${r.stderr.trim() || r.stdout.trim()}
1701
- `);
1702
1733
  }
1703
- electron.app.relaunch();
1704
1734
  electron.app.exit(0);
1735
+ return { ok: true };
1705
1736
  });
1706
1737
  electron.ipcMain.on("onboarding:get", (e) => {
1707
1738
  e.returnValue = isOnboarded();
@@ -34315,7 +34315,7 @@ class Buffer {
34315
34315
  });
34316
34316
  }
34317
34317
  }
34318
- let Element$1 = class Element {
34318
+ let Element$2 = class Element2 {
34319
34319
  /**
34320
34320
  @internal
34321
34321
  */
@@ -34363,7 +34363,7 @@ class TreeElement {
34363
34363
  }
34364
34364
  }
34365
34365
  function elt(type, from, to, children) {
34366
- return new Element$1(type, from, to, children);
34366
+ return new Element$2(type, from, to, children);
34367
34367
  }
34368
34368
  const EmphasisUnderscore = { resolve: "Emphasis", mark: "EmphasisMark" };
34369
34369
  const EmphasisAsterisk = { resolve: "Emphasis", mark: "EmphasisMark" };
@@ -34708,7 +34708,7 @@ class InlineContext {
34708
34708
  if (open.type.mark)
34709
34709
  content2.push(this.elt(open.type.mark, start, open.to));
34710
34710
  for (let k2 = j + 1; k2 < i; k2++) {
34711
- if (this.parts[k2] instanceof Element$1)
34711
+ if (this.parts[k2] instanceof Element$2)
34712
34712
  content2.push(this.parts[k2]);
34713
34713
  this.parts[k2] = null;
34714
34714
  }
@@ -34725,7 +34725,7 @@ class InlineContext {
34725
34725
  let result = [];
34726
34726
  for (let i = from; i < this.parts.length; i++) {
34727
34727
  let part = this.parts[i];
34728
- if (part instanceof Element$1)
34728
+ if (part instanceof Element$2)
34729
34729
  result.push(part);
34730
34730
  }
34731
34731
  return result;
@@ -34792,8 +34792,8 @@ function injectMarks(elements, marks) {
34792
34792
  eI++;
34793
34793
  if (eI < elts.length && elts[eI].from < mark.from) {
34794
34794
  let e = elts[eI];
34795
- if (e instanceof Element$1)
34796
- elts[eI] = new Element$1(e.type, e.from, e.to, injectMarks(e.children, [mark]));
34795
+ if (e instanceof Element$2)
34796
+ elts[eI] = new Element$2(e.type, e.from, e.to, injectMarks(e.children, [mark]));
34797
34797
  } else {
34798
34798
  elts.splice(eI++, 0, mark);
34799
34799
  }
@@ -36978,7 +36978,7 @@ function getSpecializer(spec) {
36978
36978
  }
36979
36979
  return spec.get;
36980
36980
  }
36981
- const scriptText = 55, StartCloseScriptTag = 1, styleText = 56, StartCloseStyleTag = 2, textareaText = 57, StartCloseTextareaTag = 3, EndTag = 4, SelfClosingEndTag = 5, StartTag = 6, StartScriptTag = 7, StartStyleTag = 8, StartTextareaTag = 9, StartSelfClosingTag = 10, StartCloseTag = 11, NoMatchStartCloseTag = 12, MismatchedStartCloseTag = 13, missingCloseTag = 58, IncompleteTag = 14, IncompleteCloseTag = 15, commentContent$1 = 59, Element2 = 21, TagName = 23, Attribute = 24, AttributeName = 25, AttributeValue = 27, UnquotedAttributeValue = 28, ScriptText = 29, StyleText = 32, TextareaText = 35, OpenTag = 37, CloseTag = 38, Dialect_noMatch = 0, Dialect_selfClosing = 1;
36981
+ const scriptText = 55, StartCloseScriptTag = 1, styleText = 56, StartCloseStyleTag = 2, textareaText = 57, StartCloseTextareaTag = 3, EndTag = 4, SelfClosingEndTag = 5, StartTag = 6, StartScriptTag = 7, StartStyleTag = 8, StartTextareaTag = 9, StartSelfClosingTag = 10, StartCloseTag = 11, NoMatchStartCloseTag = 12, MismatchedStartCloseTag = 13, missingCloseTag = 58, IncompleteTag = 14, IncompleteCloseTag = 15, commentContent$1 = 59, Element$1 = 21, TagName = 23, Attribute = 24, AttributeName = 25, AttributeValue = 27, UnquotedAttributeValue = 28, ScriptText = 29, StyleText = 32, TextareaText = 35, OpenTag = 37, CloseTag = 38, Dialect_noMatch = 0, Dialect_selfClosing = 1;
36982
36982
  const selfClosers$1 = {
36983
36983
  area: true,
36984
36984
  base: true,
@@ -37086,7 +37086,7 @@ const elementContext = new ContextTracker({
37086
37086
  return startTagTerms.indexOf(term) > -1 ? new ElementContext(tagNameAfter(input, 1) || "", context) : context;
37087
37087
  },
37088
37088
  reduce(context, term) {
37089
- return term == Element2 && context ? context.parent : context;
37089
+ return term == Element$1 && context ? context.parent : context;
37090
37090
  },
37091
37091
  reuse(context, node, stack, input) {
37092
37092
  let type = node.type.id;
@@ -37250,7 +37250,7 @@ function configureNesting(tags2 = [], attributes = []) {
37250
37250
  if (id2 == ScriptText) return maybeNest(node, input, script);
37251
37251
  if (id2 == StyleText) return maybeNest(node, input, style);
37252
37252
  if (id2 == TextareaText) return maybeNest(node, input, textarea);
37253
- if (id2 == Element2 && other.length) {
37253
+ if (id2 == Element$1 && other.length) {
37254
37254
  let n2 = node.node, open = n2.firstChild, tagName = open && findTagName(open, input), attrs2;
37255
37255
  if (tagName) for (let tag of other) {
37256
37256
  if (tag.tag == tagName && (!tag.attrs || tag.attrs(attrs2 || (attrs2 = getAttrs(open, input))))) {
@@ -43726,6 +43726,7 @@ var EN = {
43726
43726
  "banner.reloadNow": "Reload now",
43727
43727
  "banner.cancel": "Cancel",
43728
43728
  "banner.updated": "✅ Updated to",
43729
+ "banner.restartFailed": "Could not reopen inplan. This window is still open; try Restart again.",
43729
43730
  "banner.restartToApply": "— restart inplan to apply.",
43730
43731
  "banner.restart": "Restart",
43731
43732
  "banner.newVersion": "⬆️ A new version is available",
@@ -46142,6 +46143,7 @@ function App(props = {}) {
46142
46143
  return p2 === 1 || p2 === 2 || p2 === 3 ? p2 : 2;
46143
46144
  });
46144
46145
  const [onboardSourceEdits, setOnboardSourceEdits] = reactExports.useState(0);
46146
+ const [commentOverlay, setCommentOverlay] = reactExports.useState(false);
46145
46147
  const [rightTab, setRightTab] = reactExports.useState(() => readLayout().rightTab === "source" ? "source" : "comments");
46146
46148
  const [srcW, setSrcW] = reactExports.useState(() => {
46147
46149
  const w2 = readLayout().srcW;
@@ -46177,6 +46179,7 @@ function App(props = {}) {
46177
46179
  const userAuthorRef = reactExports.useRef(userAuthor);
46178
46180
  userAuthorRef.current = userAuthor;
46179
46181
  const [updating, setUpdating] = reactExports.useState("idle");
46182
+ const [restartState, setRestartState] = reactExports.useState("idle");
46180
46183
  const [showResolvedOrphaned, setShowResolvedOrphaned] = reactExports.useState(() => readLayout().showResolvedOrphaned === true);
46181
46184
  const [selectionText, setSelectionText] = reactExports.useState("");
46182
46185
  const [composer, setComposer] = reactExports.useState(null);
@@ -46227,6 +46230,22 @@ function App(props = {}) {
46227
46230
  const docPathRef = reactExports.useRef("");
46228
46231
  const docLinkRef = reactExports.useRef("");
46229
46232
  const railRef = reactExports.useRef(null);
46233
+ const overlayComments = panes === 1 && commentOverlay;
46234
+ reactExports.useEffect(() => {
46235
+ if (panes !== 1) setCommentOverlay(false);
46236
+ if (!overlayComments) return;
46237
+ const dismiss = (event) => {
46238
+ const target = event.target;
46239
+ if (!(target instanceof Node) || railRef.current?.contains(target) || target instanceof Element && target.closest(".ap-rendered [data-cmt]")) return;
46240
+ setCommentOverlay(false);
46241
+ };
46242
+ document.addEventListener("click", dismiss, true);
46243
+ return () => document.removeEventListener("click", dismiss, true);
46244
+ }, [panes, overlayComments]);
46245
+ reactExports.useEffect(() => {
46246
+ if (!overlayComments || !focused) return;
46247
+ railRef.current?.querySelector(`[data-cmt-card="${CSS.escape(focused)}"]`)?.scrollIntoView?.({ block: "nearest" });
46248
+ }, [overlayComments, focused]);
46230
46249
  const editorRef = reactExports.useRef(null);
46231
46250
  const [pendingFocusCommentId, setPendingFocusCommentId] = reactExports.useState(null);
46232
46251
  const autosaveTimer = reactExports.useRef(null);
@@ -46322,6 +46341,7 @@ function App(props = {}) {
46322
46341
  setAgentDone(false);
46323
46342
  setAgentMessages([]);
46324
46343
  setDraftPendingModel(draftPending?.model ?? null);
46344
+ setCommentOverlay(false);
46325
46345
  setActivePreviewLine(null);
46326
46346
  setStatus(`opened ${path.split("/").pop() ?? path}`);
46327
46347
  void hostApi().getProposal().then((parked) => docGenRef.current === gen && parked != null && showProposal(parked.content, parked.id, parked.baseContent, parked.pending)).catch(() => {
@@ -47397,7 +47417,7 @@ function App(props = {}) {
47397
47417
  t2("app.loading")
47398
47418
  ] });
47399
47419
  const showSource = panes === 3 || panes === 2 && rightTab === "source";
47400
- const showComments = panes === 3 || panes === 2 && rightTab === "comments";
47420
+ const showComments = overlayComments || panes === 3 || panes === 2 && rightTab === "comments";
47401
47421
  const focusedRootId = (() => {
47402
47422
  const byId = new Map(doc2.comments.map((x2) => [x2.id, x2]));
47403
47423
  let id2 = focused;
@@ -47505,17 +47525,23 @@ function App(props = {}) {
47505
47525
  ] }),
47506
47526
  " ",
47507
47527
  t2("banner.restartToApply"),
47528
+ restartState === "failed" && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { role: "alert", className: "ap-update-err", children: t2("banner.restartFailed") }),
47508
47529
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-spacer" }),
47509
47530
  /* @__PURE__ */ jsxRuntimeExports.jsx(
47510
47531
  "button",
47511
47532
  {
47512
47533
  className: "ap-primary",
47534
+ disabled: restartState === "running",
47513
47535
  onClick: async () => {
47514
- await awaitSettled();
47515
- const current = serialize(docRef.current);
47516
- if (current !== savedRef.current) await hostApi().save(current, { kind: "apply", cadence });
47517
- if (hostApi().restartApp) await hostApi().restartApp();
47518
- else await hostApi().closeWindow();
47536
+ setRestartState("running");
47537
+ try {
47538
+ await awaitSettled();
47539
+ const current = serialize(docRef.current);
47540
+ if (current !== savedRef.current) await hostApi().save(current, { kind: "apply", cadence });
47541
+ if ((await hostApi().restartApp?.())?.ok) return;
47542
+ } catch {
47543
+ }
47544
+ setRestartState("failed");
47519
47545
  },
47520
47546
  children: t2("banner.restart")
47521
47547
  }
@@ -47746,6 +47772,7 @@ function App(props = {}) {
47746
47772
  const anchor = target.closest("[data-cmt]");
47747
47773
  if (anchor) {
47748
47774
  e.preventDefault();
47775
+ if (panes === 1) setCommentOverlay(true);
47749
47776
  focusComment(anchor.getAttribute("data-cmt"), true);
47750
47777
  return;
47751
47778
  }
@@ -47798,8 +47825,8 @@ function App(props = {}) {
47798
47825
  ] })
47799
47826
  ] }),
47800
47827
  showComments && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
47801
- /* @__PURE__ */ jsxRuntimeExports.jsx(VSplitter, { width: cmtW, setWidth: setCmtW }),
47802
- /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "ap-pane ap-rail", ref: railRef, style: { width: cmtW }, "data-onboard": "comments", children: [
47828
+ !overlayComments && /* @__PURE__ */ jsxRuntimeExports.jsx(VSplitter, { width: cmtW, setWidth: setCmtW }),
47829
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: `ap-pane ap-rail${overlayComments ? " ap-rail--overlay" : ""}`, ref: railRef, style: { width: cmtW }, "data-onboard": "comments", children: [
47803
47830
  panes === 2 && /* @__PURE__ */ jsxRuntimeExports.jsx(PaneTabs, { tab: rightTab, onTab: setRightTab }),
47804
47831
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-rail-scroll", children: [
47805
47832
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-rail-head", children: [
@@ -280,6 +280,7 @@ body {
280
280
  /* rail — a soft recessed paper surface so the comment cards read as light, floating
281
281
  cards rather than rows. */
282
282
  .ap-rail { background: var(--paper); } /* flex column (from .ap-pane); the inner scroller below scrolls, so PaneTabs stays pinned */
283
+ .ap-rail.ap-rail--overlay { position: absolute; inset: 0 0 0 auto; z-index: 21; max-width: 100%; border-left: 1px solid var(--line); box-shadow: -8px 0 24px #0002; }
283
284
  .ap-rail-scroll { flex: 1; min-height: 0; overflow: auto; }
284
285
  .ap-rail-head { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 1; font-size: 12px; }
285
286
  .ap-rail-tools { display: flex; align-items: center; gap: 6px; }
@@ -21,8 +21,8 @@
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-BXB1lexl.js"></script>
25
- <link rel="stylesheet" crossorigin href="./assets/index-RtdWGNC5.css">
24
+ <script type="module" crossorigin src="./assets/index-C5EEY2VA.js"></script>
25
+ <link rel="stylesheet" crossorigin href="./assets/index-CD5LIK6f.css">
26
26
  </head>
27
27
  <body>
28
28
  <div id="root"></div>
package/bin/cli.js CHANGED
@@ -2184,7 +2184,14 @@ async function applyGatedEdit(store, channel, ev, ctx) {
2184
2184
  function shouldQuarantine(acceptance, canonicalText, current) {
2185
2185
  if (acceptance !== "review") return false;
2186
2186
  if (emptyDocument(canonicalText)) return false;
2187
- return body(canonicalText) !== body(current);
2187
+ return reviewBody(canonicalText) !== reviewBody(current);
2188
+ }
2189
+ function reviewBody(text) {
2190
+ try {
2191
+ return stripAnchors(parse(text).body);
2192
+ } catch {
2193
+ return text;
2194
+ }
2188
2195
  }
2189
2196
  function emptyDocument(text) {
2190
2197
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inplan",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
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": {