inplan 0.1.14 → 0.1.16

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.
@@ -43227,12 +43227,12 @@ function addSpanComment(doc2, selectedText, fields, span) {
43227
43227
  if (!range) return null;
43228
43228
  const id2 = genId(takenIds(doc2));
43229
43229
  const body = wrapSpanWithComment(doc2.body, range.start, range.end, id2);
43230
- const comment2 = { id: id2, author: fields.author, date: nowIso(), resolved: false, text: fields.text, ...fields.question ? { question: fields.question } : {} };
43230
+ const comment2 = { id: id2, author: fields.author, date: nowIso(), resolved: false, text: fields.text, ...fields.question ? { question: fields.question } : {}, ...fields.agent === false ? { agent: false } : {} };
43231
43231
  return { doc: { body, comments: [...doc2.comments, comment2] }, id: id2 };
43232
43232
  }
43233
43233
  function addDocComment(doc2, fields) {
43234
43234
  const id2 = genId(takenIds(doc2));
43235
- const comment2 = { id: id2, anchor: "doc", author: fields.author, date: nowIso(), resolved: false, text: fields.text, ...fields.question ? { question: fields.question } : {} };
43235
+ const comment2 = { id: id2, anchor: "doc", author: fields.author, date: nowIso(), resolved: false, text: fields.text, ...fields.question ? { question: fields.question } : {}, ...fields.agent === false ? { agent: false } : {} };
43236
43236
  return { doc: { ...doc2, comments: [...doc2.comments, comment2] }, id: id2 };
43237
43237
  }
43238
43238
  function addReply(doc2, parentId, text2, author) {
@@ -43458,6 +43458,10 @@ var EN = {
43458
43458
  "newdoc.linkExisting": "Link to it",
43459
43459
  "newdoc.failed": "Couldn’t create the document.",
43460
43460
  "newdoc.cantMove": "Can’t move this selection — it crosses formatting or a comment’s edge.",
43461
+ "newdoc.limitTitle": "Document limit reached",
43462
+ "newdoc.limitBody": "You’re at your {limit}-document limit. Deactivate the least-recently-used “{title}” to make room?",
43463
+ "newdoc.deactivateAndCreate": "Deactivate & create",
43464
+ "newdoc.limitCancelled": "Cancelled — no document was created.",
43461
43465
  "topbar.cantOverlap": "Comments can't overlap",
43462
43466
  "topbar.cantWhitespace": "Comments can't be added to white space",
43463
43467
  "topbar.cantSpanBlocks": "Comments can't span multiple blocks",
@@ -43468,9 +43472,7 @@ var EN = {
43468
43472
  "topbar.finishTurn": "Finish turn",
43469
43473
  "topbar.finishTurnTitle": "Finish turn — hand off to the agent",
43470
43474
  "quit.title": "Do you want to quit?",
43471
- "quit.save": "Save {file}",
43472
43475
  "quit.startBuild": "Switch agent to build mode",
43473
- "quit.thisDoc": "this document",
43474
43476
  "quit.quit": "Quit",
43475
43477
  "quit.cancel": "Cancel",
43476
43478
  "topbar.noAgent": "Connect an agent (open this doc with a local or cloud agent) to use this",
@@ -43505,6 +43507,14 @@ var EN = {
43505
43507
  "onboarding.doc.body": "With nothing selected, the menu reads “Comment on Doc” and posts a note about the whole plan. Try adding one.",
43506
43508
  "onboarding.answer.title": "Answer the agent",
43507
43509
  "onboarding.answer.body": "The agent asked a question in the comments. Pick an option and click Answer.",
43510
+ "onboarding.layout.title": "Arrange the panes",
43511
+ "onboarding.layout.body": "These buttons show one, two, or three panes — the preview, the Markdown source, and the comments. Switch the layout now to see them.",
43512
+ "onboarding.source.title": "Edit the Markdown source",
43513
+ "onboarding.source.body": "The source pane holds the raw Markdown. Type a change there and the preview updates live. Try editing a line.",
43514
+ "onboarding.movedoc.title": "Split off a new document",
43515
+ "onboarding.movedoc.body": "As a plan grows, select a section, right-click, and choose “Move to New Doc” to break it into its own linked document. (Just a heads-up — no need to do it now.)",
43516
+ "onboarding.finishturn.title": "Hand the turn back",
43517
+ "onboarding.finishturn.body": "When you're done editing, the paper-plane button finishes your turn and hands control to the agent so it can revise. (Nothing is sent during this tour.)",
43508
43518
  "onboarding.finish.title": "You're all set 🎉",
43509
43519
  "onboarding.finish.body": "That's the loop: comment, answer, and let the agent revise. Ready to open your plan?",
43510
43520
  // pane tabs + splitter
@@ -43552,6 +43562,9 @@ var EN = {
43552
43562
  "composer.placeholder": "Add a comment… ({mod}+Enter to submit)",
43553
43563
  "composer.comment": "Comment",
43554
43564
  "composer.cancel": "cancel",
43565
+ "composer.audience": "Comment audience",
43566
+ "composer.talkToAgent": "Talk to the agent",
43567
+ "composer.leaveMemo": "Leave a memo",
43555
43568
  // agent connection indicator
43556
43569
  "agent.connectCloud": "Connect a cloud agent",
43557
43570
  "agent.waitLocal": "Wait for my local agent",
@@ -43616,9 +43629,14 @@ var EN = {
43616
43629
  "banner.reviewNext": "Review next",
43617
43630
  "banner.acceptAll": "Accept all",
43618
43631
  "banner.rejectAll": "Reject all",
43632
+ "banner.allChanges": "accept or reject all changes",
43633
+ "banner.allAccepted": "All changes accepted — click to reject all",
43634
+ "banner.allRejected": "All changes rejected — click to accept all",
43635
+ "banner.allMixed": "Some changes accepted — click to accept all",
43619
43636
  "banner.apply": "Apply",
43620
43637
  "banner.laterLower": "later",
43621
43638
  "banner.locked": "— locked while the agent works; finish handing back to act",
43639
+ "banner.readOnly": "This document is archived — view and download only. Reactivate it to edit.",
43622
43640
  // find / replace bar
43623
43641
  "find.toggleReplace": "toggle replace",
43624
43642
  "find.replace": "Replace",
@@ -43809,6 +43827,57 @@ function resolveDocPath(basePath, href) {
43809
43827
  }
43810
43828
  var ua = typeof navigator !== "undefined" && (navigator.userAgent || navigator.platform) || "";
43811
43829
  var MOD_KEY = /mac/i.test(ua) ? "⌘" : "Ctrl";
43830
+ function Glyph({ children }) {
43831
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", children });
43832
+ }
43833
+ var IconBack = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "15 18 9 12 15 6" }) });
43834
+ var IconForward = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "9 18 15 12 9 6" }) });
43835
+ var IconUp = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "18 15 12 9 6 15" }) });
43836
+ var IconDown = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "6 9 12 15 18 9" }) });
43837
+ var IconZoomOut = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
43838
+ var IconZoomIn = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
43839
+ /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
43840
+ /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
43841
+ ] });
43842
+ var IconFind = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
43843
+ /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "11", cy: "11", r: "7" }),
43844
+ /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
43845
+ ] });
43846
+ var IconComment = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
43847
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }),
43848
+ /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "12", y1: "7", x2: "12", y2: "13" }),
43849
+ /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "9", y1: "10", x2: "15", y2: "10" })
43850
+ ] });
43851
+ var IconMemo = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
43852
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z" }),
43853
+ /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "14 3 14 9 20 9" }),
43854
+ /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "8", y1: "13", x2: "16", y2: "13" }),
43855
+ /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "8", y1: "17", x2: "13", y2: "17" })
43856
+ ] });
43857
+ var IconSave = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
43858
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" }),
43859
+ /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "17 21 17 13 7 13 7 21" }),
43860
+ /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "7 3 7 8 15 8" })
43861
+ ] });
43862
+ var IconFinishTurn = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
43863
+ /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
43864
+ /* @__PURE__ */ jsxRuntimeExports.jsx("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
43865
+ ] });
43866
+ var IconComplete = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "20 6 9 17 4 12" }) });
43867
+ var IconReopen = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
43868
+ /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "3 3 3 9 9 9" }),
43869
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M3.5 13a8 8 0 1 0 2.2-7.4L3 9" })
43870
+ ] });
43871
+ var IconRevealArchive = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
43872
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M4 7c2.6-3.2 13.4-3.2 16 0c-2.6 3.2-13.4 3.2-16 0Z" }),
43873
+ /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "12", cy: "7", r: "1.6" }),
43874
+ /* @__PURE__ */ jsxRuntimeExports.jsx("rect", { x: "5", y: "13", width: "14", height: "7", rx: "1" }),
43875
+ /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "5", y1: "16", x2: "19", y2: "16" })
43876
+ ] });
43877
+ var IconPencil = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
43878
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M12 20h9" }),
43879
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" })
43880
+ ] });
43812
43881
  function ComposerPopover({
43813
43882
  target,
43814
43883
  pos,
@@ -43818,6 +43887,7 @@ function ComposerPopover({
43818
43887
  }) {
43819
43888
  const t2 = useT();
43820
43889
  const [text2, setText] = reactExports.useState("");
43890
+ const [talkToAgent, setTalkToAgent] = reactExports.useState(true);
43821
43891
  const [p2, setP] = reactExports.useState(pos);
43822
43892
  const box = reactExports.useRef(null);
43823
43893
  const ta2 = reactExports.useRef(null);
@@ -43851,7 +43921,7 @@ function ComposerPopover({
43851
43921
  el2.style.height = `${Math.min(el2.scrollHeight, 8 * 22)}px`;
43852
43922
  };
43853
43923
  const submit = () => {
43854
- if (text2.trim()) onSubmit(text2.trim());
43924
+ if (text2.trim()) onSubmit(text2.trim(), talkToAgent);
43855
43925
  };
43856
43926
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-composer ap-composer-float", ref: box, style: { left: p2.x, top: p2.y, right: "auto" }, children: [
43857
43927
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-composer-head", onMouseDown: (e) => drag.current = { dx: e.clientX - p2.x, dy: e.clientY - p2.y }, children: [
@@ -43879,6 +43949,36 @@ function ComposerPopover({
43879
43949
  }
43880
43950
  ),
43881
43951
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-row", children: [
43952
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "ap-agent-toggle", role: "radiogroup", "aria-label": t2("composer.audience"), children: [
43953
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
43954
+ "button",
43955
+ {
43956
+ type: "button",
43957
+ className: `ap-agent-opt${talkToAgent ? " active" : ""}`,
43958
+ role: "radio",
43959
+ "aria-checked": talkToAgent,
43960
+ title: t2("composer.talkToAgent"),
43961
+ "aria-label": t2("composer.talkToAgent"),
43962
+ disabled,
43963
+ onClick: () => setTalkToAgent(true),
43964
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconComment, {})
43965
+ }
43966
+ ),
43967
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
43968
+ "button",
43969
+ {
43970
+ type: "button",
43971
+ className: `ap-agent-opt${!talkToAgent ? " active" : ""}`,
43972
+ role: "radio",
43973
+ "aria-checked": !talkToAgent,
43974
+ title: t2("composer.leaveMemo"),
43975
+ "aria-label": t2("composer.leaveMemo"),
43976
+ disabled,
43977
+ onClick: () => setTalkToAgent(false),
43978
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconMemo, {})
43979
+ }
43980
+ )
43981
+ ] }),
43882
43982
  /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: submit, disabled: disabled || !text2.trim(), children: t2("composer.comment") }),
