inplan 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app/main/index.js
CHANGED
|
@@ -326,7 +326,7 @@ function writeStatus(statusPath, status) {
|
|
|
326
326
|
writeFileSync(statusPath, `${JSON.stringify(status, null, 2)}
|
|
327
327
|
`);
|
|
328
328
|
}
|
|
329
|
-
var PLUGIN_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAVP11te5E7xzNJ4reKg0+mAnrr91gcyD1bMr43Homq98=\n-----END PUBLIC KEY
|
|
329
|
+
var PLUGIN_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAVP11te5E7xzNJ4reKg0+mAnrr91gcyD1bMr43Homq98=\n-----END PUBLIC KEY-----\n";
|
|
330
330
|
function verifyLease(token, publicKeyPem = PLUGIN_PUBLIC_KEY, now = Date.now()) {
|
|
331
331
|
try {
|
|
332
332
|
if (!publicKeyPem || typeof token !== "string") return null;
|
|
@@ -515,6 +515,8 @@ class Session {
|
|
|
515
515
|
complete(content) {
|
|
516
516
|
writeFileSync$1(this.paths.file, content);
|
|
517
517
|
writeFileSync$1(this.paths.canonicalPath, content);
|
|
518
|
+
this.pendingDirty = false;
|
|
519
|
+
this.pendingContent = content;
|
|
518
520
|
}
|
|
519
521
|
/** The parked Review-mode proposal, if one is pending (the file exists ⇔ undecided). */
|
|
520
522
|
pendingProposal() {
|
|
@@ -718,7 +720,7 @@ function track(event, enabled, props) {
|
|
|
718
720
|
});
|
|
719
721
|
}
|
|
720
722
|
const PLUGIN_HTTP = (process.env.INPLAN_PLUGIN_URL || "wss://inplan-collab.fly.dev").replace(/^ws/, "http");
|
|
721
|
-
const PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAVP11te5E7xzNJ4reKg0+mAnrr91gcyD1bMr43Homq98=\n-----END PUBLIC KEY
|
|
723
|
+
const PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAVP11te5E7xzNJ4reKg0+mAnrr91gcyD1bMr43Homq98=\n-----END PUBLIC KEY-----\n";
|
|
722
724
|
const SCHEME = "inplan-plugin";
|
|
723
725
|
const cacheDir = () => join$1(process.env.INPLAN_HOME || join$1(homedir$1(), ".inplan"), "plugin-cache");
|
|
724
726
|
let state = null;
|
|
@@ -1038,6 +1040,7 @@ async function refreshPluginAndView(file) {
|
|
|
1038
1040
|
else win.webContents.send("doc:navigated", session.load());
|
|
1039
1041
|
}
|
|
1040
1042
|
function quitNow(reason) {
|
|
1043
|
+
if (session?.hasUnsaved) session.complete(session.pending);
|
|
1041
1044
|
if (quitFallbackTimer) {
|
|
1042
1045
|
clearTimeout(quitFallbackTimer);
|
|
1043
1046
|
quitFallbackTimer = null;
|
|
@@ -1224,7 +1227,7 @@ ${body.replace(/\s*$/, "")}
|
|
|
1224
1227
|
}
|
|
1225
1228
|
});
|
|
1226
1229
|
ipcMain.handle("app:quit", (_e, content, opts) => {
|
|
1227
|
-
|
|
1230
|
+
session?.complete(content);
|
|
1228
1231
|
if (opts.startBuild && session) session.setSettings({ ...session.getSettings(), agentMode: "implementation" });
|
|
1229
1232
|
quitNow(opts.startBuild ? "completed" : "window_closed");
|
|
1230
1233
|
});
|
|
@@ -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) {
|
|
@@ -43468,9 +43468,7 @@ var EN = {
|
|
|
43468
43468
|
"topbar.finishTurn": "Finish turn",
|
|
43469
43469
|
"topbar.finishTurnTitle": "Finish turn — hand off to the agent",
|
|
43470
43470
|
"quit.title": "Do you want to quit?",
|
|
43471
|
-
"quit.save": "Save {file}",
|
|
43472
43471
|
"quit.startBuild": "Switch agent to build mode",
|
|
43473
|
-
"quit.thisDoc": "this document",
|
|
43474
43472
|
"quit.quit": "Quit",
|
|
43475
43473
|
"quit.cancel": "Cancel",
|
|
43476
43474
|
"topbar.noAgent": "Connect an agent (open this doc with a local or cloud agent) to use this",
|
|
@@ -43505,6 +43503,14 @@ var EN = {
|
|
|
43505
43503
|
"onboarding.doc.body": "With nothing selected, the menu reads “Comment on Doc” and posts a note about the whole plan. Try adding one.",
|
|
43506
43504
|
"onboarding.answer.title": "Answer the agent",
|
|
43507
43505
|
"onboarding.answer.body": "The agent asked a question in the comments. Pick an option and click Answer.",
|
|
43506
|
+
"onboarding.layout.title": "Arrange the panes",
|
|
43507
|
+
"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.",
|
|
43508
|
+
"onboarding.source.title": "Edit the Markdown source",
|
|
43509
|
+
"onboarding.source.body": "The source pane holds the raw Markdown. Type a change there and the preview updates live. Try editing a line.",
|
|
43510
|
+
"onboarding.movedoc.title": "Split off a new document",
|
|
43511
|
+
"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.)",
|
|
43512
|
+
"onboarding.finishturn.title": "Hand the turn back",
|
|
43513
|
+
"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
43514
|
"onboarding.finish.title": "You're all set 🎉",
|
|
43509
43515
|
"onboarding.finish.body": "That's the loop: comment, answer, and let the agent revise. Ready to open your plan?",
|
|
43510
43516
|
// pane tabs + splitter
|
|
@@ -43552,6 +43558,9 @@ var EN = {
|
|
|
43552
43558
|
"composer.placeholder": "Add a comment… ({mod}+Enter to submit)",
|
|
43553
43559
|
"composer.comment": "Comment",
|
|
43554
43560
|
"composer.cancel": "cancel",
|
|
43561
|
+
"composer.audience": "Comment audience",
|
|
43562
|
+
"composer.talkToAgent": "Talk to the agent",
|
|
43563
|
+
"composer.leaveMemo": "Leave a memo",
|
|
43555
43564
|
// agent connection indicator
|
|
43556
43565
|
"agent.connectCloud": "Connect a cloud agent",
|
|
43557
43566
|
"agent.waitLocal": "Wait for my local agent",
|
|
@@ -43568,6 +43577,8 @@ var EN = {
|
|
|
43568
43577
|
"agent.plan": "Plan {pct}%",
|
|
43569
43578
|
"agent.overIncluded": "— over included",
|
|
43570
43579
|
"agent.over": "(over)",
|
|
43580
|
+
"agent.nearLimit": "Approaching your usage limit",
|
|
43581
|
+
"agent.atLimit": "Usage limit reached — turns are paused until your plan resets or you upgrade",
|
|
43571
43582
|
"agent.connection": "Agent connection",
|
|
43572
43583
|
"agent.localCmdHint": "Paste this to your coding agent:",
|
|
43573
43584
|
"agent.localCmdBody": "Collaborate with me on my inplan plan. Check the CLI with `inplan --version` (if missing, install it: `npm i -g inplan`), sign in with `inplan login`, then run `{cmd}` and work with me through the comments.",
|
|
@@ -43614,9 +43625,14 @@ var EN = {
|
|
|
43614
43625
|
"banner.reviewNext": "Review next",
|
|
43615
43626
|
"banner.acceptAll": "Accept all",
|
|
43616
43627
|
"banner.rejectAll": "Reject all",
|
|
43628
|
+
"banner.allChanges": "accept or reject all changes",
|
|
43629
|
+
"banner.allAccepted": "All changes accepted — click to reject all",
|
|
43630
|
+
"banner.allRejected": "All changes rejected — click to accept all",
|
|
43631
|
+
"banner.allMixed": "Some changes accepted — click to accept all",
|
|
43617
43632
|
"banner.apply": "Apply",
|
|
43618
43633
|
"banner.laterLower": "later",
|
|
43619
43634
|
"banner.locked": "— locked while the agent works; finish handing back to act",
|
|
43635
|
+
"banner.readOnly": "This document is archived — view and download only. Reactivate it to edit.",
|
|
43620
43636
|
// find / replace bar
|
|
43621
43637
|
"find.toggleReplace": "toggle replace",
|
|
43622
43638
|
"find.replace": "Replace",
|
|
@@ -43807,6 +43823,57 @@ function resolveDocPath(basePath, href) {
|
|
|
43807
43823
|
}
|
|
43808
43824
|
var ua = typeof navigator !== "undefined" && (navigator.userAgent || navigator.platform) || "";
|
|
43809
43825
|
var MOD_KEY = /mac/i.test(ua) ? "⌘" : "Ctrl";
|
|
43826
|
+
function Glyph({ children }) {
|
|
43827
|
+
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 });
|
|
43828
|
+
}
|
|
43829
|
+
var IconBack = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "15 18 9 12 15 6" }) });
|
|
43830
|
+
var IconForward = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "9 18 15 12 9 6" }) });
|
|
43831
|
+
var IconUp = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "18 15 12 9 6 15" }) });
|
|
43832
|
+
var IconDown = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "6 9 12 15 18 9" }) });
|
|
43833
|
+
var IconZoomOut = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
|
|
43834
|
+
var IconZoomIn = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
43835
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
43836
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
43837
|
+
] });
|
|
43838
|
+
var IconFind = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
43839
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "11", cy: "11", r: "7" }),
|
|
43840
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
43841
|
+
] });
|
|
43842
|
+
var IconComment = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
43843
|
+
/* @__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" }),
|
|
43844
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "12", y1: "7", x2: "12", y2: "13" }),
|
|
43845
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "9", y1: "10", x2: "15", y2: "10" })
|
|
43846
|
+
] });
|
|
43847
|
+
var IconMemo = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
43848
|
+
/* @__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" }),
|
|
43849
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "14 3 14 9 20 9" }),
|
|
43850
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "8", y1: "13", x2: "16", y2: "13" }),
|
|
43851
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "8", y1: "17", x2: "13", y2: "17" })
|
|
43852
|
+
] });
|
|
43853
|
+
var IconSave = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
43854
|
+
/* @__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" }),
|
|
43855
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "17 21 17 13 7 13 7 21" }),
|
|
43856
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "7 3 7 8 15 8" })
|
|
43857
|
+
] });
|
|
43858
|
+
var IconFinishTurn = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
43859
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
|
|
43860
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
|
|
43861
|
+
] });
|
|
43862
|
+
var IconComplete = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "20 6 9 17 4 12" }) });
|
|
43863
|
+
var IconReopen = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
43864
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "3 3 3 9 9 9" }),
|
|
43865
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M3.5 13a8 8 0 1 0 2.2-7.4L3 9" })
|
|
43866
|
+
] });
|
|
43867
|
+
var IconRevealArchive = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
43868
|
+
/* @__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" }),
|
|
43869
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "12", cy: "7", r: "1.6" }),
|
|
43870
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("rect", { x: "5", y: "13", width: "14", height: "7", rx: "1" }),
|
|
43871
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "5", y1: "16", x2: "19", y2: "16" })
|
|
43872
|
+
] });
|
|
43873
|
+
var IconPencil = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
43874
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M12 20h9" }),
|
|
43875
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" })
|
|
43876
|
+
] });
|
|
43810
43877
|
function ComposerPopover({
|
|
43811
43878
|
target,
|
|
43812
43879
|
pos,
|
|
@@ -43816,6 +43883,7 @@ function ComposerPopover({
|
|
|
43816
43883
|
}) {
|
|
43817
43884
|
const t2 = useT();
|
|
43818
43885
|
const [text2, setText] = reactExports.useState("");
|
|
43886
|
+
const [talkToAgent, setTalkToAgent] = reactExports.useState(true);
|
|
43819
43887
|
const [p2, setP] = reactExports.useState(pos);
|
|
43820
43888
|
const box = reactExports.useRef(null);
|
|
43821
43889
|
const ta2 = reactExports.useRef(null);
|
|
@@ -43849,7 +43917,7 @@ function ComposerPopover({
|
|
|
43849
43917
|
el2.style.height = `${Math.min(el2.scrollHeight, 8 * 22)}px`;
|
|
43850
43918
|
};
|
|
43851
43919
|
const submit = () => {
|
|
43852
|
-
if (text2.trim()) onSubmit(text2.trim());
|
|
43920
|
+
if (text2.trim()) onSubmit(text2.trim(), talkToAgent);
|
|
43853
43921
|
};
|
|
43854
43922
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-composer ap-composer-float", ref: box, style: { left: p2.x, top: p2.y, right: "auto" }, children: [
|
|
43855
43923
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-composer-head", onMouseDown: (e) => drag.current = { dx: e.clientX - p2.x, dy: e.clientY - p2.y }, children: [
|
|
@@ -43877,6 +43945,36 @@ function ComposerPopover({
|
|
|
43877
43945
|
}
|
|
43878
43946
|
),
|
|
43879
43947
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-row", children: [
|
|
43948
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "ap-agent-toggle", role: "radiogroup", "aria-label": t2("composer.audience"), children: [
|
|
43949
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43950
|
+
"button",
|
|
43951
|
+
{
|
|
43952
|
+
type: "button",
|
|
43953
|
+
className: `ap-agent-opt${talkToAgent ? " active" : ""}`,
|
|
43954
|
+
role: "radio",
|
|
43955
|
+
"aria-checked": talkToAgent,
|
|
43956
|
+
title: t2("composer.talkToAgent"),
|
|
43957
|
+
"aria-label": t2("composer.talkToAgent"),
|
|
43958
|
+
disabled,
|
|
43959
|
+
onClick: () => setTalkToAgent(true),
|
|
43960
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconComment, {})
|
|
43961
|
+
}
|
|
43962
|
+
),
|
|
43963
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43964
|
+
"button",
|
|
43965
|
+
{
|
|
43966
|
+
type: "button",
|
|
43967
|
+
className: `ap-agent-opt${!talkToAgent ? " active" : ""}`,
|
|
43968
|
+
role: "radio",
|
|
43969
|
+
"aria-checked": !talkToAgent,
|
|
43970
|
+
title: t2("composer.leaveMemo"),
|
|
43971
|
+
"aria-label": t2("composer.leaveMemo"),
|
|
43972
|
+
disabled,
|
|
43973
|
+
onClick: () => setTalkToAgent(false),
|
|
43974
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconMemo, {})
|
|
43975
|
+
}
|
|
43976
|
+
)
|
|
43977
|
+
] }),
|
|
43880
43978
|
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: submit, disabled: disabled || !text2.trim(), children: t2("composer.comment") }),
|
|
43881
43979
|
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-link", onClick: onClose, children: t2("composer.cancel") })
|
|
43882
43980
|
] })
|
|
@@ -43888,9 +43986,11 @@ function Switch({
|
|
|
43888
43986
|
label,
|
|
43889
43987
|
disabled,
|
|
43890
43988
|
className,
|
|
43891
|
-
ariaLabel
|
|
43989
|
+
ariaLabel,
|
|
43990
|
+
intent
|
|
43892
43991
|
}) {
|
|
43893
|
-
|
|
43992
|
+
const accept = intent === "accept";
|
|
43993
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: `ap-switch${accept ? " ap-switch--accept" : ""}${disabled ? " disabled" : ""}${className ? ` ${className}` : ""}`, children: [
|
|
43894
43994
|
label != null && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-switch-label", children: label }),
|
|
43895
43995
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
43896
43996
|
"input",
|
|
@@ -43904,7 +44004,11 @@ function Switch({
|
|
|
43904
44004
|
onChange: (e) => onChange(e.target.checked)
|
|
43905
44005
|
}
|
|
43906
44006
|
),
|
|
43907
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
44007
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "ap-switch-track", "aria-hidden": "true", children: [
|
|
44008
|
+
accept && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-sw-yes", children: "✓" }),
|
|
44009
|
+
accept && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-sw-no", children: "✗" }),
|
|
44010
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-switch-thumb" })
|
|
44011
|
+
] })
|
|
43908
44012
|
] });
|
|
43909
44013
|
}
|
|
43910
44014
|
function ContextMenu({
|
|
@@ -44165,7 +44269,9 @@ var SourceEditor = reactExports.forwardRef(function SourceEditor2({ value, edita
|
|
|
44165
44269
|
return true;
|
|
44166
44270
|
}
|
|
44167
44271
|
}),
|
|
44168
|
-
// Plugin-injected binding extensions (e.g. remote cursors
|
|
44272
|
+
// Plugin-injected binding extensions (e.g. yCollab: live text sync, remote cursors, and —
|
|
44273
|
+
// wrapped at highest precedence by the binding via highestPrecKeymap — the collaborative
|
|
44274
|
+
// Yjs undo/redo keymap, so Mod-z beats basicSetup's native history).
|
|
44169
44275
|
...binding ? binding.extensions : []
|
|
44170
44276
|
]
|
|
44171
44277
|
})
|
|
@@ -44493,13 +44599,10 @@ function ProfileMenu({
|
|
|
44493
44599
|
}
|
|
44494
44600
|
function QuotaPie({ pct, color }) {
|
|
44495
44601
|
const deg = Math.round(Math.max(0, Math.min(1, pct)) * 360);
|
|
44496
|
-
return
|
|
44497
|
-
|
|
44498
|
-
|
|
44499
|
-
|
|
44500
|
-
style: { background: `conic-gradient(${color} ${deg}deg, var(--line) 0)` },
|
|
44501
|
-
"aria-hidden": "true"
|
|
44502
|
-
}
|
|
44602
|
+
return (
|
|
44603
|
+
// The conic ring carries usage (`color` fills `pct`, `var(--line)` the rest); the inner
|
|
44604
|
+
// core disc is the green "connected" indicator and stays green regardless of usage.
|
|
44605
|
+
/* @__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" }) })
|
|
44503
44606
|
);
|
|
44504
44607
|
}
|
|
44505
44608
|
function AgentIndicator({
|
|
@@ -44558,6 +44661,7 @@ function AgentIndicator({
|
|
|
44558
44661
|
}
|
|
44559
44662
|
const label = labelFor(location, model);
|
|
44560
44663
|
const quotaText = quota ? ` · ${Math.round(quota.usedPct * 100)}%${quota.overage ? ` ${t2("agent.over")}` : ""}` : "";
|
|
44664
|
+
const quotaWarn = quota && !quota.overage ? quota.usedPct >= 1 ? "at" : quota.usedPct >= 0.8 ? "near" : null : null;
|
|
44561
44665
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-agent", ref, children: [
|
|
44562
44666
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "ap-agent-btn", title: `${t2("agent.title", { label })}${quotaText}`, "aria-label": t2("agent.connectionLabel", { label }), "aria-expanded": open, onClick: () => setOpen((v2) => !v2), children: [
|
|
44563
44667
|
icon,
|
|
@@ -44566,7 +44670,8 @@ function AgentIndicator({
|
|
|
44566
44670
|
open && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-agent-menu", role: "menu", children: [
|
|
44567
44671
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-agent-detail", children: [
|
|
44568
44672
|
location ? `${t2("agent.detail", { where: location === "cloud" ? t2("agent.whereCloud") : t2("agent.whereLocal") })}${model ? ` · ${model}` : ""}` : t2("agent.none"),
|
|
44569
|
-
quota && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-agent-quota", children: `${t2("agent.plan", { pct: Math.round(quota.usedPct * 100) })}${quota.overage ? ` ${t2("agent.overIncluded")}` : ""}` })
|
|
44673
|
+
quota && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-agent-quota", children: `${t2("agent.plan", { pct: Math.round(quota.usedPct * 100) })}${quota.overage ? ` ${t2("agent.overIncluded")}` : ""}` }),
|
|
44674
|
+
quotaWarn && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `ap-agent-quota-warn ap-agent-quota-${quotaWarn}`, role: "status", children: t2(quotaWarn === "at" ? "agent.atLimit" : "agent.nearLimit") })
|
|
44570
44675
|
] }),
|
|
44571
44676
|
policy && onSetPolicy && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-agent-policy", role: "radiogroup", "aria-label": t2("agent.connection"), children: POLICY_OPTIONS.map((o) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
44572
44677
|
"button",
|
|
@@ -44592,51 +44697,6 @@ function AgentIndicator({
|
|
|
44592
44697
|
] })
|
|
44593
44698
|
] });
|
|
44594
44699
|
}
|
|
44595
|
-
function Glyph({ children }) {
|
|
44596
|
-
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 });
|
|
44597
|
-
}
|
|
44598
|
-
var IconBack = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "15 18 9 12 15 6" }) });
|
|
44599
|
-
var IconForward = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "9 18 15 12 9 6" }) });
|
|
44600
|
-
var IconUp = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "18 15 12 9 6 15" }) });
|
|
44601
|
-
var IconDown = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "6 9 12 15 18 9" }) });
|
|
44602
|
-
var IconZoomOut = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
|
|
44603
|
-
var IconZoomIn = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
44604
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
44605
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
44606
|
-
] });
|
|
44607
|
-
var IconFind = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
44608
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "11", cy: "11", r: "7" }),
|
|
44609
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
44610
|
-
] });
|
|
44611
|
-
var IconComment = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
44612
|
-
/* @__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" }),
|
|
44613
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "12", y1: "7", x2: "12", y2: "13" }),
|
|
44614
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "9", y1: "10", x2: "15", y2: "10" })
|
|
44615
|
-
] });
|
|
44616
|
-
var IconSave = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
44617
|
-
/* @__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" }),
|
|
44618
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "17 21 17 13 7 13 7 21" }),
|
|
44619
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "7 3 7 8 15 8" })
|
|
44620
|
-
] });
|
|
44621
|
-
var IconFinishTurn = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
44622
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
|
|
44623
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
|
|
44624
|
-
] });
|
|
44625
|
-
var IconComplete = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Glyph, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "20 6 9 17 4 12" }) });
|
|
44626
|
-
var IconReopen = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
44627
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "3 3 3 9 9 9" }),
|
|
44628
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M3.5 13a8 8 0 1 0 2.2-7.4L3 9" })
|
|
44629
|
-
] });
|
|
44630
|
-
var IconRevealArchive = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
44631
|
-
/* @__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" }),
|
|
44632
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "12", cy: "7", r: "1.6" }),
|
|
44633
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("rect", { x: "5", y: "13", width: "14", height: "7", rx: "1" }),
|
|
44634
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "5", y1: "16", x2: "19", y2: "16" })
|
|
44635
|
-
] });
|
|
44636
|
-
var IconPencil = () => /* @__PURE__ */ jsxRuntimeExports.jsxs(Glyph, { children: [
|
|
44637
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M12 20h9" }),
|
|
44638
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" })
|
|
44639
|
-
] });
|
|
44640
44700
|
function parseAuthor(author) {
|
|
44641
44701
|
const m2 = author.match(/^(.*?)\s*<([^>]+)>\s*$/);
|
|
44642
44702
|
const email = m2 ? m2[2].trim() : "";
|
|
@@ -44704,13 +44764,10 @@ function AuthorChip({ author }) {
|
|
|
44704
44764
|
] });
|
|
44705
44765
|
}
|
|
44706
44766
|
function QuitDialog({
|
|
44707
|
-
fileName,
|
|
44708
|
-
dirty,
|
|
44709
44767
|
onQuit,
|
|
44710
44768
|
onCancel
|
|
44711
44769
|
}) {
|
|
44712
44770
|
const t2 = useT();
|
|
44713
|
-
const [save, setSave] = reactExports.useState(true);
|
|
44714
44771
|
const [build, setBuild] = reactExports.useState(false);
|
|
44715
44772
|
const ref = reactExports.useRef(null);
|
|
44716
44773
|
reactExports.useEffect(() => ref.current?.querySelector(".ap-primary")?.focus(), []);
|
|
@@ -44723,19 +44780,13 @@ function QuitDialog({
|
|
|
44723
44780
|
}, [onCancel]);
|
|
44724
44781
|
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: [
|
|
44725
44782
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-quit-title", children: t2("quit.title") }),
|
|
44726
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
44727
|
-
|
|
44728
|
-
|
|
44729
|
-
|
|
44730
|
-
] }),
|
|
44731
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "ap-quit-opt", children: [
|
|
44732
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("input", { type: "checkbox", checked: build, onChange: (e) => setBuild(e.target.checked) }),
|
|
44733
|
-
t2("quit.startBuild")
|
|
44734
|
-
] })
|
|
44735
|
-
] }),
|
|
44783
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-quit-opts", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "ap-quit-opt", children: [
|
|
44784
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("input", { type: "checkbox", checked: build, onChange: (e) => setBuild(e.target.checked) }),
|
|
44785
|
+
t2("quit.startBuild")
|
|
44786
|
+
] }) }),
|
|
44736
44787
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-quit-actions", children: [
|
|
44737
44788
|
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-link", onClick: onCancel, children: t2("quit.cancel") }),
|
|
44738
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-primary", onClick: () => onQuit({
|
|
44789
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-primary", onClick: () => onQuit({ startBuild: build }), children: t2("quit.quit") })
|
|
44739
44790
|
] })
|
|
44740
44791
|
] }) });
|
|
44741
44792
|
}
|
|
@@ -44766,6 +44817,13 @@ var STEPS = [
|
|
|
44766
44817
|
{ id: "inline", target: '[data-onboard="preview"]', gate: (n2, b) => n2.inline > b.inline },
|
|
44767
44818
|
{ id: "doc", target: '[data-onboard="preview"]', gate: (n2, b) => n2.doc > b.doc },
|
|
44768
44819
|
{ id: "answer", target: '[data-onboard="comments"]', gate: (n2, b) => n2.answered > b.answered },
|
|
44820
|
+
{ id: "layout", target: '[data-onboard="panes"]', gate: (n2, b) => n2.panes !== b.panes },
|
|
44821
|
+
{ id: "source", target: '[data-onboard="source"]', gate: (n2, b) => n2.sourceEdits > b.sourceEdits },
|
|
44822
|
+
// The last two are informational (no gate): triggering them for real would navigate the tour
|
|
44823
|
+
// off the throwaway sample (Move to New Doc) or hand the turn to an agent that isn't there
|
|
44824
|
+
// (Finish turn), so we spotlight + explain them rather than force the action.
|
|
44825
|
+
{ id: "movedoc", target: '[data-onboard="preview"]', gate: null },
|
|
44826
|
+
{ id: "finishturn", target: '[data-onboard="finishturn"]', gate: null },
|
|
44769
44827
|
{ id: "finish", target: null, gate: null }
|
|
44770
44828
|
];
|
|
44771
44829
|
var SPOTLIGHT = "ap-coach-target";
|
|
@@ -44873,6 +44931,8 @@ Select any line above, then press the comment shortcut to leave a note on it.
|
|
|
44873
44931
|
function createMemoryApi(opts) {
|
|
44874
44932
|
const store = new MemoryDocumentStore(opts.content);
|
|
44875
44933
|
const channel = new MemoryControlChannel();
|
|
44934
|
+
let currentPath = "memory://doc";
|
|
44935
|
+
let currentReadOnly = opts.readOnly === true;
|
|
44876
44936
|
let settings = opts.settings ?? { autoResolve: true };
|
|
44877
44937
|
let closed = false;
|
|
44878
44938
|
const telemetryEvents = [];
|
|
@@ -44893,7 +44953,7 @@ function createMemoryApi(opts) {
|
|
|
44893
44953
|
const api = {
|
|
44894
44954
|
async load() {
|
|
44895
44955
|
if (await store.getCanonical() === null) await store.setCanonical(opts.content);
|
|
44896
|
-
return { path:
|
|
44956
|
+
return { path: currentPath, content: await store.loadDoc(), ...currentReadOnly ? { readOnly: true } : {} };
|
|
44897
44957
|
},
|
|
44898
44958
|
async save(content2, options) {
|
|
44899
44959
|
if (options.kind === "backup") {
|
|
@@ -44931,10 +44991,8 @@ function createMemoryApi(opts) {
|
|
|
44931
44991
|
showBackButton: opts.backButton ?? false,
|
|
44932
44992
|
// opt-in (web-like): expose the in-editor Back control
|
|
44933
44993
|
quit(content2, opts2) {
|
|
44934
|
-
|
|
44935
|
-
|
|
44936
|
-
void store.setCanonical(content2);
|
|
44937
|
-
}
|
|
44994
|
+
void store.saveDoc(content2);
|
|
44995
|
+
void store.setCanonical(content2);
|
|
44938
44996
|
void channel.append({ actor: "user", type: LogEventType.SessionClosed, payload: { reason: opts2.startBuild ? "completed" : "window_closed" } });
|
|
44939
44997
|
closed = true;
|
|
44940
44998
|
}
|
|
@@ -44987,10 +45045,12 @@ function createMemoryApi(opts) {
|
|
|
44987
45045
|
void channel.append({ actor: "agent", type: LogEventType.AgentMessage, payload: { text: text2 }, ts });
|
|
44988
45046
|
for (const cb2 of messages) cb2({ text: text2, ts });
|
|
44989
45047
|
},
|
|
44990
|
-
navigate(content2, path = "memory://doc2") {
|
|
45048
|
+
navigate(content2, path = "memory://doc2", readOnly2 = opts.readOnly === true) {
|
|
44991
45049
|
void store.saveDoc(content2);
|
|
44992
45050
|
void store.setCanonical(content2);
|
|
44993
|
-
|
|
45051
|
+
currentPath = path;
|
|
45052
|
+
currentReadOnly = readOnly2;
|
|
45053
|
+
for (const cb2 of navigated) cb2({ path, content: content2, ...readOnly2 ? { readOnly: true } : {} });
|
|
44994
45054
|
},
|
|
44995
45055
|
async log() {
|
|
44996
45056
|
return (await channel.readSince(0)).entries;
|
|
@@ -45155,22 +45215,47 @@ function CloudSignInOverlay({ url, onDismiss }) {
|
|
|
45155
45215
|
}, [onDismiss]);
|
|
45156
45216
|
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" }) }) });
|
|
45157
45217
|
}
|
|
45218
|
+
function readLayout() {
|
|
45219
|
+
try {
|
|
45220
|
+
const parsed = JSON.parse(localStorage.getItem("ap-layout") ?? "{}");
|
|
45221
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
45222
|
+
} catch {
|
|
45223
|
+
return {};
|
|
45224
|
+
}
|
|
45225
|
+
}
|
|
45158
45226
|
function App(props = {}) {
|
|
45159
45227
|
const t2 = useT();
|
|
45160
45228
|
const [loaded, setLoaded] = reactExports.useState(false);
|
|
45161
45229
|
const [doc2, setDoc] = reactExports.useState(EMPTY);
|
|
45162
|
-
const [
|
|
45230
|
+
const [readOnly2, setReadOnly] = reactExports.useState(false);
|
|
45163
45231
|
const modes = reactExports.useMemo(() => [TURN_MODE, ...hostApi().extraModes ?? []], []);
|
|
45232
|
+
const [cadence, setCadence] = reactExports.useState(() => {
|
|
45233
|
+
const c = readLayout().cadence;
|
|
45234
|
+
return typeof c === "string" && modes.some((m2) => m2.id === c) ? c : "turn";
|
|
45235
|
+
});
|
|
45164
45236
|
const mode = resolveMode(cadence, modes);
|
|
45165
45237
|
const [acceptance, setAcceptance] = reactExports.useState("review");
|
|
45166
45238
|
const [autoResolve, setAutoResolve] = reactExports.useState(false);
|
|
45167
45239
|
const [agentMode, setAgentMode] = reactExports.useState("planning");
|
|
45168
45240
|
const [telemetry, setTelemetry] = reactExports.useState(false);
|
|
45169
|
-
const [panes, setPanes] = reactExports.useState(
|
|
45170
|
-
|
|
45171
|
-
|
|
45172
|
-
|
|
45173
|
-
const [
|
|
45241
|
+
const [panes, setPanes] = reactExports.useState(() => {
|
|
45242
|
+
const p2 = readLayout().panes;
|
|
45243
|
+
return p2 === 1 || p2 === 2 || p2 === 3 ? p2 : 2;
|
|
45244
|
+
});
|
|
45245
|
+
const [onboardSourceEdits, setOnboardSourceEdits] = reactExports.useState(0);
|
|
45246
|
+
const [rightTab, setRightTab] = reactExports.useState(() => readLayout().rightTab === "source" ? "source" : "comments");
|
|
45247
|
+
const [srcW, setSrcW] = reactExports.useState(() => {
|
|
45248
|
+
const w2 = readLayout().srcW;
|
|
45249
|
+
return typeof w2 === "number" ? Math.min(900, Math.max(220, w2)) : 380;
|
|
45250
|
+
});
|
|
45251
|
+
const [cmtW, setCmtW] = reactExports.useState(() => {
|
|
45252
|
+
const w2 = readLayout().cmtW;
|
|
45253
|
+
return typeof w2 === "number" ? Math.min(900, Math.max(220, w2)) : 380;
|
|
45254
|
+
});
|
|
45255
|
+
const [zoom, setZoom] = reactExports.useState(() => {
|
|
45256
|
+
const z2 = readLayout().zoom;
|
|
45257
|
+
return typeof z2 === "number" ? Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, z2)) : 1;
|
|
45258
|
+
});
|
|
45174
45259
|
const [dirty, setDirty] = reactExports.useState(false);
|
|
45175
45260
|
const [status, setStatus] = reactExports.useState("");
|
|
45176
45261
|
const [agentThinking, setAgentThinking] = reactExports.useState(false);
|
|
@@ -45186,7 +45271,7 @@ function App(props = {}) {
|
|
|
45186
45271
|
const userAuthorRef = reactExports.useRef(userAuthor);
|
|
45187
45272
|
userAuthorRef.current = userAuthor;
|
|
45188
45273
|
const [updating, setUpdating] = reactExports.useState("idle");
|
|
45189
|
-
const [showResolvedOrphaned, setShowResolvedOrphaned] = reactExports.useState(
|
|
45274
|
+
const [showResolvedOrphaned, setShowResolvedOrphaned] = reactExports.useState(() => readLayout().showResolvedOrphaned === true);
|
|
45190
45275
|
const [selectionText, setSelectionText] = reactExports.useState("");
|
|
45191
45276
|
const [composer, setComposer] = reactExports.useState(null);
|
|
45192
45277
|
const [newDocReq, setNewDocReq] = reactExports.useState(null);
|
|
@@ -45223,19 +45308,6 @@ function App(props = {}) {
|
|
|
45223
45308
|
const autoResolvedRef = reactExports.useRef(/* @__PURE__ */ new Set());
|
|
45224
45309
|
const saveNowRef = reactExports.useRef(() => {
|
|
45225
45310
|
});
|
|
45226
|
-
reactExports.useEffect(() => {
|
|
45227
|
-
try {
|
|
45228
|
-
const s = JSON.parse(localStorage.getItem("ap-layout") ?? "{}");
|
|
45229
|
-
if (s.panes === 1 || s.panes === 2 || s.panes === 3) setPanes(s.panes);
|
|
45230
|
-
if (s.rightTab === "comments" || s.rightTab === "source") setRightTab(s.rightTab);
|
|
45231
|
-
if (typeof s.zoom === "number") setZoom(Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, s.zoom)));
|
|
45232
|
-
if (typeof s.showResolvedOrphaned === "boolean") setShowResolvedOrphaned(s.showResolvedOrphaned);
|
|
45233
|
-
if (typeof s.cadence === "string" && modes.some((m2) => m2.id === s.cadence)) setCadence(s.cadence);
|
|
45234
|
-
if (typeof s.srcW === "number") setSrcW(Math.min(900, Math.max(220, s.srcW)));
|
|
45235
|
-
if (typeof s.cmtW === "number") setCmtW(Math.min(900, Math.max(220, s.cmtW)));
|
|
45236
|
-
} catch {
|
|
45237
|
-
}
|
|
45238
|
-
}, []);
|
|
45239
45311
|
reactExports.useEffect(() => {
|
|
45240
45312
|
localStorage.setItem("ap-layout", JSON.stringify({ panes, rightTab, zoom, showResolvedOrphaned, cadence, srcW, cmtW }));
|
|
45241
45313
|
}, [panes, rightTab, zoom, showResolvedOrphaned, cadence, srcW, cmtW]);
|
|
@@ -45255,8 +45327,9 @@ function App(props = {}) {
|
|
|
45255
45327
|
setStatus(t2("msg.proposedReview"));
|
|
45256
45328
|
};
|
|
45257
45329
|
const commentStore = hostApi().commentStore ?? null;
|
|
45258
|
-
hostApi().load().then(({ content: content2, path }) => {
|
|
45330
|
+
hostApi().load().then(({ content: content2, path, readOnly: ro }) => {
|
|
45259
45331
|
docPathRef.current = path;
|
|
45332
|
+
setReadOnly(!!ro);
|
|
45260
45333
|
const parsed = parse(content2);
|
|
45261
45334
|
const d = commentStore ? { ...parsed, comments: commentStore.list() } : parsed;
|
|
45262
45335
|
setDoc(d);
|
|
@@ -45266,12 +45339,14 @@ function App(props = {}) {
|
|
|
45266
45339
|
}).catch(() => setLoaded(true));
|
|
45267
45340
|
const subs = [
|
|
45268
45341
|
hostApi().onExternalChange(({ content: content2 }) => {
|
|
45342
|
+
const prevDoc = docRef.current;
|
|
45269
45343
|
const parsed = parse(content2);
|
|
45270
45344
|
const next = commentStore ? { ...parsed, comments: commentStore.list() } : parsed;
|
|
45271
45345
|
setAgentThinking(false);
|
|
45272
45346
|
setDoc(next);
|
|
45273
45347
|
savedRef.current = serialize(next);
|
|
45274
45348
|
setDirty(false);
|
|
45349
|
+
syncExternalDoc(next, prevDoc.comments, prevDoc.body);
|
|
45275
45350
|
setStatus(t2("msg.agentUpdated"));
|
|
45276
45351
|
}),
|
|
45277
45352
|
// Review-mode body changes arrive parked, as a proposal to accept/reject.
|
|
@@ -45290,9 +45365,10 @@ function App(props = {}) {
|
|
|
45290
45365
|
hostApi().onAgentMessage?.((msg) => setAgentMessages((prev) => [...prev, msg])),
|
|
45291
45366
|
// Desktop only: the window followed a link to another doc — reset to it (a fresh
|
|
45292
45367
|
// load), clearing any in-flight proposal/turn state, then re-show a parked proposal.
|
|
45293
|
-
hostApi().onNavigated?.(({ content: content2, path }) => {
|
|
45368
|
+
hostApi().onNavigated?.(({ content: content2, path, readOnly: ro }) => {
|
|
45294
45369
|
if (docPathRef.current) historyByDoc.current.set(docPathRef.current, { undo: history2.current, redo: future.current });
|
|
45295
45370
|
docPathRef.current = path;
|
|
45371
|
+
setReadOnly(!!ro);
|
|
45296
45372
|
const parsed = parse(content2);
|
|
45297
45373
|
const d = commentStore ? { ...parsed, comments: commentStore.list() } : parsed;
|
|
45298
45374
|
setDoc(d);
|
|
@@ -45415,7 +45491,8 @@ function App(props = {}) {
|
|
|
45415
45491
|
document.addEventListener("keydown", onKey);
|
|
45416
45492
|
return () => document.removeEventListener("keydown", onKey);
|
|
45417
45493
|
}, [composer, findOpen, proposal, reviewOpen, undo2, redo2]);
|
|
45418
|
-
const
|
|
45494
|
+
const agentLocked = mode.locksEditor && agentThinking;
|
|
45495
|
+
const editingLocked = agentLocked || readOnly2;
|
|
45419
45496
|
const takeBackControl = reactExports.useCallback(() => {
|
|
45420
45497
|
setAgentThinking(false);
|
|
45421
45498
|
setStatus(t2("msg.tookBack"));
|
|
@@ -45602,29 +45679,31 @@ function App(props = {}) {
|
|
|
45602
45679
|
reactExports.useEffect(() => {
|
|
45603
45680
|
const real = realHostApi();
|
|
45604
45681
|
return real?.exit?.onRequest?.(() => {
|
|
45605
|
-
if (props.onboarding) real.exit?.quit("", {
|
|
45682
|
+
if (props.onboarding) real.exit?.quit("", { startBuild: false });
|
|
45606
45683
|
else setQuitOpen(true);
|
|
45607
45684
|
});
|
|
45608
45685
|
}, [props.onboarding]);
|
|
45609
45686
|
const addComment = reactExports.useCallback(
|
|
45610
|
-
(text2, target, span, question2) => {
|
|
45687
|
+
(text2, target, span, question2, talkToAgent = true) => {
|
|
45688
|
+
const agent = talkToAgent ? void 0 : false;
|
|
45689
|
+
const memoPayload = talkToAgent ? {} : { agent: false };
|
|
45611
45690
|
if (target) {
|
|
45612
45691
|
const blocker = spanCommentBlocker(docRef.current.body, target, span ?? void 0);
|
|
45613
45692
|
if (blocker) {
|
|
45614
45693
|
setStatus(blocker === "overlap" ? t2("topbar.cantOverlap") : t2("msg.cantAnchor"));
|
|
45615
45694
|
return;
|
|
45616
45695
|
}
|
|
45617
|
-
const res = addSpanComment(docRef.current, target, { text: text2, author: userAuthorRef.current, question: question2 }, span ?? void 0);
|
|
45696
|
+
const res = addSpanComment(docRef.current, target, { text: text2, author: userAuthorRef.current, question: question2, agent }, span ?? void 0);
|
|
45618
45697
|
if (!res) {
|
|
45619
45698
|
setStatus(t2("msg.cantAnchor"));
|
|
45620
45699
|
return;
|
|
45621
45700
|
}
|
|
45622
|
-
apply(res.doc, { type: "comment_created", payload: { id: res.id } });
|
|
45701
|
+
apply(res.doc, { type: "comment_created", payload: { id: res.id, ...memoPayload } });
|
|
45623
45702
|
hostApi().telemetry?.("comment_created", { kind: "span" });
|
|
45624
45703
|
setFocused(res.id);
|
|
45625
45704
|
} else {
|
|
45626
|
-
const res = addDocComment(docRef.current, { text: text2, author: userAuthorRef.current, question: question2 });
|
|
45627
|
-
apply(res.doc, { type: "comment_created", payload: { id: res.id, anchor: "doc" } });
|
|
45705
|
+
const res = addDocComment(docRef.current, { text: text2, author: userAuthorRef.current, question: question2, agent });
|
|
45706
|
+
apply(res.doc, { type: "comment_created", payload: { id: res.id, anchor: "doc", ...memoPayload } });
|
|
45628
45707
|
hostApi().telemetry?.("comment_created", { kind: "doc" });
|
|
45629
45708
|
setFocused(res.id);
|
|
45630
45709
|
}
|
|
@@ -45857,7 +45936,8 @@ function App(props = {}) {
|
|
|
45857
45936
|
(segs, accepted2) => {
|
|
45858
45937
|
if (!proposal || editingLocked) return;
|
|
45859
45938
|
const body = applySegments(segs, accepted2);
|
|
45860
|
-
const
|
|
45939
|
+
const prevDoc = docRef.current;
|
|
45940
|
+
const live = prevDoc.comments;
|
|
45861
45941
|
const have = new Set(live.map((c) => c.id));
|
|
45862
45942
|
const merged = [...live, ...proposal.next.comments.filter((c) => !have.has(c.id))];
|
|
45863
45943
|
const comments = merged.map((c) => !c.parentId && c.anchor !== "doc" && !body.includes(`](#${c.id})`) ? { ...c, anchor: "doc" } : c);
|
|
@@ -45869,12 +45949,16 @@ function App(props = {}) {
|
|
|
45869
45949
|
savedRef.current = serialized;
|
|
45870
45950
|
setDirty(false);
|
|
45871
45951
|
const acceptedCount = accepted2.filter(Boolean).length;
|
|
45872
|
-
|
|
45952
|
+
if (syncExternalDoc(finalDoc, prevDoc.comments, prevDoc.body)) {
|
|
45953
|
+
setCheckpoint(serialized);
|
|
45954
|
+
} else {
|
|
45955
|
+
void hostApi().save(serialized, { kind: "apply", cadence }).then(() => setCheckpoint(serialized));
|
|
45956
|
+
}
|
|
45873
45957
|
void hostApi().clearProposal();
|
|
45874
45958
|
void hostApi().logAction(acceptedCount === accepted2.length ? "revision_accepted_all" : acceptedCount === 0 ? "revision_rejected_all" : "revision_hunk_accepted", { accepted: acceptedCount, total: accepted2.length });
|
|
45875
45959
|
setStatus(`applied agent revision (${acceptedCount}/${accepted2.length} hunks)`);
|
|
45876
45960
|
},
|
|
45877
|
-
[proposal, cadence, editingLocked]
|
|
45961
|
+
[proposal, cadence, editingLocked, syncExternalDoc]
|
|
45878
45962
|
);
|
|
45879
45963
|
const reviewSegs = reactExports.useMemo(() => proposal ? lineSegments(proposal.baseBody, proposal.next.body) : [], [proposal]);
|
|
45880
45964
|
const changeCount = reactExports.useMemo(() => reviewSegs.filter(isChange).length, [reviewSegs]);
|
|
@@ -46044,9 +46128,11 @@ function App(props = {}) {
|
|
|
46044
46128
|
() => ({
|
|
46045
46129
|
inline: doc2.comments.filter(isSpanComment).length,
|
|
46046
46130
|
doc: doc2.comments.filter(isDocComment).length,
|
|
46047
|
-
answered: doc2.comments.filter((c) => c.selected !== void 0).length
|
|
46131
|
+
answered: doc2.comments.filter((c) => c.selected !== void 0).length,
|
|
46132
|
+
panes,
|
|
46133
|
+
sourceEdits: onboardSourceEdits
|
|
46048
46134
|
}),
|
|
46049
|
-
[doc2.comments]
|
|
46135
|
+
[doc2.comments, panes, onboardSourceEdits]
|
|
46050
46136
|
);
|
|
46051
46137
|
if (!loaded) return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-loading", children: t2("app.loading") });
|
|
46052
46138
|
const showSource = panes === 3 || panes === 2 && rightTab === "source";
|
|
@@ -46194,6 +46280,7 @@ function App(props = {}) {
|
|
|
46194
46280
|
),
|
|
46195
46281
|
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-link", onClick: () => setUpdate(null), children: t2("banner.later") })
|
|
46196
46282
|
] }) }),
|
|
46283
|
+
readOnly2 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-banner ap-banner--readonly", role: "status", children: t2("banner.readOnly") }),
|
|
46197
46284
|
proposal && !reviewOpen && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-banner", children: [
|
|
46198
46285
|
t2("banner.proposalPending"),
|
|
46199
46286
|
" ",
|
|
@@ -46212,8 +46299,7 @@ function App(props = {}) {
|
|
|
46212
46299
|
TriSwitch,
|
|
46213
46300
|
{
|
|
46214
46301
|
state: changeCount > 0 && accepted.slice(0, changeCount).every(Boolean) ? "accept" : changeCount > 0 && accepted.slice(0, changeCount).every((v2) => !v2) ? "reject" : "mixed",
|
|
46215
|
-
|
|
46216
|
-
onReject: () => setAllAccepted(false),
|
|
46302
|
+
onCycle: (v2) => setAllAccepted(v2),
|
|
46217
46303
|
disabled: editingLocked || !changeCount
|
|
46218
46304
|
}
|
|
46219
46305
|
),
|
|
@@ -46227,22 +46313,14 @@ function App(props = {}) {
|
|
|
46227
46313
|
target: composer.target,
|
|
46228
46314
|
pos: composer.pos,
|
|
46229
46315
|
disabled: editingLocked,
|
|
46230
|
-
onSubmit: (text2) => {
|
|
46231
|
-
addComment(text2, composer.target, composer.span);
|
|
46316
|
+
onSubmit: (text2, talkToAgent) => {
|
|
46317
|
+
addComment(text2, composer.target, composer.span, void 0, talkToAgent);
|
|
46232
46318
|
setComposer(null);
|
|
46233
46319
|
},
|
|
46234
46320
|
onClose: () => setComposer(null)
|
|
46235
46321
|
}
|
|
46236
46322
|
),
|
|
46237
|
-
quitOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46238
|
-
QuitDialog,
|
|
46239
|
-
{
|
|
46240
|
-
fileName: docPathRef.current ? docPathRef.current.split(/[\\/]/).pop() || null : null,
|
|
46241
|
-
dirty,
|
|
46242
|
-
onQuit: confirmQuit,
|
|
46243
|
-
onCancel: () => setQuitOpen(false)
|
|
46244
|
-
}
|
|
46245
|
-
),
|
|
46323
|
+
quitOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(QuitDialog, { onQuit: confirmQuit, onCancel: () => setQuitOpen(false) }),
|
|
46246
46324
|
newDocReq && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46247
46325
|
NewDocModal,
|
|
46248
46326
|
{
|
|
@@ -46256,7 +46334,17 @@ function App(props = {}) {
|
|
|
46256
46334
|
onCancel: () => setNewDocReq(null)
|
|
46257
46335
|
}
|
|
46258
46336
|
),
|
|
46259
|
-
props.onboarding && props.onFinishOnboarding && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46337
|
+
props.onboarding && props.onFinishOnboarding && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46338
|
+
Onboarding,
|
|
46339
|
+
{
|
|
46340
|
+
signals: onboardingSignals,
|
|
46341
|
+
onFinish: props.onFinishOnboarding,
|
|
46342
|
+
onActiveStep: (id2) => {
|
|
46343
|
+
setForceSettingsOpen(id2 === "settings");
|
|
46344
|
+
if (id2 === "source") setPanes(3);
|
|
46345
|
+
}
|
|
46346
|
+
}
|
|
46347
|
+
),
|
|
46260
46348
|
signInUrl && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46261
46349
|
CloudSignInOverlay,
|
|
46262
46350
|
{
|
|
@@ -46315,16 +46403,7 @@ function App(props = {}) {
|
|
|
46315
46403
|
}
|
|
46316
46404
|
),
|
|
46317
46405
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-main", style: { zoom }, children: [
|
|
46318
|
-
sidePanels.length > 0 && !activePanel && !closingPanel && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46319
|
-
"button",
|
|
46320
|
-
{
|
|
46321
|
-
className: "ap-sidepanel-bump",
|
|
46322
|
-
title: sidePanels[0].title,
|
|
46323
|
-
"aria-label": sidePanels[0].title,
|
|
46324
|
-
onClick: () => setOpenPanel(sidePanels[0].id),
|
|
46325
|
-
children: sidePanels[0].icon ?? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-iconbtn-fallback", children: sidePanels[0].title.slice(0, 1) })
|
|
46326
|
-
}
|
|
46327
|
-
),
|
|
46406
|
+
sidePanels.length > 0 && !activePanel && !closingPanel && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-sidepanel-bumps", children: sidePanels.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-sidepanel-bump", title: p2.title, "aria-label": p2.title, onClick: () => setOpenPanel(p2.id), children: p2.icon ?? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-iconbtn-fallback", children: p2.title.slice(0, 1) }) }, p2.id)) }),
|
|
46328
46407
|
(activePanel || closingPanel) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46329
46408
|
"aside",
|
|
46330
46409
|
{
|
|
@@ -46394,7 +46473,7 @@ function App(props = {}) {
|
|
|
46394
46473
|
),
|
|
46395
46474
|
showSource && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
46396
46475
|
/* @__PURE__ */ jsxRuntimeExports.jsx(VSplitter, { width: srcW, setWidth: setSrcW }),
|
|
46397
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "ap-pane", style: { width: srcW }, children: [
|
|
46476
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "ap-pane", style: { width: srcW }, "data-onboard": "source", children: [
|
|
46398
46477
|
panes === 2 && /* @__PURE__ */ jsxRuntimeExports.jsx(PaneTabs, { tab: rightTab, onTab: setRightTab }),
|
|
46399
46478
|
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(
|
|
46400
46479
|
SourceEditor,
|
|
@@ -46405,6 +46484,7 @@ function App(props = {}) {
|
|
|
46405
46484
|
editable: !editingLocked,
|
|
46406
46485
|
onChange: (body) => {
|
|
46407
46486
|
setDoc((d) => ({ ...d, body }));
|
|
46487
|
+
if (props.onboarding) setOnboardSourceEdits((n2) => n2 + 1);
|
|
46408
46488
|
if (!hostApi().binding?.setText) setDirty(serialize({ ...docRef.current, body }) !== savedRef.current);
|
|
46409
46489
|
},
|
|
46410
46490
|
onCursorLine: (line) => setActivePreviewLine(line),
|
|
@@ -46478,7 +46558,7 @@ function App(props = {}) {
|
|
|
46478
46558
|
dirty: dirty && serialize(doc2) !== checkpoint,
|
|
46479
46559
|
agentThinking,
|
|
46480
46560
|
messages: agentMessages,
|
|
46481
|
-
canTakeBack:
|
|
46561
|
+
canTakeBack: agentLocked,
|
|
46482
46562
|
onTakeBack: takeBackControl
|
|
46483
46563
|
}
|
|
46484
46564
|
)
|
|
@@ -46502,6 +46582,7 @@ function AppRoot() {
|
|
|
46502
46582
|
const real = window.api;
|
|
46503
46583
|
sample.i18n = real?.i18n;
|
|
46504
46584
|
sample.extraModes = real?.extraModes;
|
|
46585
|
+
sample.profile = realHostApi().profile;
|
|
46505
46586
|
setApiOverride(sample);
|
|
46506
46587
|
}, []);
|
|
46507
46588
|
reactExports.useEffect(() => {
|
|
@@ -46574,7 +46655,7 @@ function TopBar(props) {
|
|
|
46574
46655
|
const { cadence, acceptance, panes, onMode } = props;
|
|
46575
46656
|
const profile = useProfile();
|
|
46576
46657
|
const t2 = useT();
|
|
46577
|
-
const noAgent = profile?.presenceAware === true && profile.agentLocation == null;
|
|
46658
|
+
const noAgent = profile?.presenceAware === true && profile.agentAvailable !== true && profile.agentLocation == null;
|
|
46578
46659
|
const noAgentTitle = noAgent ? t2("topbar.noAgent") : void 0;
|
|
46579
46660
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("header", { className: "ap-topbar", children: [
|
|
46580
46661
|
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: [
|
|
@@ -46592,7 +46673,7 @@ function TopBar(props) {
|
|
|
46592
46673
|
},
|
|
46593
46674
|
m2.id
|
|
46594
46675
|
)) }),
|
|
46595
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-seg", role: "group", "aria-label": "panes", children: [1, 2, 3].map((n2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46676
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-seg", role: "group", "aria-label": "panes", "data-onboard": "panes", children: [1, 2, 3].map((n2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46596
46677
|
"button",
|
|
46597
46678
|
{
|
|
46598
46679
|
className: panes === n2 ? "active" : "",
|
|
@@ -46639,6 +46720,7 @@ function TopBar(props) {
|
|
|
46639
46720
|
"button",
|
|
46640
46721
|
{
|
|
46641
46722
|
className: "ap-iconbtn",
|
|
46723
|
+
"data-onboard": "finishturn",
|
|
46642
46724
|
onClick: props.onFinishTurn,
|
|
46643
46725
|
disabled: props.locked || noAgent,
|
|
46644
46726
|
title: noAgentTitle ?? t2("topbar.finishTurnTitle"),
|
|
@@ -46827,12 +46909,28 @@ function FindReplaceBar({
|
|
|
46827
46909
|
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-link", onClick: onClose, children: t2("find.close") })
|
|
46828
46910
|
] });
|
|
46829
46911
|
}
|
|
46830
|
-
function TriSwitch({ state,
|
|
46831
|
-
|
|
46832
|
-
|
|
46833
|
-
|
|
46834
|
-
|
|
46835
|
-
|
|
46912
|
+
function TriSwitch({ state, onCycle, disabled }) {
|
|
46913
|
+
const t2 = useT();
|
|
46914
|
+
const next = state !== "accept";
|
|
46915
|
+
const title = state === "accept" ? t2("banner.allAccepted") : state === "reject" ? t2("banner.allRejected") : t2("banner.allMixed");
|
|
46916
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46917
|
+
"button",
|
|
46918
|
+
{
|
|
46919
|
+
type: "button",
|
|
46920
|
+
className: `ap-tri ap-tri--${state}${disabled ? " disabled" : ""}`,
|
|
46921
|
+
role: "checkbox",
|
|
46922
|
+
"aria-checked": state === "mixed" ? "mixed" : state === "accept",
|
|
46923
|
+
"aria-label": t2("banner.allChanges"),
|
|
46924
|
+
title,
|
|
46925
|
+
disabled,
|
|
46926
|
+
onClick: () => onCycle(next),
|
|
46927
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "ap-switch-track", "aria-hidden": "true", children: [
|
|
46928
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-sw-yes", children: "✓" }),
|
|
46929
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-sw-no", children: "✗" }),
|
|
46930
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-switch-thumb" })
|
|
46931
|
+
] })
|
|
46932
|
+
}
|
|
46933
|
+
);
|
|
46836
46934
|
}
|
|
46837
46935
|
function HunkBar({ idx, on, onToggle, onEdit, editing }) {
|
|
46838
46936
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-hunk-bar", children: [
|
|
@@ -46843,7 +46941,7 @@ function HunkBar({ idx, on, onToggle, onEdit, editing }) {
|
|
|
46843
46941
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-spacer" }),
|
|
46844
46942
|
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, {}) }),
|
|
46845
46943
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-willbe", children: on ? "will be accepted" : "will be rejected" }),
|
|
46846
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Switch, { checked: on, onChange: (v2) => onToggle(idx, v2), ariaLabel: `accept change ${idx + 1}
|
|
46944
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Switch, { checked: on, onChange: (v2) => onToggle(idx, v2), ariaLabel: `accept change ${idx + 1}`, intent: "accept" })
|
|
46847
46945
|
] });
|
|
46848
46946
|
}
|
|
46849
46947
|
function DiffPreview({
|
|
@@ -109,6 +109,17 @@ body {
|
|
|
109
109
|
.ap-switch-input:checked ~ .ap-switch-track .ap-switch-thumb { transform: translateX(14px); }
|
|
110
110
|
.ap-switch-input:focus-visible ~ .ap-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
111
111
|
.ap-switch.disabled .ap-switch-track { cursor: default; }
|
|
112
|
+
/* Accept/reject variant (the per-hunk review switch + the tri-state all-control): on = green/✓
|
|
113
|
+
(accepted), off = red/✗ (rejected). The ✓/✗ glyphs sit on the track and show on the side
|
|
114
|
+
opposite the thumb (✓ left = accept side, ✗ right = reject side). */
|
|
115
|
+
.ap-switch--accept .ap-switch-input:not(:checked) ~ .ap-switch-track { background: var(--danger); }
|
|
116
|
+
.ap-sw-yes, .ap-sw-no { position: absolute; top: 0; height: 100%; display: flex; align-items: center; font-size: 10px; line-height: 1; color: #fbfaf6; pointer-events: none; transition: opacity 0.15s ease; }
|
|
117
|
+
.ap-sw-yes { left: 5px; }
|
|
118
|
+
.ap-sw-no { right: 5px; }
|
|
119
|
+
.ap-switch--accept .ap-sw-yes { opacity: 0; }
|
|
120
|
+
.ap-switch--accept .ap-sw-no { opacity: 1; }
|
|
121
|
+
.ap-switch--accept .ap-switch-input:checked ~ .ap-switch-track .ap-sw-yes { opacity: 1; }
|
|
122
|
+
.ap-switch--accept .ap-switch-input:checked ~ .ap-switch-track .ap-sw-no { opacity: 0; }
|
|
112
123
|
.ap-profile-edit { gap: 6px; padding: 8px 10px 4px; }
|
|
113
124
|
.ap-profile-input { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--bg); color: var(--fg); }
|
|
114
125
|
.ap-profile-input:focus { outline: none; border-color: var(--accent); }
|
|
@@ -123,13 +134,18 @@ body {
|
|
|
123
134
|
.ap-agent-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
|
|
124
135
|
.ap-agent-local { background: #2bb673; } /* agent on your machine */
|
|
125
136
|
.ap-agent-off { background: var(--danger); } /* no agent connected */
|
|
126
|
-
.ap-agent-pie { width:
|
|
137
|
+
.ap-agent-pie { position: relative; width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; }
|
|
138
|
+
/* Green "connected" core; only the thin outer band of .ap-agent-pie shows the usage conic. */
|
|
139
|
+
.ap-agent-pie-core { position: absolute; inset: 16%; border-radius: 50%; background: var(--accent); }
|
|
127
140
|
/* Anchor to the trigger's RIGHT edge (it sits on the right of the topbar) so the 220px menu opens
|
|
128
141
|
leftward and stays on-screen — left:0 made it overflow off the right of the viewport, clipping the
|
|
129
142
|
item labels. Mirrors .ap-profile-menu. */
|
|
130
143
|
.ap-agent-menu { position: absolute; top: 34px; right: 0; z-index: 40; width: 220px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 8px; }
|
|
131
144
|
.ap-agent-detail { font-size: 12px; padding: 2px 6px 6px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
|
|
132
145
|
.ap-agent-quota { font-size: 11px; color: var(--muted); margin-top: 2px; }
|
|
146
|
+
.ap-agent-quota-warn { font-size: 11px; margin-top: 4px; line-height: 1.35; }
|
|
147
|
+
.ap-agent-quota-near { color: #b7791f; }
|
|
148
|
+
.ap-agent-quota-at { color: #c0392b; font-weight: 600; }
|
|
133
149
|
.ap-agent-policy { display: flex; flex-direction: column; gap: 2px; }
|
|
134
150
|
.ap-agent-policy-opt { display: flex; align-items: center; gap: 7px; text-align: left; border: 0; background: none; padding: 5px 6px; font: inherit; font-size: 12px; cursor: pointer; border-radius: 6px; color: var(--muted); }
|
|
135
151
|
.ap-agent-policy-opt:hover { background: var(--accent-soft); }
|
|
@@ -177,12 +193,14 @@ body {
|
|
|
177
193
|
/* banner */
|
|
178
194
|
.ap-banner { background: var(--accent-soft); border-bottom: 1px solid var(--line); padding: 9px 14px; display: flex; gap: 10px; align-items: center; }
|
|
179
195
|
.ap-banner-reload { background: #f6ecdd; }
|
|
196
|
+
/* Archived/read-only doc notice — muted amber, no action (view + download only). */
|
|
197
|
+
.ap-banner--readonly { background: #f6ecdd; color: var(--amber); font-size: 13px; }
|
|
180
198
|
|
|
181
199
|
/* main layout */
|
|
182
200
|
.ap-main { flex: 1; display: flex; min-height: 0; position: relative; }
|
|
183
201
|
/* "Bump" handle on the preview's top-left that reveals a host side panel (e.g. the TOC). */
|
|
202
|
+
.ap-sidepanel-bumps { position: absolute; top: 12px; left: 0; z-index: 20; display: flex; flex-direction: column; gap: 8px; }
|
|
184
203
|
.ap-sidepanel-bump {
|
|
185
|
-
position: absolute; top: 12px; left: 0; z-index: 20;
|
|
186
204
|
display: inline-flex; align-items: center; justify-content: center;
|
|
187
205
|
width: 20px; height: 38px; padding: 0;
|
|
188
206
|
border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 9px 9px 0;
|
|
@@ -239,6 +257,16 @@ body {
|
|
|
239
257
|
.ap-muted { color: var(--muted); }
|
|
240
258
|
.ap-row { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
|
|
241
259
|
|
|
260
|
+
/* Composer audience switch: conversation (talk to the agent) ⇄ memo (the agent ignores it). A small
|
|
261
|
+
two-icon pill; the active side is filled with the accent, the other is muted. Margin-right pushes
|
|
262
|
+
the Comment/cancel buttons to the right. */
|
|
263
|
+
.ap-agent-toggle { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface, #fff); margin-right: auto; }
|
|
264
|
+
.ap-agent-opt { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 22px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--ink-faint, #a8a08c); cursor: pointer; transition: background 0.12s ease, color 0.12s ease; }
|
|
265
|
+
.ap-agent-opt svg { width: 14px; height: 14px; }
|
|
266
|
+
.ap-agent-opt:hover:not(:disabled):not(.active) { color: var(--accent); background: var(--accent-soft); }
|
|
267
|
+
.ap-agent-opt.active { background: var(--accent); color: #fbfaf6; }
|
|
268
|
+
.ap-agent-opt:disabled { opacity: 0.5; cursor: default; }
|
|
269
|
+
|
|
242
270
|
textarea, input[type="text"], input[type="email"], input[type="number"], select {
|
|
243
271
|
font: inherit; color: var(--fg); background: var(--bg);
|
|
244
272
|
border: 1px solid var(--line-strong); border-radius: 7px; padding: 7px 9px;
|
|
@@ -443,20 +471,23 @@ input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outlin
|
|
|
443
471
|
.ap-hunk-edit { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-strong); background: var(--bg); border-radius: 6px; padding: 2px; cursor: pointer; color: var(--muted); }
|
|
444
472
|
.ap-hunk-edit:hover, .ap-hunk-edit.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
|
|
445
473
|
.ap-hunk-edit svg { width: 13px; height: 13px; display: block; }
|
|
446
|
-
/* Tri-state accept/reject-all
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
.ap-tri-
|
|
450
|
-
.ap-tri-
|
|
451
|
-
.ap-tri-
|
|
452
|
-
.ap-tri-track {
|
|
453
|
-
.ap-tri-
|
|
454
|
-
.ap-tri--
|
|
455
|
-
.ap-tri--
|
|
456
|
-
.ap-tri--
|
|
457
|
-
.ap-tri--mixed
|
|
458
|
-
.ap-tri--
|
|
459
|
-
.ap-tri.
|
|
474
|
+
/* Tri-state accept/reject-all toggle — a single click-to-cycle control reusing the per-hunk
|
|
475
|
+
switch's track/thumb/glyphs (accept = thumb-right/green/✓, reject = thumb-left/red/✗,
|
|
476
|
+
mixed = centre/neutral with no glyph), so it matches the per-hunk switch exactly. */
|
|
477
|
+
.ap-tri { display: inline-flex; align-items: center; border: none; background: none; padding: 0; margin: 0; cursor: pointer; }
|
|
478
|
+
.ap-tri:disabled, .ap-tri.disabled { opacity: 0.5; cursor: default; }
|
|
479
|
+
.ap-tri:focus-visible .ap-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
480
|
+
.ap-tri--accept .ap-switch-track { background: var(--accent); }
|
|
481
|
+
.ap-tri--reject .ap-switch-track { background: var(--danger); }
|
|
482
|
+
.ap-tri--mixed .ap-switch-track { background: var(--line-strong); }
|
|
483
|
+
.ap-tri--accept .ap-switch-thumb { transform: translateX(14px); }
|
|
484
|
+
.ap-tri--reject .ap-switch-thumb { transform: translateX(0); }
|
|
485
|
+
.ap-tri--mixed .ap-switch-thumb { transform: translateX(7px); }
|
|
486
|
+
.ap-tri--accept .ap-sw-yes { opacity: 1; }
|
|
487
|
+
.ap-tri--accept .ap-sw-no { opacity: 0; }
|
|
488
|
+
.ap-tri--reject .ap-sw-yes { opacity: 0; }
|
|
489
|
+
.ap-tri--reject .ap-sw-no { opacity: 1; }
|
|
490
|
+
.ap-tri--mixed .ap-sw-yes, .ap-tri--mixed .ap-sw-no { opacity: 0; }
|
|
460
491
|
.ap-ihunk-del { background: #fbeae6; padding: 3px 12px; }
|
|
461
492
|
.ap-ihunk-del :where(p, h1, h2, h3, h4, li, blockquote) { text-decoration: line-through; }
|
|
462
493
|
.ap-ihunk-add { background: #e9f3ec; padding: 3px 12px; }
|
package/app/renderer/index.html
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
content="default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' inplan-plugin:; connect-src 'self' inplan-plugin: ws://127.0.0.1:* ws://localhost:*; frame-src https://inplan.ai http://127.0.0.1:* http://localhost:*"
|
|
12
12
|
/>
|
|
13
13
|
<title>inplan</title>
|
|
14
|
-
<script type="module" crossorigin src="./assets/index-
|
|
15
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
14
|
+
<script type="module" crossorigin src="./assets/index-C7Dv9pUL.js"></script>
|
|
15
|
+
<link rel="stylesheet" crossorigin href="./assets/index-DPBeZ4rp.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
18
18
|
<div id="root"></div>
|
package/bin/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
-
import { spawn as
|
|
4
|
+
import { spawn as spawn3 } from "child_process";
|
|
5
5
|
import { createHash as createHash4 } from "crypto";
|
|
6
6
|
import { createRequire } from "module";
|
|
7
7
|
import { appendFileSync as appendFileSync2, copyFileSync, existsSync as existsSync9, mkdirSync as mkdirSync8, readdirSync as readdirSync2, readFileSync as readFileSync9, realpathSync, renameSync, statSync as statSync2, writeFileSync as writeFileSync8 } from "fs";
|
|
@@ -9,7 +9,7 @@ import { homedir as homedir6 } from "os";
|
|
|
9
9
|
import { basename as basename3, dirname as dirname9, isAbsolute as isAbsolute2, join as join9, relative as relative4, resolve as resolve3 } from "path";
|
|
10
10
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
11
11
|
|
|
12
|
-
// ../core/dist/chunk-
|
|
12
|
+
// ../core/dist/chunk-2A42CIA7.js
|
|
13
13
|
function isReply(c) {
|
|
14
14
|
return c.parentId !== void 0;
|
|
15
15
|
}
|
|
@@ -663,8 +663,16 @@ var SupabaseControlChannel = class {
|
|
|
663
663
|
db;
|
|
664
664
|
docId;
|
|
665
665
|
consumerId;
|
|
666
|
-
async append(event) {
|
|
667
|
-
const { data, error } = await this.db.from("events").insert({
|
|
666
|
+
async append(event, opts) {
|
|
667
|
+
const { data, error } = await this.db.from("events").insert({
|
|
668
|
+
doc_id: this.docId,
|
|
669
|
+
actor: event.actor,
|
|
670
|
+
type: event.type,
|
|
671
|
+
payload: event.payload ?? null,
|
|
672
|
+
// Only set user_id when attributed — older deployments may not have the column, and an
|
|
673
|
+
// unattributed (agent-internal) event leaves it null.
|
|
674
|
+
...opts?.userId ? { user_id: opts.userId } : {}
|
|
675
|
+
}).select("seq, ts, actor, type, payload").single();
|
|
668
676
|
if (error) throw new Error(`append failed: ${error.message}`);
|
|
669
677
|
return rowToEntry(data);
|
|
670
678
|
}
|
|
@@ -745,10 +753,29 @@ var SupabaseDocumentStore = class {
|
|
|
745
753
|
async clearProposed() {
|
|
746
754
|
await this.writeColumns({ proposed: null });
|
|
747
755
|
}
|
|
748
|
-
async backup(content) {
|
|
749
|
-
const {
|
|
756
|
+
async backup(content, meta) {
|
|
757
|
+
const { data: latest } = await this.db.from("doc_versions").select("body").eq("doc_id", this.docId).order("created_at", { ascending: false }).order("id", { ascending: false }).limit(1).maybeSingle();
|
|
758
|
+
if (latest?.body === content) return;
|
|
759
|
+
const row = { doc_id: this.docId, body: content };
|
|
760
|
+
if (meta?.actor) row.actor = meta.actor;
|
|
761
|
+
if (meta?.kind) row.kind = meta.kind;
|
|
762
|
+
if (meta?.author) row.author = meta.author;
|
|
763
|
+
const { error } = await this.db.from("doc_versions").insert(row);
|
|
750
764
|
if (error) throw new Error(`backup failed: ${error.message}`);
|
|
751
765
|
}
|
|
766
|
+
/** Recent version checkpoints (newest first), metadata only — for a history list. */
|
|
767
|
+
async listVersions(limit = 50) {
|
|
768
|
+
const { data, error } = await this.db.from("doc_versions").select("id, created_at, actor, kind, author").eq("doc_id", this.docId).order("created_at", { ascending: false }).order("id", { ascending: false }).limit(limit);
|
|
769
|
+
if (error) throw new Error(`listVersions failed: ${error.message}`);
|
|
770
|
+
return data ?? [];
|
|
771
|
+
}
|
|
772
|
+
/** The body of one version (scoped to this doc), or null if it no longer exists. */
|
|
773
|
+
async getVersion(id) {
|
|
774
|
+
const { data, error } = await this.db.from("doc_versions").select("body").eq("id", id).eq("doc_id", this.docId).maybeSingle();
|
|
775
|
+
if (error) throw new Error(`getVersion failed: ${error.message}`);
|
|
776
|
+
const body = data?.body;
|
|
777
|
+
return typeof body === "string" ? body : null;
|
|
778
|
+
}
|
|
752
779
|
async readColumn(name) {
|
|
753
780
|
const { data, error } = await this.db.from("documents").select(name).eq("id", this.docId).maybeSingle();
|
|
754
781
|
if (error) throw new Error(`read ${name} failed: ${error.message}`);
|
|
@@ -832,6 +859,103 @@ async function remoteBackend(docId, consumerId = "cli-agent") {
|
|
|
832
859
|
};
|
|
833
860
|
}
|
|
834
861
|
|
|
862
|
+
// src/cliLogin.ts
|
|
863
|
+
import { createServer } from "http";
|
|
864
|
+
import { spawn } from "child_process";
|
|
865
|
+
import { randomBytes } from "crypto";
|
|
866
|
+
var DEFAULT_WEB_ORIGIN = process.env.INPLAN_WEB_URL || "https://inplan.ai";
|
|
867
|
+
var DEFAULT_TIMEOUT_MS = 3 * 6e4;
|
|
868
|
+
var MAX_BODY_BYTES = 64 * 1024;
|
|
869
|
+
function openInBrowser(url) {
|
|
870
|
+
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
871
|
+
const args = process.platform === "win32" ? ["/c", "start", "", url] : [url];
|
|
872
|
+
try {
|
|
873
|
+
const child = spawn(cmd, args, { detached: true, stdio: "ignore" });
|
|
874
|
+
child.on("error", () => {
|
|
875
|
+
});
|
|
876
|
+
child.unref();
|
|
877
|
+
} catch {
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
function isHandoff(v) {
|
|
881
|
+
if (typeof v !== "object" || v === null) return false;
|
|
882
|
+
const o = v;
|
|
883
|
+
return typeof o.state === "string" && typeof o.url === "string" && typeof o.anon === "string" && typeof o.refresh === "string" && (o.email === void 0 || typeof o.email === "string");
|
|
884
|
+
}
|
|
885
|
+
function browserLogin(opts = {}) {
|
|
886
|
+
const webOrigin = (opts.webOrigin ?? DEFAULT_WEB_ORIGIN).replace(/\/$/, "");
|
|
887
|
+
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
888
|
+
const open = opts.open ?? openInBrowser;
|
|
889
|
+
const state = randomBytes(16).toString("hex");
|
|
890
|
+
return new Promise((resolve4, reject) => {
|
|
891
|
+
let settled = false;
|
|
892
|
+
const finish = (fn) => {
|
|
893
|
+
if (settled) return;
|
|
894
|
+
settled = true;
|
|
895
|
+
clearTimeout(timer);
|
|
896
|
+
server.close();
|
|
897
|
+
fn();
|
|
898
|
+
};
|
|
899
|
+
const cors = (req, res) => {
|
|
900
|
+
res.setHeader("Access-Control-Allow-Origin", req.headers.origin || webOrigin);
|
|
901
|
+
res.setHeader("Vary", "Origin");
|
|
902
|
+
res.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
|
903
|
+
res.setHeader("Access-Control-Allow-Headers", "content-type");
|
|
904
|
+
};
|
|
905
|
+
const server = createServer((req, res) => {
|
|
906
|
+
const url = req.url ?? "";
|
|
907
|
+
if (req.method === "OPTIONS" && url.startsWith("/cb")) {
|
|
908
|
+
cors(req, res);
|
|
909
|
+
res.writeHead(204).end();
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
if (req.method !== "POST" || !url.startsWith("/cb")) {
|
|
913
|
+
res.writeHead(404).end();
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
916
|
+
cors(req, res);
|
|
917
|
+
let body = "";
|
|
918
|
+
let tooBig = false;
|
|
919
|
+
req.on("data", (chunk) => {
|
|
920
|
+
body += chunk.toString("utf8");
|
|
921
|
+
if (body.length > MAX_BODY_BYTES) {
|
|
922
|
+
tooBig = true;
|
|
923
|
+
req.destroy();
|
|
924
|
+
}
|
|
925
|
+
});
|
|
926
|
+
req.on("end", () => {
|
|
927
|
+
if (tooBig) {
|
|
928
|
+
res.writeHead(413).end();
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
let parsed;
|
|
932
|
+
try {
|
|
933
|
+
parsed = JSON.parse(body);
|
|
934
|
+
} catch {
|
|
935
|
+
res.writeHead(400).end();
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
if (!isHandoff(parsed) || parsed.state !== state) {
|
|
939
|
+
res.writeHead(403).end();
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
res.writeHead(200, { "content-type": "text/plain" }).end("inplan: signed in \u2014 you can close this tab.");
|
|
943
|
+
const { url: projUrl, anon, refresh, email } = parsed;
|
|
944
|
+
finish(() => resolve4({ url: projUrl, anonKey: anon, refreshToken: refresh, ...email ? { email } : {} }));
|
|
945
|
+
});
|
|
946
|
+
});
|
|
947
|
+
server.on("error", (err) => finish(() => reject(err)));
|
|
948
|
+
const timer = setTimeout(() => finish(() => reject(new Error("login timed out \u2014 no response from the browser"))), timeoutMs);
|
|
949
|
+
if (typeof timer.unref === "function") timer.unref();
|
|
950
|
+
server.listen(0, "127.0.0.1", () => {
|
|
951
|
+
const { port } = server.address();
|
|
952
|
+
const target = `${webOrigin}/cli-auth?port=${port}&state=${state}`;
|
|
953
|
+
opts.onUrl?.(target);
|
|
954
|
+
open(target);
|
|
955
|
+
});
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
|
|
835
959
|
// src/cliProfile.ts
|
|
836
960
|
import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync7, writeFileSync as writeFileSync6 } from "fs";
|
|
837
961
|
import { homedir as homedir4 } from "os";
|
|
@@ -893,7 +1017,7 @@ async function resolveIdentity(file) {
|
|
|
893
1017
|
}
|
|
894
1018
|
|
|
895
1019
|
// src/update.ts
|
|
896
|
-
import { spawn } from "child_process";
|
|
1020
|
+
import { spawn as spawn2 } from "child_process";
|
|
897
1021
|
var UPDATE_PKG = process.env.INPLAN_PKG || "inplan";
|
|
898
1022
|
function compareVersions(a, b) {
|
|
899
1023
|
const parts = (v) => v.split("-")[0].split(".").map((n) => Number.parseInt(n, 10) || 0);
|
|
@@ -921,7 +1045,7 @@ async function checkForUpdate(opts) {
|
|
|
921
1045
|
}
|
|
922
1046
|
function selfUpdate(pkg) {
|
|
923
1047
|
return new Promise((resolve4) => {
|
|
924
|
-
const child =
|
|
1048
|
+
const child = spawn2("npm", ["install", "-g", `${pkg}@latest`], { stdio: ["ignore", "pipe", "pipe"] });
|
|
925
1049
|
let output2 = "";
|
|
926
1050
|
child.stdout?.on("data", (d) => output2 += d);
|
|
927
1051
|
child.stderr?.on("data", (d) => output2 += d);
|
|
@@ -1251,13 +1375,13 @@ function spawnApp(file) {
|
|
|
1251
1375
|
const env = { ...process.env, INPLAN_CLI: process.argv[1] ?? "" };
|
|
1252
1376
|
const override = process.env.INPLAN_APP_CMD;
|
|
1253
1377
|
if (override) {
|
|
1254
|
-
const child =
|
|
1378
|
+
const child = spawn3(override, [file], { detached: true, stdio: "ignore", shell: true, env });
|
|
1255
1379
|
child.unref();
|
|
1256
1380
|
return child.pid ?? null;
|
|
1257
1381
|
}
|
|
1258
1382
|
const bundled = resolveBundledApp();
|
|
1259
1383
|
if ("electron" in bundled) {
|
|
1260
|
-
const child =
|
|
1384
|
+
const child = spawn3(bundled.electron, [bundled.appMain, file], { detached: true, stdio: "ignore", env });
|
|
1261
1385
|
child.unref();
|
|
1262
1386
|
return child.pid ?? null;
|
|
1263
1387
|
}
|
|
@@ -1422,14 +1546,26 @@ async function doLogin(args) {
|
|
|
1422
1546
|
const url = getFlag(args, "url") ?? process.env.INPLAN_SUPABASE_URL;
|
|
1423
1547
|
const anonKey = getFlag(args, "anon") ?? process.env.INPLAN_SUPABASE_ANON_KEY;
|
|
1424
1548
|
const refreshToken = getFlag(args, "refresh") ?? process.env.INPLAN_REFRESH_TOKEN;
|
|
1425
|
-
if (!url || !anonKey || !refreshToken) {
|
|
1426
|
-
process.stderr.write("usage: inplan login --url <url> --anon <anon-key> --refresh <refresh-token> [--email <e>]\n");
|
|
1427
|
-
process.exit(64);
|
|
1428
|
-
}
|
|
1429
1549
|
const email = getFlag(args, "email");
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1550
|
+
if (url && anonKey && refreshToken) {
|
|
1551
|
+
saveAuth({ url, anonKey, refreshToken, ...email ? { email } : {} });
|
|
1552
|
+
await persistCloudIdentity();
|
|
1553
|
+
output({ status: "logged_in", url, ...email ? { email } : {} });
|
|
1554
|
+
return;
|
|
1555
|
+
}
|
|
1556
|
+
try {
|
|
1557
|
+
const auth = await browserLogin({ onUrl: (u) => process.stderr.write(`Opening your browser to sign in:
|
|
1558
|
+
${u}
|
|
1559
|
+
If it didn't open, paste that URL into your browser.
|
|
1560
|
+
`) });
|
|
1561
|
+
saveAuth(auth);
|
|
1562
|
+
await persistCloudIdentity();
|
|
1563
|
+
output({ status: "logged_in", url: auth.url, ...auth.email ? { email: auth.email } : {} });
|
|
1564
|
+
} catch (e) {
|
|
1565
|
+
process.stderr.write(`inplan login: ${e instanceof Error ? e.message : String(e)}
|
|
1566
|
+
`);
|
|
1567
|
+
process.exit(1);
|
|
1568
|
+
}
|
|
1433
1569
|
}
|
|
1434
1570
|
async function persistCloudIdentity() {
|
|
1435
1571
|
try {
|
|
@@ -2064,7 +2200,7 @@ async function main() {
|
|
|
2064
2200
|
);
|
|
2065
2201
|
if (!cmd || !["open", "wait", "signal", "message", "relay", "status", "promote", "demote", "upload"].includes(cmd)) {
|
|
2066
2202
|
process.stderr.write(
|
|
2067
|
-
'usage: inplan <open|wait|signal> <file|--remote DOC_ID> [--model NAME] [--cursor N] [--confirmed-comment-deletion=a,b] [--done] [--reload]\n inplan message <file> "your message" (relay a note to the editor status bar)\n inplan relay [--hook <kind> | --text <s> [--activity]] (agent-hook \u2192 editor; resolves the active doc)\n inplan status <file>\n inplan upload <file> [--org <slug>] [--repo <name>] [--path <p>] (Collaborate on Cloud)\n inplan promote <file> --cloud-doc <docId> [--locator org/repo/path]\n inplan demote <file>\n inplan login --url <url> --anon <
|
|
2203
|
+
'usage: inplan <open|wait|signal> <file|--remote DOC_ID> [--model NAME] [--cursor N] [--confirmed-comment-deletion=a,b] [--done] [--reload]\n inplan message <file> "your message" (relay a note to the editor status bar)\n inplan relay [--hook <kind> | --text <s> [--activity]] (agent-hook \u2192 editor; resolves the active doc)\n inplan status <file>\n inplan upload <file> [--org <slug>] [--repo <name>] [--path <p>] (Collaborate on Cloud)\n inplan promote <file> --cloud-doc <docId> [--locator org/repo/path]\n inplan demote <file>\n inplan login (opens the browser to sign in; or --url <url> --anon <key> --refresh <token> for scripts)\n inplan whoami | logout\n'
|
|
2068
2204
|
);
|
|
2069
2205
|
process.exit(64);
|
|
2070
2206
|
}
|