43883
43983
  /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-link", onClick: onClose, children: t2("composer.cancel") })
43884
43984
  ] })
@@ -43890,9 +43990,11 @@ function Switch({
43890
43990
  label,
43891
43991
  disabled,
43892
43992
  className,
43893
- ariaLabel
43993
+ ariaLabel,
43994
+ intent
43894
43995
  }) {
43895
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: `ap-switch${disabled ? " disabled" : ""}${className ? ` ${className}` : ""}`, children: [
43996
+ const accept = intent === "accept";
43997
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: `ap-switch${accept ? " ap-switch--accept" : ""}${disabled ? " disabled" : ""}${className ? ` ${className}` : ""}`, children: [
43896
43998
  label != null && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-switch-label", children: label }),
43897
43999
  /* @__PURE__ */ jsxRuntimeExports.jsx(
43898
44000
  "input",
@@ -43906,7 +44008,11 @@ function Switch({
43906
44008
  onChange: (e) => onChange(e.target.checked)
43907
44009
  }
43908
44010
  ),
43909
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-switch-track", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-switch-thumb" }) })
44011
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "ap-switch-track", "aria-hidden": "true", children: [
44012
+ accept && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-sw-yes", children: "✓" }),
44013
+ accept && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-sw-no", children: "✗" }),
44014
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-switch-thumb" })
44015
+ ] })
43910
44016
  ] });
43911
44017
  }
43912
44018
  function ContextMenu({
@@ -44167,7 +44273,9 @@ var SourceEditor = reactExports.forwardRef(function SourceEditor2({ value, edita
44167
44273
  return true;
44168
44274
  }
44169
44275
  }),
44170
- // Plugin-injected binding extensions (e.g. remote cursors).
44276
+ // Plugin-injected binding extensions (e.g. yCollab: live text sync, remote cursors, and —
44277
+ // wrapped at highest precedence by the binding via highestPrecKeymap — the collaborative
44278
+ // Yjs undo/redo keymap, so Mod-z beats basicSetup's native history).
44171
44279
  ...binding ? binding.extensions : []
44172
44280
  ]
44173
44281
  })
@@ -44495,13 +44603,10 @@ function ProfileMenu({
44495
44603
  }
44496
44604
  function QuotaPie({ pct, color }) {
44497
44605
  const deg = Math.round(Math.max(0, Math.min(1, pct)) * 360);
44498
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
44499
- "span",
44500
- {
44501
- className: "ap-agent-pie",
44502
- style: { background: `conic-gradient(${color} ${deg}deg, var(--line) 0)` },
44503
- "aria-hidden": "true"
44504
- }
44606
+ return (
44607
+ // The conic ring carries usage (`color` fills `pct`, `var(--line)` the rest); the inner
44608
+ // core disc is the green "connected" indicator and stays green regardless of usage.
44609
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-agent-pie", style: { background: `conic-gradient(${color} ${deg}deg, var(--line) 0)` }, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-agent-pie-core", "aria-hidden": "true" }) })
44505
44610
  );
44506
44611
  }
44507
44612
  function AgentIndicator({
@@ -44596,51 +44701,6 @@ function AgentIndicator({
44596
44701
  ] })
44597
44702
  ] });
44598
44703
  }
44599
- function Glyph({ children }) {
44600
- return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", children });
44601
- }
44602
- var IconBack = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "15 18 9 12 15 6" }) });
44603
- var IconForward = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "9 18 15 12 9 6" }) });
44604
- var IconUp = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "18 15 12 9 6 15" }) });
44605
- var IconDown = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "6 9 12 15 18 9" }) });
44606
- var IconZoomOut = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
44607
- var IconZoomIn = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
44608
- /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
44609
- /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
44610
- ] });
44611
- var IconFind = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
44612
- /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "11", cy: "11", r: "7" }),
44613
- /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
44614
- ] });
44615
- var IconComment = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
44616
- /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }),
44617
- /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "12", y1: "7", x2: "12", y2: "13" }),
44618
- /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "9", y1: "10", x2: "15", y2: "10" })
44619
- ] });
44620
- var IconSave = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
44621
- /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" }),
44622
- /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "17 21 17 13 7 13 7 21" }),
44623
- /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "7 3 7 8 15 8" })
44624
- ] });
44625
- var IconFinishTurn = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
44626
- /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
44627
- /* @__PURE__ */ jsxRuntimeExports.jsx("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
44628
- ] });
44629
- var IconComplete = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "20 6 9 17 4 12" }) });
44630
- var IconReopen = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
44631
- /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "3 3 3 9 9 9" }),
44632
- /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M3.5 13a8 8 0 1 0 2.2-7.4L3 9" })
44633
- ] });
44634
- var IconRevealArchive = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
44635
- /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M4 7c2.6-3.2 13.4-3.2 16 0c-2.6 3.2-13.4 3.2-16 0Z" }),
44636
- /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "12", cy: "7", r: "1.6" }),
44637
- /* @__PURE__ */ jsxRuntimeExports.jsx("rect", { x: "5", y: "13", width: "14", height: "7", rx: "1" }),
44638
- /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "5", y1: "16", x2: "19", y2: "16" })
44639
- ] });
44640
- var IconPencil = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
44641
- /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M12 20h9" }),
44642
- /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" })
44643
- ] });
44644
44704
  function parseAuthor(author) {
44645
44705
  const m2 = author.match(/^(.*?)\s*<([^>]+)>\s*$/);
44646
44706
  const email = m2 ? m2[2].trim() : "";
@@ -44708,13 +44768,10 @@ function AuthorChip({ author }) {
44708
44768
  ] });
44709
44769
  }
44710
44770
  function QuitDialog({
44711
- fileName,
44712
- dirty,
44713
44771
  onQuit,
44714
44772
  onCancel
44715
44773
  }) {
44716
44774
  const t2 = useT();
44717
- const [save, setSave] = reactExports.useState(true);
44718
44775
  const [build, setBuild] = reactExports.useState(false);
44719
44776
  const ref = reactExports.useRef(null);
44720
44777
  reactExports.useEffect(() => ref.current?.querySelector(".ap-primary")?.focus(), []);
@@ -44727,19 +44784,38 @@ function QuitDialog({
44727
44784
  }, [onCancel]);
44728
44785
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-modal-backdrop", onMouseDown: onCancel, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-modal ap-quit", role: "dialog", "aria-modal": "true", "aria-label": t2("quit.title"), ref, onMouseDown: (e) => e.stopPropagation(), children: [
44729
44786
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-quit-title", children: t2("quit.title") }),
44730
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-quit-opts", children: [
44731
- dirty && /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "ap-quit-opt", children: [
44732
- /* @__PURE__ */ jsxRuntimeExports.jsx("input", { type: "checkbox", checked: save, onChange: (e) => setSave(e.target.checked) }),
44733
- t2("quit.save", { file: fileName ?? t2("quit.thisDoc") })
44734
- ] }),
44735
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "ap-quit-opt", children: [
44736
- /* @__PURE__ */ jsxRuntimeExports.jsx("input", { type: "checkbox", checked: build, onChange: (e) => setBuild(e.target.checked) }),
44737
- t2("quit.startBuild")
44738
- ] })
44739
- ] }),
44787
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-quit-opts", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "ap-quit-opt", children: [
44788
+ /* @__PURE__ */ jsxRuntimeExports.jsx("input", { type: "checkbox", checked: build, onChange: (e) => setBuild(e.target.checked) }),
44789
+ t2("quit.startBuild")
44790
+ ] }) }),
44791
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-quit-actions", children: [
44792
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-link", onClick: onCancel, children: t2("quit.cancel") }),
44793
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-primary", onClick: () => onQuit({ startBuild: build }), children: t2("quit.quit") })
44794
+ ] })
44795
+ ] }) });
44796
+ }
44797
+ function CapLimitDialog({
44798
+ limit,
44799
+ lruTitle,
44800
+ onConfirm,
44801
+ onCancel
44802
+ }) {
44803
+ const t2 = useT();
44804
+ const ref = reactExports.useRef(null);
44805
+ reactExports.useEffect(() => ref.current?.querySelector(".ap-link")?.focus(), []);
44806
+ reactExports.useEffect(() => {
44807
+ const onKey = (e) => {
44808
+ if (e.key === "Escape") onCancel();
44809
+ };
44810
+ document.addEventListener("keydown", onKey);
44811
+ return () => document.removeEventListener("keydown", onKey);
44812
+ }, [onCancel]);
44813
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-modal-backdrop", onMouseDown: onCancel, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-modal ap-quit", role: "dialog", "aria-modal": "true", "aria-label": t2("newdoc.limitTitle"), ref, onMouseDown: (e) => e.stopPropagation(), children: [
44814
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-quit-title", children: t2("newdoc.limitTitle") }),
44815
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "ap-quit-body", children: t2("newdoc.limitBody", { limit, title: lruTitle }) }),
44740
44816
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-quit-actions", children: [
44741
44817
  /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-link", onClick: onCancel, children: t2("quit.cancel") }),
44742
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-primary", onClick: () => onQuit({ save: dirty && save, startBuild: build }), children: t2("quit.quit") })
44818
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-primary", onClick: onConfirm, children: t2("newdoc.deactivateAndCreate") })
44743
44819
  ] })
44744
44820
  ] }) });
44745
44821
  }
@@ -44770,6 +44846,13 @@ var STEPS = [
44770
44846
  { id: "inline", target: '[data-onboard="preview"]', gate: (n2, b) => n2.inline > b.inline },
44771
44847
  { id: "doc", target: '[data-onboard="preview"]', gate: (n2, b) => n2.doc > b.doc },
44772
44848
  { id: "answer", target: '[data-onboard="comments"]', gate: (n2, b) => n2.answered > b.answered },
44849
+ { id: "layout", target: '[data-onboard="panes"]', gate: (n2, b) => n2.panes !== b.panes },
44850
+ { id: "source", target: '[data-onboard="source"]', gate: (n2, b) => n2.sourceEdits > b.sourceEdits },
44851
+ // The last two are informational (no gate): triggering them for real would navigate the tour
44852
+ // off the throwaway sample (Move to New Doc) or hand the turn to an agent that isn't there
44853
+ // (Finish turn), so we spotlight + explain them rather than force the action.
44854
+ { id: "movedoc", target: '[data-onboard="preview"]', gate: null },
44855
+ { id: "finishturn", target: '[data-onboard="finishturn"]', gate: null },
44773
44856
  { id: "finish", target: null, gate: null }
44774
44857
  ];
44775
44858
  var SPOTLIGHT = "ap-coach-target";
@@ -44877,6 +44960,8 @@ Select any line above, then press the comment shortcut to leave a note on it.
44877
44960
  function createMemoryApi(opts) {
44878
44961
  const store = new MemoryDocumentStore(opts.content);
44879
44962
  const channel = new MemoryControlChannel();
44963
+ let currentPath = "memory://doc";
44964
+ let currentReadOnly = opts.readOnly === true;
44880
44965
  let settings = opts.settings ?? { autoResolve: true };
44881
44966
  let closed = false;
44882
44967
  const telemetryEvents = [];
@@ -44897,7 +44982,7 @@ function createMemoryApi(opts) {
44897
44982
  const api = {
44898
44983
  async load() {
44899
44984
  if (await store.getCanonical() === null) await store.setCanonical(opts.content);
44900
- return { path: "memory://doc", content: await store.loadDoc() };
44985
+ return { path: currentPath, content: await store.loadDoc(), ...currentReadOnly ? { readOnly: true } : {} };
44901
44986
  },
44902
44987
  async save(content2, options) {
44903
44988
  if (options.kind === "backup") {
@@ -44935,10 +45020,8 @@ function createMemoryApi(opts) {
44935
45020
  showBackButton: opts.backButton ?? false,
44936
45021
  // opt-in (web-like): expose the in-editor Back control
44937
45022
  quit(content2, opts2) {
44938
- if (opts2.save) {
44939
- void store.saveDoc(content2);
44940
- void store.setCanonical(content2);
44941
- }
45023
+ void store.saveDoc(content2);
45024
+ void store.setCanonical(content2);
44942
45025
  void channel.append({ actor: "user", type: LogEventType.SessionClosed, payload: { reason: opts2.startBuild ? "completed" : "window_closed" } });
44943
45026
  closed = true;
44944
45027
  }
@@ -44991,10 +45074,12 @@ function createMemoryApi(opts) {
44991
45074
  void channel.append({ actor: "agent", type: LogEventType.AgentMessage, payload: { text: text2 }, ts });
44992
45075
  for (const cb2 of messages) cb2({ text: text2, ts });
44993
45076
  },
44994
- navigate(content2, path = "memory://doc2") {
45077
+ navigate(content2, path = "memory://doc2", readOnly2 = opts.readOnly === true) {
44995
45078
  void store.saveDoc(content2);
44996
45079
  void store.setCanonical(content2);
44997
- for (const cb2 of navigated) cb2({ path, content: content2 });
45080
+ currentPath = path;
45081
+ currentReadOnly = readOnly2;
45082
+ for (const cb2 of navigated) cb2({ path, content: content2, ...readOnly2 ? { readOnly: true } : {} });
44998
45083
  },
44999
45084
  async log() {
45000
45085
  return (await channel.readSince(0)).entries;
@@ -45159,22 +45244,47 @@ function CloudSignInOverlay({ url, onDismiss }) {
45159
45244
  }, [onDismiss]);
45160
45245
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-signin-backdrop", onMouseDown: onDismiss, role: "presentation", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-signin-panel", onMouseDown: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("iframe", { className: "ap-signin-frame", src: url, title: "Sign in to inplan.ai" }) }) });
45161
45246
  }
45247
+ function readLayout() {
45248
+ try {
45249
+ const parsed = JSON.parse(localStorage.getItem("ap-layout") ?? "{}");
45250
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
45251
+ } catch {
45252
+ return {};
45253
+ }
45254
+ }
45162
45255
  function App(props = {}) {
45163
45256
  const t2 = useT();
45164
45257
  const [loaded, setLoaded] = reactExports.useState(false);
45165
45258
  const [doc2, setDoc] = reactExports.useState(EMPTY);
45166
- const [cadence, setCadence] = reactExports.useState("turn");
45259
+ const [readOnly2, setReadOnly] = reactExports.useState(false);
45167
45260
  const modes = reactExports.useMemo(() => [TURN_MODE, ...hostApi().extraModes ?? []], []);
45261
+ const [cadence, setCadence] = reactExports.useState(() => {
45262
+ const c = readLayout().cadence;
45263
+ return typeof c === "string" && modes.some((m2) => m2.id === c) ? c : "turn";
45264
+ });
45168
45265
  const mode = resolveMode(cadence, modes);
45169
45266
  const [acceptance, setAcceptance] = reactExports.useState("review");
45170
45267
  const [autoResolve, setAutoResolve] = reactExports.useState(false);
45171
45268
  const [agentMode, setAgentMode] = reactExports.useState("planning");
45172
45269
  const [telemetry, setTelemetry] = reactExports.useState(false);
45173
- const [panes, setPanes] = reactExports.useState(2);
45174
- const [rightTab, setRightTab] = reactExports.useState("comments");
45175
- const [srcW, setSrcW] = reactExports.useState(380);
45176
- const [cmtW, setCmtW] = reactExports.useState(380);
45177
- const [zoom, setZoom] = reactExports.useState(1);
45270
+ const [panes, setPanes] = reactExports.useState(() => {
45271
+ const p2 = readLayout().panes;
45272
+ return p2 === 1 || p2 === 2 || p2 === 3 ? p2 : 2;
45273
+ });
45274
+ const [onboardSourceEdits, setOnboardSourceEdits] = reactExports.useState(0);
45275
+ const [rightTab, setRightTab] = reactExports.useState(() => readLayout().rightTab === "source" ? "source" : "comments");
45276
+ const [srcW, setSrcW] = reactExports.useState(() => {
45277
+ const w2 = readLayout().srcW;
45278
+ return typeof w2 === "number" ? Math.min(900, Math.max(220, w2)) : 380;
45279
+ });
45280
+ const [cmtW, setCmtW] = reactExports.useState(() => {
45281
+ const w2 = readLayout().cmtW;
45282
+ return typeof w2 === "number" ? Math.min(900, Math.max(220, w2)) : 380;
45283
+ });
45284
+ const [zoom, setZoom] = reactExports.useState(() => {
45285
+ const z2 = readLayout().zoom;
45286
+ return typeof z2 === "number" ? Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, z2)) : 1;
45287
+ });
45178
45288
  const [dirty, setDirty] = reactExports.useState(false);
45179
45289
  const [status, setStatus] = reactExports.useState("");
45180
45290
  const [agentThinking, setAgentThinking] = reactExports.useState(false);
@@ -45190,7 +45300,7 @@ function App(props = {}) {
45190
45300
  const userAuthorRef = reactExports.useRef(userAuthor);
45191
45301
  userAuthorRef.current = userAuthor;
45192
45302
  const [updating, setUpdating] = reactExports.useState("idle");
45193
- const [showResolvedOrphaned, setShowResolvedOrphaned] = reactExports.useState(false);
45303
+ const [showResolvedOrphaned, setShowResolvedOrphaned] = reactExports.useState(() => readLayout().showResolvedOrphaned === true);
45194
45304
  const [selectionText, setSelectionText] = reactExports.useState("");
45195
45305
  const [composer, setComposer] = reactExports.useState(null);
45196
45306
  const [newDocReq, setNewDocReq] = reactExports.useState(null);
@@ -45227,19 +45337,6 @@ function App(props = {}) {
45227
45337
  const autoResolvedRef = reactExports.useRef(/* @__PURE__ */ new Set());
45228
45338
  const saveNowRef = reactExports.useRef(() => {
45229
45339
  });
45230
- reactExports.useEffect(() => {
45231
- try {
45232
- const s = JSON.parse(localStorage.getItem("ap-layout") ?? "{}");
45233
- if (s.panes === 1 || s.panes === 2 || s.panes === 3) setPanes(s.panes);
45234
- if (s.rightTab === "comments" || s.rightTab === "source") setRightTab(s.rightTab);
45235
- if (typeof s.zoom === "number") setZoom(Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, s.zoom)));
45236
- if (typeof s.showResolvedOrphaned === "boolean") setShowResolvedOrphaned(s.showResolvedOrphaned);
45237
- if (typeof s.cadence === "string" && modes.some((m2) => m2.id === s.cadence)) setCadence(s.cadence);
45238
- if (typeof s.srcW === "number") setSrcW(Math.min(900, Math.max(220, s.srcW)));
45239
- if (typeof s.cmtW === "number") setCmtW(Math.min(900, Math.max(220, s.cmtW)));
45240
- } catch {
45241
- }
45242
- }, []);
45243
45340
  reactExports.useEffect(() => {
45244
45341
  localStorage.setItem("ap-layout", JSON.stringify({ panes, rightTab, zoom, showResolvedOrphaned, cadence, srcW, cmtW }));
45245
45342
  }, [panes, rightTab, zoom, showResolvedOrphaned, cadence, srcW, cmtW]);
@@ -45259,8 +45356,9 @@ function App(props = {}) {
45259
45356
  setStatus(t2("msg.proposedReview"));
45260
45357
  };
45261
45358
  const commentStore = hostApi().commentStore ?? null;
45262
- hostApi().load().then(({ content: content2, path }) => {
45359
+ hostApi().load().then(({ content: content2, path, readOnly: ro }) => {
45263
45360
  docPathRef.current = path;
45361
+ setReadOnly(!!ro);
45264
45362
  const parsed = parse(content2);
45265
45363
  const d = commentStore ? { ...parsed, comments: commentStore.list() } : parsed;
45266
45364
  setDoc(d);
@@ -45270,12 +45368,14 @@ function App(props = {}) {
45270
45368
  }).catch(() => setLoaded(true));
45271
45369
  const subs = [
45272
45370
  hostApi().onExternalChange(({ content: content2 }) => {
45371
+ const prevDoc = docRef.current;
45273
45372
  const parsed = parse(content2);
45274
45373
  const next = commentStore ? { ...parsed, comments: commentStore.list() } : parsed;
45275
45374
  setAgentThinking(false);
45276
45375
  setDoc(next);
45277
45376
  savedRef.current = serialize(next);
45278
45377
  setDirty(false);
45378
+ syncExternalDoc(next, prevDoc.comments, prevDoc.body);
45279
45379
  setStatus(t2("msg.agentUpdated"));
45280
45380
  }),
45281
45381
  // Review-mode body changes arrive parked, as a proposal to accept/reject.
@@ -45294,9 +45394,10 @@ function App(props = {}) {
45294
45394
  hostApi().onAgentMessage?.((msg) => setAgentMessages((prev) => [...prev, msg])),
45295
45395
  // Desktop only: the window followed a link to another doc — reset to it (a fresh
45296
45396
  // load), clearing any in-flight proposal/turn state, then re-show a parked proposal.
45297
- hostApi().onNavigated?.(({ content: content2, path }) => {
45397
+ hostApi().onNavigated?.(({ content: content2, path, readOnly: ro }) => {
45298
45398
  if (docPathRef.current) historyByDoc.current.set(docPathRef.current, { undo: history2.current, redo: future.current });
45299
45399
  docPathRef.current = path;
45400
+ setReadOnly(!!ro);
45300
45401
  const parsed = parse(content2);
45301
45402
  const d = commentStore ? { ...parsed, comments: commentStore.list() } : parsed;
45302
45403
  setDoc(d);
@@ -45387,6 +45488,10 @@ function App(props = {}) {
45387
45488
  });
45388
45489
  reactExports.useEffect(() => {
45389
45490
  const onKey = (e) => {
45491
+ if (readOnly2 && (e.metaKey || e.ctrlKey) && !e.altKey && ["z", "Z", "/", "s", "S"].includes(e.key)) {
45492
+ e.preventDefault();
45493
+ return;
45494
+ }
45390
45495
  if ((e.metaKey || e.ctrlKey) && (e.key === "z" || e.key === "Z")) {
45391
45496
  const active = document.activeElement;
45392
45497
  if (active?.closest(".ap-source") || active?.closest(".ap-ihunk-edit-ta")) return;
@@ -45418,8 +45523,9 @@ function App(props = {}) {
45418
45523
  };
45419
45524
  document.addEventListener("keydown", onKey);
45420
45525
  return () => document.removeEventListener("keydown", onKey);
45421
- }, [composer, findOpen, proposal, reviewOpen, undo2, redo2]);
45422
- const editingLocked = mode.locksEditor && agentThinking;
45526
+ }, [composer, findOpen, proposal, reviewOpen, undo2, redo2, readOnly2]);
45527
+ const agentLocked = mode.locksEditor && agentThinking;
45528
+ const editingLocked = agentLocked || readOnly2;
45423
45529
  const takeBackControl = reactExports.useCallback(() => {
45424
45530
  setAgentThinking(false);
45425
45531
  setStatus(t2("msg.tookBack"));
@@ -45561,6 +45667,7 @@ function App(props = {}) {
45561
45667
  setZoom((z2) => dir === 0 ? 1 : Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, +(z2 + dir * 0.1).toFixed(2))));
45562
45668
  }, []);
45563
45669
  const saveNow = reactExports.useCallback(() => {
45670
+ if (readOnly2) return;
45564
45671
  const content2 = serialize(docRef.current);
45565
45672
  const kind = mode.autosaveKind;
45566
45673
  void hostApi().save(content2, { kind, cadence }).then(() => setCheckpoint(content2));
@@ -45569,7 +45676,7 @@ function App(props = {}) {
45569
45676
  setDirty(false);
45570
45677
  }
45571
45678
  setStatus(kind === "canonical" ? "saved" : "checkpoint saved");
45572
- }, [cadence, mode]);
45679
+ }, [cadence, mode, readOnly2]);
45573
45680
  saveNowRef.current = saveNow;
45574
45681
  const pendingAnswersRef = reactExports.useRef(/* @__PURE__ */ new Set());
45575
45682
  const nudgedAnswersRef = reactExports.useRef(/* @__PURE__ */ new Set());
@@ -45598,6 +45705,11 @@ function App(props = {}) {
45598
45705
  setStatus(t2("msg.turnFinished"));
45599
45706
  }, [setQuestionPending]);
45600
45707
  const [quitOpen, setQuitOpen] = reactExports.useState(false);
45708
+ const [capConfirm, setCapConfirm] = reactExports.useState(null);
45709
+ const askEvictLru = reactExports.useCallback(
45710
+ (limit, lruTitle) => new Promise((resolve) => setCapConfirm({ limit, lruTitle, resolve })),
45711
+ []
45712
+ );
45601
45713
  const [forceSettingsOpen, setForceSettingsOpen] = reactExports.useState(false);
45602
45714
  const confirmQuit = reactExports.useCallback((opts) => {
45603
45715
  realHostApi().exit?.quit(serialize(docRef.current), opts);
@@ -45606,29 +45718,31 @@ function App(props = {}) {
45606
45718
  reactExports.useEffect(() => {
45607
45719
  const real = realHostApi();
45608
45720
  return real?.exit?.onRequest?.(() => {
45609
- if (props.onboarding) real.exit?.quit("", { save: false, startBuild: false });
45721
+ if (props.onboarding) real.exit?.quit("", { startBuild: false });
45610
45722
  else setQuitOpen(true);
45611
45723
  });
45612
45724
  }, [props.onboarding]);
45613
45725
  const addComment = reactExports.useCallback(
45614
- (text2, target, span, question2) => {
45726
+ (text2, target, span, question2, talkToAgent = true) => {
45727
+ const agent = talkToAgent ? void 0 : false;
45728
+ const memoPayload = talkToAgent ? {} : { agent: false };
45615
45729
  if (target) {
45616
45730
  const blocker = spanCommentBlocker(docRef.current.body, target, span ?? void 0);
45617
45731
  if (blocker) {
45618
45732
  setStatus(blocker === "overlap" ? t2("topbar.cantOverlap") : t2("msg.cantAnchor"));
45619
45733
  return;
45620
45734
  }
45621
- const res = addSpanComment(docRef.current, target, { text: text2, author: userAuthorRef.current, question: question2 }, span ?? void 0);
45735
+ const res = addSpanComment(docRef.current, target, { text: text2, author: userAuthorRef.current, question: question2, agent }, span ?? void 0);
45622
45736
  if (!res) {
45623
45737
  setStatus(t2("msg.cantAnchor"));
45624
45738
  return;
45625
45739
  }
45626
- apply(res.doc, { type: "comment_created", payload: { id: res.id } });
45740
+ apply(res.doc, { type: "comment_created", payload: { id: res.id, ...memoPayload } });
45627
45741
  hostApi().telemetry?.("comment_created", { kind: "span" });
45628
45742
  setFocused(res.id);
45629
45743
  } else {
45630
- const res = addDocComment(docRef.current, { text: text2, author: userAuthorRef.current, question: question2 });
45631
- apply(res.doc, { type: "comment_created", payload: { id: res.id, anchor: "doc" } });
45744
+ const res = addDocComment(docRef.current, { text: text2, author: userAuthorRef.current, question: question2, agent });
45745
+ apply(res.doc, { type: "comment_created", payload: { id: res.id, anchor: "doc", ...memoPayload } });
45632
45746
  hostApi().telemetry?.("comment_created", { kind: "doc" });
45633
45747
  setFocused(res.id);
45634
45748
  }
@@ -45713,12 +45827,24 @@ function App(props = {}) {
45713
45827
  content2 = `# ${title}
45714
45828
  `;
45715
45829
  }
45716
- const draftOpts = req.mode === "create" && opts.draftPrompt ? { draftPrompt: opts.draftPrompt } : null;
45717
- const res = draftOpts ? await api.newDoc.create(path, content2, draftOpts) : await api.newDoc.create(path, content2);
45830
+ const draftOpts = req.mode === "create" && opts.draftPrompt ? { draftPrompt: opts.draftPrompt } : void 0;
45831
+ let res = draftOpts ? await api.newDoc.create(path, content2, draftOpts) : await api.newDoc.create(path, content2);
45832
+ if (res && res.status === "limit") {
45833
+ const ok2 = await askEvictLru(res.limit, res.lruTitle);
45834
+ if (!ok2) {
45835
+ setStatus(t2("newdoc.limitCancelled"));
45836
+ return;
45837
+ }
45838
+ res = await api.newDoc.create(path, content2, { ...draftOpts ?? {}, evictLru: true });
45839
+ }
45718
45840
  if (!res) {
45719
45841
  setStatus(t2("newdoc.failed"));
45720
45842
  return;
45721
45843
  }
45844
+ if (res.status === "limit") {
45845
+ setStatus(t2("newdoc.failed"));
45846
+ return;
45847
+ }
45722
45848
  if (res.status === "exists") {
45723
45849
  setNewDocReq({ ...req, existing: res.linkTarget });
45724
45850
  setStatus(t2("newdoc.exists"));
@@ -45861,7 +45987,8 @@ function App(props = {}) {
45861
45987
  (segs, accepted2) => {
45862
45988
  if (!proposal || editingLocked) return;
45863
45989
  const body = applySegments(segs, accepted2);
45864
- const live = docRef.current.comments;
45990
+ const prevDoc = docRef.current;
45991
+ const live = prevDoc.comments;
45865
45992
  const have = new Set(live.map((c) => c.id));
45866
45993
  const merged = [...live, ...proposal.next.comments.filter((c) => !have.has(c.id))];
45867
45994
  const comments = merged.map((c) => !c.parentId && c.anchor !== "doc" && !body.includes(`](#${c.id})`) ? { ...c, anchor: "doc" } : c);
@@ -45873,12 +46000,16 @@ function App(props = {}) {
45873
46000
  savedRef.current = serialized;
45874
46001
  setDirty(false);
45875
46002
  const acceptedCount = accepted2.filter(Boolean).length;
45876
- void hostApi().save(serialized, { kind: "apply", cadence }).then(() => setCheckpoint(serialized));
46003
+ if (syncExternalDoc(finalDoc, prevDoc.comments, prevDoc.body)) {
46004
+ setCheckpoint(serialized);
46005
+ } else {
46006
+ void hostApi().save(serialized, { kind: "apply", cadence }).then(() => setCheckpoint(serialized));
46007
+ }
45877
46008
  void hostApi().clearProposal();
45878
46009
  void hostApi().logAction(acceptedCount === accepted2.length ? "revision_accepted_all" : acceptedCount === 0 ? "revision_rejected_all" : "revision_hunk_accepted", { accepted: acceptedCount, total: accepted2.length });
45879
46010
  setStatus(`applied agent revision (${acceptedCount}/${accepted2.length} hunks)`);
45880
46011
  },
45881
- [proposal, cadence, editingLocked]
46012
+ [proposal, cadence, editingLocked, syncExternalDoc]
45882
46013
  );
45883
46014
  const reviewSegs = reactExports.useMemo(() => proposal ? lineSegments(proposal.baseBody, proposal.next.body) : [], [proposal]);
45884
46015
  const changeCount = reactExports.useMemo(() => reviewSegs.filter(isChange).length, [reviewSegs]);
@@ -46048,9 +46179,11 @@ function App(props = {}) {
46048
46179
  () => ({
46049
46180
  inline: doc2.comments.filter(isSpanComment).length,
46050
46181
  doc: doc2.comments.filter(isDocComment).length,
46051
- answered: doc2.comments.filter((c) => c.selected !== void 0).length
46182
+ answered: doc2.comments.filter((c) => c.selected !== void 0).length,
46183
+ panes,
46184
+ sourceEdits: onboardSourceEdits
46052
46185
  }),
46053
- [doc2.comments]
46186
+ [doc2.comments, panes, onboardSourceEdits]
46054
46187
  );
46055
46188
  if (!loaded) return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-loading", children: t2("app.loading") });
46056
46189
  const showSource = panes === 3 || panes === 2 && rightTab === "source";
@@ -46198,6 +46331,7 @@ function App(props = {}) {
46198
46331
  ),
46199
46332
  /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-link", onClick: () => setUpdate(null), children: t2("banner.later") })
46200
46333
  ] }) }),
46334
+ readOnly2 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-banner ap-banner--readonly", role: "status", children: t2("banner.readOnly") }),
46201
46335
  proposal && !reviewOpen && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-banner", children: [
46202
46336
  t2("banner.proposalPending"),
46203
46337
  " ",
@@ -46216,8 +46350,7 @@ function App(props = {}) {
46216
46350
  TriSwitch,
46217
46351
  {
46218
46352
  state: changeCount > 0 && accepted.slice(0, changeCount).every(Boolean) ? "accept" : changeCount > 0 && accepted.slice(0, changeCount).every((v2) => !v2) ? "reject" : "mixed",
46219
- onAccept: () => setAllAccepted(true),
46220
- onReject: () => setAllAccepted(false),
46353
+ onCycle: (v2) => setAllAccepted(v2),
46221
46354
  disabled: editingLocked || !changeCount
46222
46355
  }
46223
46356
  ),
@@ -46231,20 +46364,27 @@ function App(props = {}) {
46231
46364
  target: composer.target,
46232
46365
  pos: composer.pos,
46233
46366
  disabled: editingLocked,
46234
- onSubmit: (text2) => {
46235
- addComment(text2, composer.target, composer.span);
46367
+ onSubmit: (text2, talkToAgent) => {
46368
+ addComment(text2, composer.target, composer.span, void 0, talkToAgent);
46236
46369
  setComposer(null);
46237
46370
  },
46238
46371
  onClose: () => setComposer(null)
46239
46372
  }
46240
46373
  ),
46241
- quitOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(
46242
- QuitDialog,
46374
+ quitOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(QuitDialog, { onQuit: confirmQuit, onCancel: () => setQuitOpen(false) }),
46375
+ capConfirm && /* @__PURE__ */ jsxRuntimeExports.jsx(
46376
+ CapLimitDialog,
46243
46377
  {
46244
- fileName: docPathRef.current ? docPathRef.current.split(/[\\/]/).pop() || null : null,
46245
- dirty,
46246
- onQuit: confirmQuit,
46247
- onCancel: () => setQuitOpen(false)
46378
+ limit: capConfirm.limit,
46379
+ lruTitle: capConfirm.lruTitle,
46380
+ onConfirm: () => {
46381
+ capConfirm.resolve(true);
46382
+ setCapConfirm(null);
46383
+ },
46384
+ onCancel: () => {
46385
+ capConfirm.resolve(false);
46386
+ setCapConfirm(null);
46387
+ }
46248
46388
  }
46249
46389
  ),
46250
46390
  newDocReq && /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -46260,7 +46400,17 @@ function App(props = {}) {
46260
46400
  onCancel: () => setNewDocReq(null)
46261
46401
  }
46262
46402
  ),
46263
- props.onboarding && props.onFinishOnboarding && /* @__PURE__ */ jsxRuntimeExports.jsx(Onboarding, { signals: onboardingSignals, onFinish: props.onFinishOnboarding, onActiveStep: (id2) => setForceSettingsOpen(id2 === "settings") }),
46403
+ props.onboarding && props.onFinishOnboarding && /* @__PURE__ */ jsxRuntimeExports.jsx(
46404
+ Onboarding,
46405
+ {
46406
+ signals: onboardingSignals,
46407
+ onFinish: props.onFinishOnboarding,
46408
+ onActiveStep: (id2) => {
46409
+ setForceSettingsOpen(id2 === "settings");
46410
+ if (id2 === "source") setPanes(3);
46411
+ }
46412
+ }
46413
+ ),
46264
46414
  signInUrl && /* @__PURE__ */ jsxRuntimeExports.jsx(
46265
46415
  CloudSignInOverlay,
46266
46416
  {
@@ -46389,7 +46539,7 @@ function App(props = {}) {
46389
46539
  ),
46390
46540
  showSource && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
46391
46541
  /* @__PURE__ */ jsxRuntimeExports.jsx(VSplitter, { width: srcW, setWidth: setSrcW }),
46392
- /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "ap-pane", style: { width: srcW }, children: [
46542
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "ap-pane", style: { width: srcW }, "data-onboard": "source", children: [
46393
46543
  panes === 2 && /* @__PURE__ */ jsxRuntimeExports.jsx(PaneTabs, { tab: rightTab, onTab: setRightTab }),
46394
46544
  proposal && reviewOpen ? /* @__PURE__ */ jsxRuntimeExports.jsx(DiffSource, { segs: editedSegs, accepted, focused: reviewCursor, onToggle: toggleHunk }) : /* @__PURE__ */ jsxRuntimeExports.jsx(EditorErrorBoundary, { label: "The source editor", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
46395
46545
  SourceEditor,
@@ -46400,6 +46550,7 @@ function App(props = {}) {
46400
46550
  editable: !editingLocked,
46401
46551
  onChange: (body) => {
46402
46552
  setDoc((d) => ({ ...d, body }));
46553
+ if (props.onboarding) setOnboardSourceEdits((n2) => n2 + 1);
46403
46554
  if (!hostApi().binding?.setText) setDirty(serialize({ ...docRef.current, body }) !== savedRef.current);
46404
46555
  },
46405
46556
  onCursorLine: (line) => setActivePreviewLine(line),
@@ -46473,7 +46624,7 @@ function App(props = {}) {
46473
46624
  dirty: dirty && serialize(doc2) !== checkpoint,
46474
46625
  agentThinking,
46475
46626
  messages: agentMessages,
46476
- canTakeBack: editingLocked,
46627
+ canTakeBack: agentLocked,
46477
46628
  onTakeBack: takeBackControl
46478
46629
  }
46479
46630
  )
@@ -46497,6 +46648,7 @@ function AppRoot() {
46497
46648
  const real = window.api;
46498
46649
  sample.i18n = real?.i18n;
46499
46650
  sample.extraModes = real?.extraModes;
46651
+ sample.profile = realHostApi().profile;
46500
46652
  setApiOverride(sample);
46501
46653
  }, []);
46502
46654
  reactExports.useEffect(() => {
@@ -46569,7 +46721,7 @@ function TopBar(props) {
46569
46721
  const { cadence, acceptance, panes, onMode } = props;
46570
46722
  const profile = useProfile();
46571
46723
  const t2 = useT();
46572
- const noAgent = profile?.presenceAware === true && profile.agentLocation == null;
46724
+ const noAgent = profile?.presenceAware === true && profile.agentAvailable !== true && profile.agentLocation == null;
46573
46725
  const noAgentTitle = noAgent ? t2("topbar.noAgent") : void 0;
46574
46726
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("header", { className: "ap-topbar", children: [
46575
46727
  props.onBack && /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "ap-iconbtn ap-iconbtn--primary", onClick: props.onBack, title: t2("topbar.back"), "aria-label": t2("topbar.back"), children: [
@@ -46587,7 +46739,7 @@ function TopBar(props) {
46587
46739
  },
46588
46740
  m2.id
46589
46741
  )) }),
46590
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-seg", role: "group", "aria-label": "panes", children: [1, 2, 3].map((n2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
46742
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-seg", role: "group", "aria-label": "panes", "data-onboard": "panes", children: [1, 2, 3].map((n2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
46591
46743
  "button",
46592
46744
  {
46593
46745
  className: panes === n2 ? "active" : "",
@@ -46626,7 +46778,7 @@ function TopBar(props) {
46626
46778
  )
46627
46779
  ] }),
46628
46780
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-iconrow", role: "group", "aria-label": "save and turn", children: [
46629
- /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "ap-iconbtn", onClick: props.onSave, title: props.dirty ? t2("topbar.saveUnsaved") : t2("topbar.save"), "aria-label": t2("topbar.save"), children: [
46781
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "ap-iconbtn", onClick: props.onSave, disabled: props.locked, title: props.dirty ? t2("topbar.saveUnsaved") : t2("topbar.save"), "aria-label": t2("topbar.save"), children: [
46630
46782
  /* @__PURE__ */ jsxRuntimeExports.jsx(IconSave, {}),
46631
46783
  props.dirty && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-dirty", "aria-hidden": "true" })
46632
46784
  ] }),
@@ -46634,6 +46786,7 @@ function TopBar(props) {
46634
46786
  "button",
46635
46787
  {
46636
46788
  className: "ap-iconbtn",
46789
+ "data-onboard": "finishturn",
46637
46790
  onClick: props.onFinishTurn,
46638
46791
  disabled: props.locked || noAgent,
46639
46792
  title: noAgentTitle ?? t2("topbar.finishTurnTitle"),
@@ -46822,12 +46975,28 @@ function FindReplaceBar({
46822
46975
  /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-link", onClick: onClose, children: t2("find.close") })
46823
46976
  ] });
46824
46977
  }
46825
- function TriSwitch({ state, onAccept, onReject, disabled }) {
46826
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: `ap-tri ap-tri--${state}${disabled ? " disabled" : ""}`, role: "group", "aria-label": "accept or reject all changes", children: [
46827
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "ap-tri-end ap-tri-accept", "aria-pressed": state === "accept", disabled, onClick: onAccept, children: "Accept all" }),
46828
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-tri-track", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-tri-thumb" }) }),
46829
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "ap-tri-end ap-tri-reject", "aria-pressed": state === "reject", disabled, onClick: onReject, children: "Reject all" })
46830
- ] });
46978
+ function TriSwitch({ state, onCycle, disabled }) {
46979
+ const t2 = useT();
46980
+ const next = state !== "accept";
46981
+ const title = state === "accept" ? t2("banner.allAccepted") : state === "reject" ? t2("banner.allRejected") : t2("banner.allMixed");
46982
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
46983
+ "button",
46984
+ {
46985
+ type: "button",
46986
+ className: `ap-tri ap-tri--${state}${disabled ? " disabled" : ""}`,
46987
+ role: "checkbox",
46988
+ "aria-checked": state === "mixed" ? "mixed" : state === "accept",
46989
+ "aria-label": t2("banner.allChanges"),
46990
+ title,
46991
+ disabled,
46992
+ onClick: () => onCycle(next),
46993
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "ap-switch-track", "aria-hidden": "true", children: [
46994
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-sw-yes", children: "✓" }),
46995
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-sw-no", children: "✗" }),
46996
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-switch-thumb" })
46997
+ ] })
46998
+ }
46999
+ );
46831
47000
  }
46832
47001
  function HunkBar({ idx, on, onToggle, onEdit, editing }) {
46833
47002
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-hunk-bar", children: [
@@ -46838,7 +47007,7 @@ function HunkBar({ idx, on, onToggle, onEdit, editing }) {
46838
47007
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-spacer" }),
46839
47008
  on && onEdit && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: `ap-hunk-edit${editing ? " active" : ""}`, "aria-label": `edit change ${idx + 1}`, title: "Edit this change", onClick: () => onEdit(idx), children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconPencil, {}) }),
46840
47009
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-willbe", children: on ? "will be accepted" : "will be rejected" }),
46841
- /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, { checked: on, onChange: (v2) => onToggle(idx, v2), ariaLabel: `accept change ${idx + 1}` })
47010
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, { checked: on, onChange: (v2) => onToggle(idx, v2), ariaLabel: `accept change ${idx + 1}`, intent: "accept" })
46842
47011
  ] });
46843
47012
  }
46844
47013
  function DiffPreview({