inplan 0.3.0 → 0.3.3
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.cjs +121 -14
- package/app/renderer/assets/{index-Cv94hl_t.js → index-CKlJ2VBc.js} +366 -100
- package/app/renderer/assets/{index-Bo--UUib.css → index-DziuyBKZ.css} +5 -1
- package/app/renderer/index.html +2 -2
- package/bin/cli.js +456 -118
- package/package.json +1 -1
- package/skill/SKILL.md +12 -3
|
@@ -7060,6 +7060,29 @@ ${block2}` : `${body}
|
|
|
7060
7060
|
|
|
7061
7061
|
${block2}`;
|
|
7062
7062
|
}
|
|
7063
|
+
function orderComments(comments) {
|
|
7064
|
+
const cmp = (a, b) => a.date < b.date ? -1 : a.date > b.date ? 1 : a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
|
|
7065
|
+
const ids = new Set(comments.map((c) => c.id));
|
|
7066
|
+
const byParent = /* @__PURE__ */ new Map();
|
|
7067
|
+
for (const c of comments) {
|
|
7068
|
+
if (c.parentId === void 0) continue;
|
|
7069
|
+
const list2 = byParent.get(c.parentId) ?? [];
|
|
7070
|
+
list2.push(c);
|
|
7071
|
+
byParent.set(c.parentId, list2);
|
|
7072
|
+
}
|
|
7073
|
+
const out = [];
|
|
7074
|
+
const visited = /* @__PURE__ */ new Set();
|
|
7075
|
+
const emit = (c) => {
|
|
7076
|
+
if (visited.has(c.id)) return;
|
|
7077
|
+
visited.add(c.id);
|
|
7078
|
+
out.push(c);
|
|
7079
|
+
for (const kid of (byParent.get(c.id) ?? []).slice().sort(cmp)) emit(kid);
|
|
7080
|
+
};
|
|
7081
|
+
const roots = comments.filter((c) => c.parentId === void 0 || !ids.has(c.parentId)).sort(cmp);
|
|
7082
|
+
for (const r2 of roots) emit(r2);
|
|
7083
|
+
for (const c of comments.slice().sort(cmp)) emit(c);
|
|
7084
|
+
return out;
|
|
7085
|
+
}
|
|
7063
7086
|
var ParseError = class extends Error {
|
|
7064
7087
|
constructor(message) {
|
|
7065
7088
|
super(message);
|
|
@@ -11508,34 +11531,34 @@ function reFactory(opts) {
|
|
|
11508
11531
|
re2.src_ZPCc = [re2.src_Z, re2.src_P, re2.src_Cc].join("|");
|
|
11509
11532
|
re2.src_ZCc = [re2.src_Z, re2.src_Cc].join("|");
|
|
11510
11533
|
const text_separators = "[><|]";
|
|
11511
|
-
re2.src_pseudo_letter =
|
|
11534
|
+
re2.src_pseudo_letter = `(?:(?!${text_separators}|${re2.src_ZPCc})${re2.src_Any})`;
|
|
11512
11535
|
re2.src_ip4 = "(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";
|
|
11513
|
-
re2.src_auth =
|
|
11536
|
+
re2.src_auth = `(?:(?:(?!${re2.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`;
|
|
11514
11537
|
re2.src_port = "(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?";
|
|
11515
|
-
re2.src_host_terminator =
|
|
11516
|
-
re2.src_path =
|
|
11517
|
-
|
|
11518
|
-
re2.src_email_name = '[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]
|
|
11538
|
+
re2.src_host_terminator = `(?=$|${text_separators}|${re2.src_ZPCc})(?!${opts["---"] ? "-(?!--)|" : "-|"}_|:\\d|\\.-|\\.(?!$|${re2.src_ZPCc}))`;
|
|
11539
|
+
re2.src_path = `(?:[/?#](?:(?!${re2.src_ZCc}|${text_separators}|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!${re2.src_ZCc}|\\]).)*\\]|\\((?:(?!${re2.src_ZCc}|[)]).)*\\)|\\{(?:(?!${re2.src_ZCc}|[}]).)*\\}|\\"(?:(?!${re2.src_ZCc}|["]).)+\\"|\\'(?:(?!${re2.src_ZCc}|[']).)+\\'|\\'(?=${re2.src_pseudo_letter}|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!${re2.src_ZCc}|[.]|$)|` + (opts["---"] ? "\\-(?!--(?:[^-]|$))(?:-*)|" : "\\-+|") + // allow `,,,` in paths
|
|
11540
|
+
`,(?!${re2.src_ZCc}|$)|;(?!${re2.src_ZCc}|$)|\\!+(?!${re2.src_ZCc}|[!]|$)|\\?(?!${re2.src_ZCc}|[?]|$))+|\\/)?`;
|
|
11541
|
+
re2.src_email_name = '[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]{0,63}';
|
|
11519
11542
|
re2.src_xn = "xn--[a-z0-9\\-]{1,59}";
|
|
11520
11543
|
re2.src_domain_root = // Allow letters & digits (http://test1)
|
|
11521
|
-
"(?:" + re2.src_xn +
|
|
11522
|
-
re2.src_domain = "(?:" + re2.src_xn +
|
|
11523
|
-
re2.src_host =
|
|
11524
|
-
re2.tpl_host_fuzzy = "(?:" + re2.src_ip4 +
|
|
11525
|
-
re2.tpl_host_no_ip_fuzzy =
|
|
11544
|
+
"(?:" + re2.src_xn + `|${re2.src_pseudo_letter}{1,63})`;
|
|
11545
|
+
re2.src_domain = "(?:" + re2.src_xn + `|(?:${re2.src_pseudo_letter})|(?:${re2.src_pseudo_letter}(?:-|${re2.src_pseudo_letter}){0,61}${re2.src_pseudo_letter}))`;
|
|
11546
|
+
re2.src_host = `(?:(?:(?:(?:${re2.src_domain})\\.)*${re2.src_domain}))`;
|
|
11547
|
+
re2.tpl_host_fuzzy = "(?:" + re2.src_ip4 + `|(?:(?:(?:${re2.src_domain})\\.)+(?:%TLDS%)))`;
|
|
11548
|
+
re2.tpl_host_no_ip_fuzzy = `(?:(?:(?:${re2.src_domain})\\.)+(?:%TLDS%))`;
|
|
11526
11549
|
re2.src_host_strict = re2.src_host + re2.src_host_terminator;
|
|
11527
11550
|
re2.tpl_host_fuzzy_strict = re2.tpl_host_fuzzy + re2.src_host_terminator;
|
|
11528
11551
|
re2.src_host_port_strict = re2.src_host + re2.src_port + re2.src_host_terminator;
|
|
11529
11552
|
re2.tpl_host_port_fuzzy_strict = re2.tpl_host_fuzzy + re2.src_port + re2.src_host_terminator;
|
|
11530
11553
|
re2.tpl_host_port_no_ip_fuzzy_strict = re2.tpl_host_no_ip_fuzzy + re2.src_port + re2.src_host_terminator;
|
|
11531
|
-
re2.tpl_host_fuzzy_test =
|
|
11532
|
-
re2.tpl_email_fuzzy =
|
|
11554
|
+
re2.tpl_host_fuzzy_test = `localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:${re2.src_ZPCc}|>|$))`;
|
|
11555
|
+
re2.tpl_email_fuzzy = `(^|${text_separators}|"|\\(|${re2.src_ZCc})(${re2.src_email_name}@${re2.tpl_host_fuzzy_strict})`;
|
|
11533
11556
|
re2.tpl_link_fuzzy = // Fuzzy link can't be prepended with .:/\- and non punctuation.
|
|
11534
11557
|
// but can start with > (markdown blockquote)
|
|
11535
|
-
|
|
11558
|
+
`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${re2.src_ZPCc}))((?![$+<=>^\`||])${re2.tpl_host_port_fuzzy_strict}${re2.src_path})`;
|
|
11536
11559
|
re2.tpl_link_no_ip_fuzzy = // Fuzzy link can't be prepended with .:/\- and non punctuation.
|
|
11537
11560
|
// but can start with > (markdown blockquote)
|
|
11538
|
-
|
|
11561
|
+
`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${re2.src_ZPCc}))((?![$+<=>^\`||])${re2.tpl_host_port_no_ip_fuzzy_strict}${re2.src_path})`;
|
|
11539
11562
|
return re2;
|
|
11540
11563
|
}
|
|
11541
11564
|
function assign(obj) {
|
|
@@ -11584,7 +11607,7 @@ const defaultSchemas = {
|
|
|
11584
11607
|
const tail = text2.slice(pos);
|
|
11585
11608
|
if (!self2.re.http) {
|
|
11586
11609
|
self2.re.http = new RegExp(
|
|
11587
|
-
|
|
11610
|
+
`^\\/\\/${self2.re.src_auth}${self2.re.src_host_port_strict}${self2.re.src_path}`,
|
|
11588
11611
|
"i"
|
|
11589
11612
|
);
|
|
11590
11613
|
}
|
|
@@ -11603,7 +11626,7 @@ const defaultSchemas = {
|
|
|
11603
11626
|
self2.re.no_http = new RegExp(
|
|
11604
11627
|
"^" + self2.re.src_auth + // Don't allow single-level domains, because of false positives like '//test'
|
|
11605
11628
|
// with code comments
|
|
11606
|
-
|
|
11629
|
+
`(?:localhost|(?:(?:${self2.re.src_domain})\\.)+${self2.re.src_domain_root})` + self2.re.src_port + self2.re.src_host_terminator + self2.re.src_path,
|
|
11607
11630
|
"i"
|
|
11608
11631
|
);
|
|
11609
11632
|
}
|
|
@@ -11624,7 +11647,7 @@ const defaultSchemas = {
|
|
|
11624
11647
|
const tail = text2.slice(pos);
|
|
11625
11648
|
if (!self2.re.mailto) {
|
|
11626
11649
|
self2.re.mailto = new RegExp(
|
|
11627
|
-
|
|
11650
|
+
`^${self2.re.src_email_name}@${self2.re.src_host_strict}`,
|
|
11628
11651
|
"i"
|
|
11629
11652
|
);
|
|
11630
11653
|
}
|
|
@@ -11673,7 +11696,7 @@ function compile(self2) {
|
|
|
11673
11696
|
const aliases = [];
|
|
11674
11697
|
self2.__compiled__ = {};
|
|
11675
11698
|
function schemaError(name2, val) {
|
|
11676
|
-
throw new Error(
|
|
11699
|
+
throw new Error(`(LinkifyIt) Invalid schema "${name2}": ${val}`);
|
|
11677
11700
|
}
|
|
11678
11701
|
Object.keys(self2.__schemas__).forEach(function(name2) {
|
|
11679
11702
|
const val = self2.__schemas__[name2];
|
|
@@ -11716,11 +11739,11 @@ function compile(self2) {
|
|
|
11716
11739
|
const slist = Object.keys(self2.__compiled__).filter(function(name2) {
|
|
11717
11740
|
return name2.length > 0 && self2.__compiled__[name2];
|
|
11718
11741
|
}).map(escapeRE).join("|");
|
|
11719
|
-
self2.re.schema_test = RegExp(
|
|
11720
|
-
self2.re.schema_search = RegExp(
|
|
11721
|
-
self2.re.schema_at_start = RegExp(
|
|
11742
|
+
self2.re.schema_test = RegExp(`(^|(?!_)(?:[><|]|${re2.src_ZPCc}))(${slist})`, "i");
|
|
11743
|
+
self2.re.schema_search = RegExp(`(^|(?!_)(?:[><|]|${re2.src_ZPCc}))(${slist})`, "ig");
|
|
11744
|
+
self2.re.schema_at_start = RegExp(`^${self2.re.schema_search.source}`, "i");
|
|
11722
11745
|
self2.re.pretest = RegExp(
|
|
11723
|
-
|
|
11746
|
+
`(${self2.re.schema_test.source})|(${self2.re.host_fuzzy_test.source})|@`,
|
|
11724
11747
|
"i"
|
|
11725
11748
|
);
|
|
11726
11749
|
}
|
|
@@ -11914,10 +11937,10 @@ LinkifyIt.prototype.tlds = function tlds(list2, keepOld) {
|
|
|
11914
11937
|
};
|
|
11915
11938
|
LinkifyIt.prototype.normalize = function normalize2(match2) {
|
|
11916
11939
|
if (!match2.schema) {
|
|
11917
|
-
match2.url =
|
|
11940
|
+
match2.url = `http://${match2.url}`;
|
|
11918
11941
|
}
|
|
11919
11942
|
if (match2.schema === "mailto:" && !/^mailto:/i.test(match2.url)) {
|
|
11920
|
-
match2.url =
|
|
11943
|
+
match2.url = `mailto:${match2.url}`;
|
|
11921
11944
|
}
|
|
11922
11945
|
};
|
|
11923
11946
|
LinkifyIt.prototype.onCompile = function onCompile() {
|
|
@@ -25177,7 +25200,7 @@ class TabWidget extends WidgetType {
|
|
|
25177
25200
|
return false;
|
|
25178
25201
|
}
|
|
25179
25202
|
}
|
|
25180
|
-
const plugin = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
25203
|
+
const plugin$1 = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
25181
25204
|
constructor() {
|
|
25182
25205
|
this.height = 1e3;
|
|
25183
25206
|
this.attrs = { style: "padding-bottom: 1000px" };
|
|
@@ -25192,9 +25215,9 @@ const plugin = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
|
25192
25215
|
}
|
|
25193
25216
|
});
|
|
25194
25217
|
function scrollPastEnd() {
|
|
25195
|
-
return [plugin, contentAttributes.of((view) => {
|
|
25218
|
+
return [plugin$1, contentAttributes.of((view) => {
|
|
25196
25219
|
var _a2;
|
|
25197
|
-
return ((_a2 = view.plugin(plugin)) === null || _a2 === void 0 ? void 0 : _a2.attrs) || null;
|
|
25220
|
+
return ((_a2 = view.plugin(plugin$1)) === null || _a2 === void 0 ? void 0 : _a2.attrs) || null;
|
|
25198
25221
|
})];
|
|
25199
25222
|
}
|
|
25200
25223
|
function highlightActiveLine() {
|
|
@@ -43313,7 +43336,12 @@ function deleteComment(doc2, id2) {
|
|
|
43313
43336
|
}
|
|
43314
43337
|
return { body, comments: doc2.comments.filter((c) => !removed.has(c.id)) };
|
|
43315
43338
|
}
|
|
43316
|
-
function buildThreads(comments) {
|
|
43339
|
+
function buildThreads(comments, now = Date.now()) {
|
|
43340
|
+
const order = new Map(comments.map((c, i) => [c.id, i]));
|
|
43341
|
+
const at = (c) => {
|
|
43342
|
+
const t2 = Date.parse(c.date);
|
|
43343
|
+
return Number.isNaN(t2) ? Number.NEGATIVE_INFINITY : Math.min(t2, now);
|
|
43344
|
+
};
|
|
43317
43345
|
const byParent = /* @__PURE__ */ new Map();
|
|
43318
43346
|
for (const c of comments) {
|
|
43319
43347
|
if (c.parentId) {
|
|
@@ -43330,7 +43358,7 @@ function buildThreads(comments) {
|
|
|
43330
43358
|
out.push(c);
|
|
43331
43359
|
stack.push(...byParent.get(c.id) ?? []);
|
|
43332
43360
|
}
|
|
43333
|
-
return out.sort((a, b) => a.
|
|
43361
|
+
return out.sort((a, b) => at(a) - at(b) || (order.get(a.id) ?? 0) - (order.get(b.id) ?? 0));
|
|
43334
43362
|
};
|
|
43335
43363
|
return comments.filter((c) => c.parentId === void 0).map((root) => ({ root, replies: collect(root.id) }));
|
|
43336
43364
|
}
|
|
@@ -43510,6 +43538,7 @@ var EN = {
|
|
|
43510
43538
|
"topbar.noAgent": "Connect an agent (open this doc with a local or cloud agent) to use this",
|
|
43511
43539
|
// settings menu
|
|
43512
43540
|
"settings.title": "Settings",
|
|
43541
|
+
"msg.onboardingFinishTurn": "That hands the turn to your agent — there isn't one on this sample. Finish the tour and it works on your real plan.",
|
|
43513
43542
|
"settings.telemetry": "Share anonymous data",
|
|
43514
43543
|
"settings.telemetryHint": "Off by default. Sends only anonymous, aggregate usage events — never your documents.",
|
|
43515
43544
|
"settings.agentMode": "Agent mode",
|
|
@@ -43589,6 +43618,9 @@ var EN = {
|
|
|
43589
43618
|
// transient status messages
|
|
43590
43619
|
"msg.proposedReview": "agent proposed changes — review below",
|
|
43591
43620
|
"msg.agentUpdated": "agent updated the document",
|
|
43621
|
+
"msg.agentUpdatedUnsaved": "The agent updated the document — your unsaved edits are kept here. Save or reopen to see its version.",
|
|
43622
|
+
"msg.agentCommented": "The agent left a comment — it is in the rail. Your unsaved edits are untouched.",
|
|
43623
|
+
"msg.agentCommentedAndChanged": "The agent left a comment (now in the rail) and changed the body — your unsaved edits are kept, so its version is not shown.",
|
|
43592
43624
|
"msg.agentTook": "agent took its turn — your move",
|
|
43593
43625
|
"msg.nothingUndo": "nothing to undo",
|
|
43594
43626
|
"msg.undid": "undid last change",
|
|
@@ -43670,6 +43702,7 @@ var EN = {
|
|
|
43670
43702
|
"rail.reply": "Reply",
|
|
43671
43703
|
// banners
|
|
43672
43704
|
"banner.agentReady": "The agent thinks the plan is ready.",
|
|
43705
|
+
"banner.draftPending": "{model} may be writing the first draft. You can start editing anytime.",
|
|
43673
43706
|
"banner.dismiss": "dismiss",
|
|
43674
43707
|
"banner.newBuild": "🔄 A new build is ready —",
|
|
43675
43708
|
"banner.reloadingIn": "reloading in {n}s",
|
|
@@ -43736,6 +43769,9 @@ var EN = {
|
|
|
43736
43769
|
"thread.cancel": "Cancel",
|
|
43737
43770
|
"thread.save": "Save",
|
|
43738
43771
|
"thread.more": "More",
|
|
43772
|
+
"thread.copyDocLink": "Copy link to document",
|
|
43773
|
+
"msg.copyDocLinkDone": "Link copied to the clipboard.",
|
|
43774
|
+
"msg.copyDocLinkFailed": "Copying the link failed — nothing was placed on the clipboard.",
|
|
43739
43775
|
"thread.modify": "Modify",
|
|
43740
43776
|
"thread.delete": "Delete"
|
|
43741
43777
|
};
|
|
@@ -44936,7 +44972,9 @@ function RelativeTime({ iso, className }) {
|
|
|
44936
44972
|
}, []);
|
|
44937
44973
|
const d = dayjs(iso);
|
|
44938
44974
|
if (!d.isValid()) return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className, children: iso });
|
|
44939
|
-
|
|
44975
|
+
const now = dayjs();
|
|
44976
|
+
const shown = d.isAfter(now) ? now : d;
|
|
44977
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("time", { className, dateTime: iso, title: d.format("MMM D, YYYY, h:mm:ss A"), children: shown.fromNow() });
|
|
44940
44978
|
}
|
|
44941
44979
|
var TOKEN = /\*\*([\s\S]+?)\*\*|`([^`]+?)`/g;
|
|
44942
44980
|
function renderInline(text2) {
|
|
@@ -45499,6 +45537,16 @@ var STEPS = [
|
|
|
45499
45537
|
{ id: "finish", target: null, gate: null }
|
|
45500
45538
|
];
|
|
45501
45539
|
var SPOTLIGHT = "ap-coach-target";
|
|
45540
|
+
var BLINK = "ap-coach-blink";
|
|
45541
|
+
var BLINK_MS = 600;
|
|
45542
|
+
var ROOT = ".ap-app";
|
|
45543
|
+
var ALLOW = ".ap-coach-card, .ap-ctxmenu, .ap-composer, .ap-profile, .ap-banner, [role='dialog'], [role='alertdialog'], dialog, [aria-modal='true']";
|
|
45544
|
+
function distracts(nodes, stepTarget) {
|
|
45545
|
+
if (!nodes.some((n2) => n2.closest(ROOT))) return false;
|
|
45546
|
+
if (nodes.some((n2) => n2.closest(ALLOW))) return false;
|
|
45547
|
+
if (stepTarget && nodes.some((n2) => stepTarget.contains(n2))) return false;
|
|
45548
|
+
return true;
|
|
45549
|
+
}
|
|
45502
45550
|
function Onboarding({
|
|
45503
45551
|
signals,
|
|
45504
45552
|
onFinish,
|
|
@@ -45513,32 +45561,34 @@ function Onboarding({
|
|
|
45513
45561
|
const isLast = idx === STEPS.length - 1;
|
|
45514
45562
|
const done = step.gate ? step.gate(signals, base2) : true;
|
|
45515
45563
|
const cardRef = reactExports.useRef(null);
|
|
45564
|
+
const blinkTimer = reactExports.useRef(null);
|
|
45565
|
+
const blink = reactExports.useCallback(() => {
|
|
45566
|
+
const card = cardRef.current;
|
|
45567
|
+
if (!card) return;
|
|
45568
|
+
if (blinkTimer.current) clearTimeout(blinkTimer.current);
|
|
45569
|
+
card.classList.remove(BLINK);
|
|
45570
|
+
void card.offsetWidth;
|
|
45571
|
+
card.classList.add(BLINK);
|
|
45572
|
+
blinkTimer.current = setTimeout(() => card.classList.remove(BLINK), BLINK_MS);
|
|
45573
|
+
}, []);
|
|
45574
|
+
reactExports.useEffect(() => () => void (blinkTimer.current && clearTimeout(blinkTimer.current)), []);
|
|
45516
45575
|
reactExports.useEffect(() => setBase(signalsRef.current), [idx]);
|
|
45517
45576
|
reactExports.useEffect(() => {
|
|
45518
|
-
const
|
|
45519
|
-
|
|
45520
|
-
const
|
|
45521
|
-
|
|
45522
|
-
if (
|
|
45523
|
-
|
|
45524
|
-
if (target && target.contains(node)) return;
|
|
45525
|
-
e.preventDefault();
|
|
45526
|
-
e.stopPropagation();
|
|
45527
|
-
const card = cardRef.current;
|
|
45528
|
-
if (card) {
|
|
45529
|
-
card.classList.remove("ap-coach-blink");
|
|
45530
|
-
void card.offsetWidth;
|
|
45531
|
-
card.classList.add("ap-coach-blink");
|
|
45532
|
-
}
|
|
45577
|
+
const onClick = (e) => {
|
|
45578
|
+
const isEl = (n2) => !!n2 && typeof n2.closest === "function";
|
|
45579
|
+
const path = (typeof e.composedPath === "function" ? e.composedPath() : []).filter(isEl);
|
|
45580
|
+
const nodes = path.length > 0 ? path : [e.target].filter(isEl);
|
|
45581
|
+
if (!distracts(nodes, step.target ? document.querySelector(step.target) : null)) return;
|
|
45582
|
+
blink();
|
|
45533
45583
|
};
|
|
45534
|
-
document.addEventListener("click",
|
|
45535
|
-
return () => document.removeEventListener("click",
|
|
45584
|
+
document.addEventListener("click", onClick, true);
|
|
45585
|
+
return () => document.removeEventListener("click", onClick, true);
|
|
45536
45586
|
}, [step.target]);
|
|
45537
45587
|
reactExports.useEffect(() => {
|
|
45538
45588
|
const el2 = step.target ? document.querySelector(step.target) : null;
|
|
45539
45589
|
el2?.classList.add(SPOTLIGHT);
|
|
45540
45590
|
return () => el2?.classList.remove(SPOTLIGHT);
|
|
45541
|
-
}, [step.target]);
|
|
45591
|
+
}, [step.target, signals.panes]);
|
|
45542
45592
|
reactExports.useEffect(() => {
|
|
45543
45593
|
onActiveStep?.(step.id);
|
|
45544
45594
|
}, [step.id, onActiveStep]);
|
|
@@ -45616,7 +45666,8 @@ async function harnessHash(text2) {
|
|
|
45616
45666
|
function createMemoryApi(opts) {
|
|
45617
45667
|
const store = new MemoryDocumentStore(opts.content);
|
|
45618
45668
|
const channel = new MemoryControlChannel();
|
|
45619
|
-
let currentPath = "memory://doc";
|
|
45669
|
+
let currentPath = opts.path ?? "memory://doc";
|
|
45670
|
+
let currentShareLink = opts.shareLink;
|
|
45620
45671
|
let currentReadOnly = opts.readOnly === true;
|
|
45621
45672
|
let settings = opts.settings ?? { autoResolve: true };
|
|
45622
45673
|
let closed = false;
|
|
@@ -45638,7 +45689,7 @@ function createMemoryApi(opts) {
|
|
|
45638
45689
|
const api = {
|
|
45639
45690
|
async load() {
|
|
45640
45691
|
if (await store.getCanonical() === null) await store.setCanonical(opts.content);
|
|
45641
|
-
return { path: currentPath, content: await store.loadDoc(), ...currentReadOnly ? { readOnly: true } : {} };
|
|
45692
|
+
return { path: currentPath, content: await store.loadDoc(), ...currentReadOnly ? { readOnly: true } : {}, ...currentShareLink ? { shareLink: currentShareLink } : {} };
|
|
45642
45693
|
},
|
|
45643
45694
|
async save(content2, options) {
|
|
45644
45695
|
if (options.kind === "backup") {
|
|
@@ -45710,7 +45761,7 @@ function createMemoryApi(opts) {
|
|
|
45710
45761
|
void store.saveDoc(content2);
|
|
45711
45762
|
void store.setCanonical(content2);
|
|
45712
45763
|
void channel.append({ actor: "agent", type: LogEventType.DocumentEdited, payload: { bytes: content2.length } });
|
|
45713
|
-
for (const cb2 of external) cb2({ path:
|
|
45764
|
+
for (const cb2 of external) cb2({ path: currentPath, content: content2 });
|
|
45714
45765
|
},
|
|
45715
45766
|
proposeRevision(content2) {
|
|
45716
45767
|
return (async () => {
|
|
@@ -45737,12 +45788,13 @@ function createMemoryApi(opts) {
|
|
|
45737
45788
|
void channel.append({ actor: "agent", type: LogEventType.AgentMessage, payload: { text: text2 }, ts });
|
|
45738
45789
|
for (const cb2 of messages) cb2({ text: text2, ts });
|
|
45739
45790
|
},
|
|
45740
|
-
navigate(content2, path = "memory://doc2", readOnly2 = opts.readOnly === true) {
|
|
45791
|
+
navigate(content2, path = "memory://doc2", readOnly2 = opts.readOnly === true, shareLink) {
|
|
45741
45792
|
void store.saveDoc(content2);
|
|
45742
45793
|
void store.setCanonical(content2);
|
|
45743
45794
|
currentPath = path;
|
|
45744
45795
|
currentReadOnly = readOnly2;
|
|
45745
|
-
|
|
45796
|
+
currentShareLink = shareLink;
|
|
45797
|
+
for (const cb2 of navigated) cb2({ path, content: content2, ...readOnly2 ? { readOnly: true } : {}, ...currentShareLink ? { shareLink: currentShareLink } : {} });
|
|
45746
45798
|
},
|
|
45747
45799
|
async log() {
|
|
45748
45800
|
return (await channel.readSince(0)).entries;
|
|
@@ -45958,12 +46010,37 @@ var IMAGE_EXT_BY_MIME = {
|
|
|
45958
46010
|
"image/avif": "avif",
|
|
45959
46011
|
"image/svg+xml": "svg"
|
|
45960
46012
|
};
|
|
46013
|
+
var BINDING_READY_TIMEOUT_MS = 1e4;
|
|
46014
|
+
function settleWithin(ready, ms) {
|
|
46015
|
+
if (!ready) return Promise.resolve(false);
|
|
46016
|
+
let timer;
|
|
46017
|
+
return Promise.race([
|
|
46018
|
+
ready.then(
|
|
46019
|
+
() => true,
|
|
46020
|
+
() => false
|
|
46021
|
+
),
|
|
46022
|
+
new Promise((resolve) => {
|
|
46023
|
+
timer = setTimeout(() => resolve(false), ms);
|
|
46024
|
+
})
|
|
46025
|
+
]).finally(() => clearTimeout(timer));
|
|
46026
|
+
}
|
|
45961
46027
|
var ZOOM_MIN = 0.6;
|
|
45962
46028
|
var ZOOM_MAX = 1.8;
|
|
45963
46029
|
function anchoredText(body, id2) {
|
|
45964
46030
|
const m2 = new RegExp(`\\[([^\\]]*)\\]\\(#${id2}\\)`).exec(body);
|
|
45965
46031
|
return m2 ? m2[1] : null;
|
|
45966
46032
|
}
|
|
46033
|
+
var COMMENT_KEY_ORDER = ["id", "parentId", "anchor", "text", "author", "date", "resolved", "may_resolve", "question", "selected", "agent", "mentions"];
|
|
46034
|
+
function canonicalComment(c) {
|
|
46035
|
+
const rec = c;
|
|
46036
|
+
const out = {};
|
|
46037
|
+
for (const k2 of COMMENT_KEY_ORDER) if (rec[k2] !== void 0) out[k2] = rec[k2];
|
|
46038
|
+
for (const k2 of Object.keys(rec).sort()) if (!(k2 in out) && rec[k2] !== void 0) out[k2] = rec[k2];
|
|
46039
|
+
return out;
|
|
46040
|
+
}
|
|
46041
|
+
function sameComment(a, b) {
|
|
46042
|
+
return JSON.stringify(canonicalComment(a)) === JSON.stringify(canonicalComment(b));
|
|
46043
|
+
}
|
|
45967
46044
|
function anchorLine(body, id2) {
|
|
45968
46045
|
const idx = body.indexOf(`](#${id2})`);
|
|
45969
46046
|
if (idx < 0) return null;
|
|
@@ -46038,6 +46115,7 @@ function readLayout() {
|
|
|
46038
46115
|
function App(props = {}) {
|
|
46039
46116
|
const t2 = useT();
|
|
46040
46117
|
const [loaded, setLoaded] = reactExports.useState(false);
|
|
46118
|
+
const externalAdoptedRef = reactExports.useRef(0);
|
|
46041
46119
|
const [doc2, setDoc] = reactExports.useState(EMPTY);
|
|
46042
46120
|
const [readOnly2, setReadOnly] = reactExports.useState(false);
|
|
46043
46121
|
const modes = reactExports.useMemo(() => [TURN_MODE, ...hostApi().extraModes ?? []], []);
|
|
@@ -46069,9 +46147,16 @@ function App(props = {}) {
|
|
|
46069
46147
|
return typeof z2 === "number" ? Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, z2)) : 1;
|
|
46070
46148
|
});
|
|
46071
46149
|
const [dirty, setDirty] = reactExports.useState(false);
|
|
46150
|
+
const dirtyRef = reactExports.useRef(dirty);
|
|
46151
|
+
dirtyRef.current = dirty;
|
|
46072
46152
|
const [status, setStatus] = reactExports.useState("");
|
|
46073
46153
|
const [agentThinking, setAgentThinking] = reactExports.useState(false);
|
|
46074
46154
|
const [agentDone, setAgentDone] = reactExports.useState(false);
|
|
46155
|
+
const [draftPendingModel, setDraftPendingModel] = reactExports.useState(null);
|
|
46156
|
+
const bodyEmpty = doc2.body.trim() === "";
|
|
46157
|
+
reactExports.useEffect(() => {
|
|
46158
|
+
if (!bodyEmpty) setDraftPendingModel(null);
|
|
46159
|
+
}, [bodyEmpty]);
|
|
46075
46160
|
const [agentMessages, setAgentMessages] = reactExports.useState([]);
|
|
46076
46161
|
const [navState, setNavState] = reactExports.useState({ canBack: false, canForward: false });
|
|
46077
46162
|
const [reloadReady, setReloadReady] = reactExports.useState(false);
|
|
@@ -46131,12 +46216,14 @@ function App(props = {}) {
|
|
|
46131
46216
|
});
|
|
46132
46217
|
const commentRangeRef = reactExports.useRef(null);
|
|
46133
46218
|
const docPathRef = reactExports.useRef("");
|
|
46219
|
+
const docLinkRef = reactExports.useRef("");
|
|
46134
46220
|
const railRef = reactExports.useRef(null);
|
|
46135
46221
|
const editorRef = reactExports.useRef(null);
|
|
46136
46222
|
const [pendingFocusCommentId, setPendingFocusCommentId] = reactExports.useState(null);
|
|
46137
46223
|
const autosaveTimer = reactExports.useRef(null);
|
|
46138
46224
|
const history2 = reactExports.useRef([]);
|
|
46139
46225
|
const future = reactExports.useRef([]);
|
|
46226
|
+
const humanTouchedComments = reactExports.useRef(/* @__PURE__ */ new Set());
|
|
46140
46227
|
const historyByDoc = reactExports.useRef(/* @__PURE__ */ new Map());
|
|
46141
46228
|
const savedRef = reactExports.useRef("");
|
|
46142
46229
|
const [checkpoint, setCheckpoint] = reactExports.useState("");
|
|
@@ -46156,6 +46243,7 @@ function App(props = {}) {
|
|
|
46156
46243
|
});
|
|
46157
46244
|
}, []);
|
|
46158
46245
|
const showProposal = reactExports.useCallback((content2, id2, baseContent, pending, openPanel2 = true) => {
|
|
46246
|
+
setDraftPendingModel(null);
|
|
46159
46247
|
const next = parse(content2);
|
|
46160
46248
|
const baseBody = docRef.current.body;
|
|
46161
46249
|
const baseParsed = baseContent !== void 0 ? parse(baseContent).body : void 0;
|
|
@@ -46176,24 +46264,35 @@ function App(props = {}) {
|
|
|
46176
46264
|
reactExports.useEffect(() => {
|
|
46177
46265
|
const commentStore = hostApi().commentStore ?? null;
|
|
46178
46266
|
const loadGen = docGenRef.current;
|
|
46179
|
-
|
|
46180
|
-
|
|
46267
|
+
let cancelled = false;
|
|
46268
|
+
const adoptedAtStart = externalAdoptedRef.current;
|
|
46269
|
+
const bindingReady = settleWithin(hostApi().binding?.ready, BINDING_READY_TIMEOUT_MS);
|
|
46270
|
+
Promise.all([hostApi().load(), bindingReady]).then(([{ content: content2, path, readOnly: ro, focusCommentId, shareLink, draftPending }, synced]) => {
|
|
46271
|
+
if (cancelled || docGenRef.current !== loadGen) return;
|
|
46181
46272
|
docPathRef.current = path;
|
|
46273
|
+
humanTouchedComments.current = /* @__PURE__ */ new Set();
|
|
46274
|
+
docLinkRef.current = shareLink?.trim() ? shareLink : path;
|
|
46182
46275
|
setReadOnly(!!ro);
|
|
46183
46276
|
setPendingFocusCommentId(focusCommentId ?? null);
|
|
46184
|
-
|
|
46185
|
-
|
|
46186
|
-
|
|
46187
|
-
|
|
46188
|
-
|
|
46277
|
+
if (externalAdoptedRef.current === adoptedAtStart) {
|
|
46278
|
+
const binding = synced ? hostApi().binding : null;
|
|
46279
|
+
const parsed = binding ? commentStore ? { body: binding.getText(), comments: [] } : parse(binding.getText()) : parse(content2);
|
|
46280
|
+
const d = commentStore ? { ...parsed, comments: commentStore.list() } : parsed;
|
|
46281
|
+
setDoc(d);
|
|
46282
|
+
docRef.current = d;
|
|
46283
|
+
savedRef.current = serialize(d);
|
|
46284
|
+
}
|
|
46285
|
+
setDraftPendingModel(draftPending?.model ?? null);
|
|
46189
46286
|
setLoaded(true);
|
|
46190
46287
|
const gen = ++docGenRef.current;
|
|
46191
46288
|
void hostApi().getProposal().then((parked) => docGenRef.current === gen && parked != null && showProposal(parked.content, parked.id, parked.baseContent, parked.pending)).catch(() => {
|
|
46192
46289
|
});
|
|
46193
46290
|
}).catch(() => setLoaded(true));
|
|
46194
|
-
const processNavigated = ({ content: content2, path, readOnly: ro, focusCommentId }) => {
|
|
46195
|
-
if (docPathRef.current) historyByDoc.current.set(docPathRef.current, { undo: history2.current, redo: future.current });
|
|
46291
|
+
const processNavigated = ({ content: content2, path, readOnly: ro, focusCommentId, shareLink, draftPending }) => {
|
|
46292
|
+
if (docPathRef.current) historyByDoc.current.set(docPathRef.current, { undo: history2.current, redo: future.current, touched: humanTouchedComments.current });
|
|
46196
46293
|
docPathRef.current = path;
|
|
46294
|
+
docLinkRef.current = shareLink?.trim() ? shareLink : path;
|
|
46295
|
+
setLoaded(true);
|
|
46197
46296
|
setReadOnly(!!ro);
|
|
46198
46297
|
resetMentionRoster();
|
|
46199
46298
|
setPendingFocusCommentId(focusCommentId ?? null);
|
|
@@ -46207,27 +46306,120 @@ function App(props = {}) {
|
|
|
46207
46306
|
const restored = historyByDoc.current.get(path);
|
|
46208
46307
|
history2.current = restored?.undo ?? [];
|
|
46209
46308
|
future.current = restored?.redo ?? [];
|
|
46309
|
+
humanTouchedComments.current = restored?.touched ?? /* @__PURE__ */ new Set();
|
|
46210
46310
|
setProposal(null);
|
|
46211
46311
|
setReviewOpen(false);
|
|
46212
46312
|
setAgentThinking(false);
|
|
46213
46313
|
setAgentDone(false);
|
|
46214
46314
|
setAgentMessages([]);
|
|
46315
|
+
setDraftPendingModel(draftPending?.model ?? null);
|
|
46215
46316
|
setActivePreviewLine(null);
|
|
46216
46317
|
setStatus(`opened ${path.split("/").pop() ?? path}`);
|
|
46217
46318
|
void hostApi().getProposal().then((parked) => docGenRef.current === gen && parked != null && showProposal(parked.content, parked.id, parked.baseContent, parked.pending)).catch(() => {
|
|
46218
46319
|
});
|
|
46219
46320
|
};
|
|
46220
46321
|
processNavigatedRef.current = processNavigated;
|
|
46322
|
+
let warnedForeignChange = false;
|
|
46323
|
+
const settleExternal = (settled, removed = /* @__PURE__ */ new Set()) => {
|
|
46324
|
+
if (settled.length === 0 && removed.size === 0) return;
|
|
46325
|
+
for (const stack of [history2.current, future.current]) {
|
|
46326
|
+
for (let i = 0; i < stack.length; i++) {
|
|
46327
|
+
const snap = stack[i];
|
|
46328
|
+
const kept = snap.comments.filter((c) => !removed.has(c.id));
|
|
46329
|
+
const settledHere = settled.map((c) => !c.parentId && c.anchor !== "doc" && !snap.body.includes(`](#${c.id})`) ? { ...c, anchor: "doc" } : c);
|
|
46330
|
+
const replaced = kept.map((c) => {
|
|
46331
|
+
const inc = settledHere.find((x2) => x2.id === c.id);
|
|
46332
|
+
return inc && !sameComment(inc, c) ? inc : c;
|
|
46333
|
+
});
|
|
46334
|
+
const missing = settledHere.filter((x2) => !removed.has(x2.id) && !replaced.some((c) => c.id === x2.id));
|
|
46335
|
+
if (kept.length !== snap.comments.length || replaced.some((c, i2) => c !== kept[i2]) || missing.length > 0) {
|
|
46336
|
+
stack[i] = { ...snap, comments: orderComments([...replaced, ...missing]) };
|
|
46337
|
+
}
|
|
46338
|
+
}
|
|
46339
|
+
}
|
|
46340
|
+
};
|
|
46221
46341
|
const subs = [
|
|
46222
|
-
hostApi().onExternalChange(({ content: content2 }) => {
|
|
46342
|
+
hostApi().onExternalChange(({ content: content2, viaPlugin, path }) => {
|
|
46343
|
+
if (path !== void 0 && docPathRef.current !== "" && path !== docPathRef.current) {
|
|
46344
|
+
if (!warnedForeignChange) console.warn(`[inplan] ignored an external change for ${path}: this editor is on ${docPathRef.current}`);
|
|
46345
|
+
warnedForeignChange = true;
|
|
46346
|
+
return;
|
|
46347
|
+
}
|
|
46223
46348
|
const prevDoc = docRef.current;
|
|
46224
|
-
const
|
|
46225
|
-
|
|
46349
|
+
const binding = viaPlugin === true && hostApi().binding || null;
|
|
46350
|
+
let next;
|
|
46351
|
+
let incoming;
|
|
46352
|
+
if (binding) {
|
|
46353
|
+
try {
|
|
46354
|
+
next = commentStore ? { body: binding.getText(), comments: commentStore.list() } : parse(binding.getText());
|
|
46355
|
+
incoming = next;
|
|
46356
|
+
} catch {
|
|
46357
|
+
setAgentThinking(false);
|
|
46358
|
+
return;
|
|
46359
|
+
}
|
|
46360
|
+
} else {
|
|
46361
|
+
const parsed = parse(content2);
|
|
46362
|
+
incoming = parsed;
|
|
46363
|
+
next = commentStore ? { ...parsed, comments: commentStore.list() } : parsed;
|
|
46364
|
+
}
|
|
46226
46365
|
setAgentThinking(false);
|
|
46366
|
+
const storeList = commentStore ? commentStore.list() : null;
|
|
46367
|
+
const landingComments = storeList ?? incoming.comments;
|
|
46368
|
+
const base2 = history2.current[history2.current.length - 1]?.comments ?? future.current[future.current.length - 1]?.comments ?? prevDoc.comments;
|
|
46369
|
+
const baseById = new Map(base2.map((c) => [c.id, c]));
|
|
46370
|
+
const landingById = new Map(landingComments.map((c) => [c.id, c]));
|
|
46371
|
+
const settledDelta = landingComments.filter((c) => {
|
|
46372
|
+
if (humanTouchedComments.current.has(c.id)) return false;
|
|
46373
|
+
const b = baseById.get(c.id);
|
|
46374
|
+
return !b || !sameComment(b, c);
|
|
46375
|
+
});
|
|
46376
|
+
const settledRemovals = new Set(
|
|
46377
|
+
[...baseById.keys()].filter((id2) => !landingById.has(id2) && !humanTouchedComments.current.has(id2))
|
|
46378
|
+
// deleted out there
|
|
46379
|
+
);
|
|
46380
|
+
if (dirtyRef.current) {
|
|
46381
|
+
const mine = new Set(prevDoc.comments.map((c) => c.id));
|
|
46382
|
+
const revised = prevDoc.comments.map((c) => {
|
|
46383
|
+
const inc = incoming.comments.find((i) => i.id === c.id);
|
|
46384
|
+
if (!inc || humanTouchedComments.current.has(c.id)) return c;
|
|
46385
|
+
const asHere = !inc.parentId && inc.anchor !== "doc" && !prevDoc.body.includes(`](#${inc.id})`) ? { ...inc, anchor: "doc" } : inc;
|
|
46386
|
+
const b = baseById.get(c.id);
|
|
46387
|
+
if (b && sameComment(b, asHere)) return c;
|
|
46388
|
+
return asHere;
|
|
46389
|
+
});
|
|
46390
|
+
const takenRevisions = revised.filter((c, i) => c !== prevDoc.comments[i]);
|
|
46391
|
+
const arriving = incoming.comments.filter((c) => !mine.has(c.id) && !humanTouchedComments.current.has(c.id)).map((c) => !c.parentId && c.anchor !== "doc" && !prevDoc.body.includes(`](#${c.id})`) ? { ...c, anchor: "doc" } : c);
|
|
46392
|
+
const withComments = commentStore ? { ...prevDoc, comments: storeList } : { ...prevDoc, comments: orderComments([...revised, ...arriving]) };
|
|
46393
|
+
const settleList = [];
|
|
46394
|
+
for (const c of [...settledDelta, ...arriving, ...takenRevisions]) {
|
|
46395
|
+
if (!settleList.some((x2) => x2.id === c.id)) settleList.push(c);
|
|
46396
|
+
}
|
|
46397
|
+
settleExternal(commentStore ? settledDelta : settleList, settledRemovals);
|
|
46398
|
+
setDoc(withComments);
|
|
46399
|
+
docRef.current = withComments;
|
|
46400
|
+
externalAdoptedRef.current++;
|
|
46401
|
+
let bodyMoved = true;
|
|
46402
|
+
try {
|
|
46403
|
+
bodyMoved = savedRef.current !== "" ? incoming.body !== parse(savedRef.current).body : incoming.body.trim() !== "";
|
|
46404
|
+
} catch {
|
|
46405
|
+
}
|
|
46406
|
+
const gained = commentStore ? settledDelta.length : arriving.length + takenRevisions.length;
|
|
46407
|
+
setStatus(t2(gained > 0 ? bodyMoved ? "msg.agentCommentedAndChanged" : "msg.agentCommented" : "msg.agentUpdatedUnsaved"));
|
|
46408
|
+
return;
|
|
46409
|
+
}
|
|
46227
46410
|
setDoc(next);
|
|
46411
|
+
externalAdoptedRef.current++;
|
|
46412
|
+
settleExternal(settledDelta, settledRemovals);
|
|
46413
|
+
humanTouchedComments.current = new Set(
|
|
46414
|
+
[...humanTouchedComments.current].filter((id2) => {
|
|
46415
|
+
const inc = next.comments.find((c) => c.id === id2);
|
|
46416
|
+
const buf = prevDoc.comments.find((c) => c.id === id2);
|
|
46417
|
+
return !!inc && !!buf && sameComment(inc, buf);
|
|
46418
|
+
})
|
|
46419
|
+
);
|
|
46228
46420
|
savedRef.current = serialize(next);
|
|
46229
46421
|
setDirty(false);
|
|
46230
|
-
syncExternalDoc(next, prevDoc.comments, prevDoc.body);
|
|
46422
|
+
if (!binding) syncExternalDoc(next, prevDoc.comments, prevDoc.body);
|
|
46231
46423
|
docRef.current = next;
|
|
46232
46424
|
const open = proposalRef.current;
|
|
46233
46425
|
if (open?.raw !== void 0 && open.base !== void 0) {
|
|
@@ -46279,6 +46471,7 @@ function App(props = {}) {
|
|
|
46279
46471
|
const onSel = () => setSelectionText(window.getSelection()?.toString() ?? "");
|
|
46280
46472
|
document.addEventListener("selectionchange", onSel);
|
|
46281
46473
|
return () => {
|
|
46474
|
+
cancelled = true;
|
|
46282
46475
|
document.removeEventListener("selectionchange", onSel);
|
|
46283
46476
|
for (const dispose of subs) dispose?.();
|
|
46284
46477
|
};
|
|
@@ -46440,11 +46633,24 @@ function App(props = {}) {
|
|
|
46440
46633
|
const prevDoc = docRef.current;
|
|
46441
46634
|
const commentOnly = next.body === prevDoc.body;
|
|
46442
46635
|
const prevComments = prevDoc.comments;
|
|
46636
|
+
const auto = action?.payload?.auto === true;
|
|
46637
|
+
if (!auto) {
|
|
46638
|
+
for (const c of next.comments) {
|
|
46639
|
+
const before = prevComments.find((q2) => q2.id === c.id);
|
|
46640
|
+
if (!before || !sameComment(before, c)) humanTouchedComments.current.add(c.id);
|
|
46641
|
+
}
|
|
46642
|
+
for (const c of prevComments) {
|
|
46643
|
+
if (!next.comments.some((q2) => q2.id === c.id)) humanTouchedComments.current.add(c.id);
|
|
46644
|
+
}
|
|
46645
|
+
}
|
|
46443
46646
|
setDoc(next);
|
|
46444
46647
|
if (action) void hostApi().logAction(action.type, action.payload);
|
|
46445
46648
|
if (syncExternalDoc(next, prevComments, prevDoc.body)) {
|
|
46446
46649
|
setDirty(false);
|
|
46447
46650
|
} else if (commentOnly) {
|
|
46651
|
+
if (auto && dirtyRef.current) {
|
|
46652
|
+
return;
|
|
46653
|
+
}
|
|
46448
46654
|
const s = serialize(next);
|
|
46449
46655
|
savedRef.current = s;
|
|
46450
46656
|
setDirty(false);
|
|
@@ -46588,6 +46794,10 @@ function App(props = {}) {
|
|
|
46588
46794
|
return;
|
|
46589
46795
|
}
|
|
46590
46796
|
nudgedAnswersRef.current.clear();
|
|
46797
|
+
if (props.onboarding) {
|
|
46798
|
+
setStatus(t2("msg.onboardingFinishTurn"));
|
|
46799
|
+
return;
|
|
46800
|
+
}
|
|
46591
46801
|
const content2 = serialize(docRef.current);
|
|
46592
46802
|
void hostApi().save(content2, { kind: "canonical", cadence: "turn" }).then(() => setCheckpoint(content2));
|
|
46593
46803
|
savedRef.current = content2;
|
|
@@ -46595,7 +46805,7 @@ function App(props = {}) {
|
|
|
46595
46805
|
setAgentThinking(true);
|
|
46596
46806
|
hostApi().telemetry?.("turn_finished");
|
|
46597
46807
|
setStatus(t2("msg.turnFinished"));
|
|
46598
|
-
}, [setQuestionPending]);
|
|
46808
|
+
}, [setQuestionPending, props.onboarding, t2]);
|
|
46599
46809
|
const [quitOpen, setQuitOpen] = reactExports.useState(false);
|
|
46600
46810
|
const [capConfirm, setCapConfirm] = reactExports.useState(null);
|
|
46601
46811
|
const askEvictLru = reactExports.useCallback(
|
|
@@ -47152,7 +47362,11 @@ function App(props = {}) {
|
|
|
47152
47362
|
}),
|
|
47153
47363
|
[doc2.comments, panes, onboardSourceEdits]
|
|
47154
47364
|
);
|
|
47155
|
-
if (!loaded)
|
|
47365
|
+
if (!loaded)
|
|
47366
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-loading", role: "status", children: [
|
|
47367
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-spinner", "aria-hidden": "true" }),
|
|
47368
|
+
t2("app.loading")
|
|
47369
|
+
] });
|
|
47156
47370
|
const showSource = panes === 3 || panes === 2 && rightTab === "source";
|
|
47157
47371
|
const showComments = panes === 3 || panes === 2 && rightTab === "comments";
|
|
47158
47372
|
const focusedRootId = (() => {
|
|
@@ -47223,6 +47437,11 @@ function App(props = {}) {
|
|
|
47223
47437
|
onQuery: reportFind
|
|
47224
47438
|
}
|
|
47225
47439
|
),
|
|
47440
|
+
draftPendingModel !== null && bodyEmpty && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-banner", role: "status", children: [
|
|
47441
|
+
t2("banner.draftPending", { model: draftPendingModel }),
|
|
47442
|
+
" ",
|
|
47443
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-link", onClick: () => setDraftPendingModel(null), children: t2("banner.dismiss") })
|
|
47444
|
+
] }),
|
|
47226
47445
|
agentDone && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-banner", children: [
|
|
47227
47446
|
t2("banner.agentReady"),
|
|
47228
47447
|
" ",
|
|
@@ -47592,7 +47811,9 @@ function App(props = {}) {
|
|
|
47592
47811
|
onAnswerPending: (p2) => setQuestionPending(o.thread.root.id, p2),
|
|
47593
47812
|
onResolve: (r2) => apply(setResolved(docRef.current, o.thread.root.id, r2), { type: "comment_resolved", payload: { id: o.thread.root.id, resolved: r2 } }),
|
|
47594
47813
|
onEdit: (id2, text2) => apply(editCommentText(docRef.current, id2, text2), { type: "comment_modified", payload: { id: id2 } }),
|
|
47595
|
-
onDelete: (id2) => apply(deleteComment(docRef.current, id2), { type: "comment_deleted", payload: { id: id2 } })
|
|
47814
|
+
onDelete: (id2) => apply(deleteComment(docRef.current, id2), { type: "comment_deleted", payload: { id: id2 } }),
|
|
47815
|
+
docLink: () => docLinkRef.current,
|
|
47816
|
+
onCopyOutcome: (ok2) => setStatus(t2(ok2 ? "msg.copyDocLinkDone" : "msg.copyDocLinkFailed"))
|
|
47596
47817
|
}
|
|
47597
47818
|
)
|
|
47598
47819
|
] }, o.thread.root.id)),
|
|
@@ -48165,6 +48386,18 @@ function ThreadCard(props) {
|
|
|
48165
48386
|
}
|
|
48166
48387
|
),
|
|
48167
48388
|
menuOpenId === c.id && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-cmenu-pop", onClick: (e) => e.stopPropagation(), children: [
|
|
48389
|
+
props.docLink() !== "" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
48390
|
+
"button",
|
|
48391
|
+
{
|
|
48392
|
+
onClick: () => {
|
|
48393
|
+
const write = navigator.clipboard?.writeText?.(props.docLink());
|
|
48394
|
+
if (write) void write.then(() => props.onCopyOutcome(true), () => props.onCopyOutcome(false));
|
|
48395
|
+
else props.onCopyOutcome(false);
|
|
48396
|
+
setMenuOpenId(null);
|
|
48397
|
+
},
|
|
48398
|
+
children: t2("thread.copyDocLink")
|
|
48399
|
+
}
|
|
48400
|
+
),
|
|
48168
48401
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
48169
48402
|
"button",
|
|
48170
48403
|
{
|
|
@@ -48318,46 +48551,79 @@ function ThreadCard(props) {
|
|
|
48318
48551
|
}
|
|
48319
48552
|
);
|
|
48320
48553
|
}
|
|
48321
|
-
|
|
48322
|
-
const
|
|
48323
|
-
|
|
48324
|
-
let
|
|
48325
|
-
|
|
48326
|
-
|
|
48327
|
-
|
|
48328
|
-
|
|
48329
|
-
|
|
48330
|
-
|
|
48554
|
+
function createPluginActivator(deps) {
|
|
48555
|
+
const importing = /* @__PURE__ */ new Map();
|
|
48556
|
+
const importOnce = (url) => {
|
|
48557
|
+
let p2 = importing.get(url);
|
|
48558
|
+
if (!p2) {
|
|
48559
|
+
p2 = deps.importModule(url).catch((err) => {
|
|
48560
|
+
importing.delete(url);
|
|
48561
|
+
throw err;
|
|
48562
|
+
});
|
|
48563
|
+
importing.set(url, p2);
|
|
48331
48564
|
}
|
|
48332
|
-
|
|
48333
|
-
|
|
48334
|
-
|
|
48335
|
-
|
|
48565
|
+
return p2;
|
|
48566
|
+
};
|
|
48567
|
+
let current = null;
|
|
48568
|
+
let generation = 0;
|
|
48569
|
+
const disposeCurrent = () => {
|
|
48570
|
+
const ext = current;
|
|
48571
|
+
current = null;
|
|
48336
48572
|
try {
|
|
48337
|
-
|
|
48573
|
+
ext?.dispose();
|
|
48338
48574
|
} catch {
|
|
48339
48575
|
}
|
|
48340
|
-
|
|
48341
|
-
|
|
48342
|
-
|
|
48576
|
+
};
|
|
48577
|
+
const fallBack = () => {
|
|
48578
|
+
disposeCurrent();
|
|
48579
|
+
const base2 = deps.baseApi();
|
|
48580
|
+
if (base2) deps.install({ ...base2 });
|
|
48581
|
+
};
|
|
48582
|
+
return {
|
|
48583
|
+
dispose: disposeCurrent,
|
|
48584
|
+
async activate() {
|
|
48585
|
+
const mine = ++generation;
|
|
48586
|
+
try {
|
|
48587
|
+
const info = await deps.getInfo();
|
|
48588
|
+
const mod = info ? await importOnce(info.rendererUrl) : null;
|
|
48589
|
+
if (mine !== generation) return false;
|
|
48590
|
+
const base2 = deps.baseApi();
|
|
48591
|
+
const ext = info && base2 && mod ? (disposeCurrent(), mod.activate(info.session)) : null;
|
|
48592
|
+
if (!ext || !base2) {
|
|
48593
|
+
fallBack();
|
|
48594
|
+
return true;
|
|
48595
|
+
}
|
|
48596
|
+
current = ext;
|
|
48597
|
+
deps.install({ ...base2, binding: ext.binding, commentStore: ext.commentStore, extraModes: ext.extraModes, sidePanels: ext.sidePanels });
|
|
48598
|
+
return true;
|
|
48599
|
+
} catch (err) {
|
|
48600
|
+
deps.onError?.(err);
|
|
48601
|
+
if (mine !== generation) return false;
|
|
48602
|
+
fallBack();
|
|
48603
|
+
return true;
|
|
48604
|
+
}
|
|
48343
48605
|
}
|
|
48344
|
-
}
|
|
48345
|
-
console.error("[inplan] plugin unavailable; using the file-backed editor", err);
|
|
48346
|
-
currentExt = null;
|
|
48347
|
-
}
|
|
48606
|
+
};
|
|
48348
48607
|
}
|
|
48608
|
+
globalThis.__inplanCM = { state: cmState, view: cmView };
|
|
48609
|
+
const w = window;
|
|
48610
|
+
const plugin = createPluginActivator({
|
|
48611
|
+
getInfo: async () => w.__inplanPlugin ? await w.__inplanPlugin() : null,
|
|
48612
|
+
importModule: async (url) => await import(
|
|
48613
|
+
/* @vite-ignore */
|
|
48614
|
+
url
|
|
48615
|
+
),
|
|
48616
|
+
baseApi: () => w.api,
|
|
48617
|
+
install: setHostApi,
|
|
48618
|
+
onError: (err) => console.error("[inplan] plugin unavailable; using the file-backed editor", err)
|
|
48619
|
+
});
|
|
48349
48620
|
function Shell() {
|
|
48350
48621
|
const [epoch, setEpoch] = React.useState(0);
|
|
48351
48622
|
React.useEffect(() => {
|
|
48352
48623
|
const off = w.__inplanOnReactivate?.(() => {
|
|
48353
|
-
void
|
|
48624
|
+
void plugin.activate().then((settled) => settled && setEpoch((e) => e + 1));
|
|
48354
48625
|
});
|
|
48355
|
-
const onUnload = () =>
|
|
48356
|
-
try {
|
|
48357
|
-
currentExt?.dispose();
|
|
48358
|
-
} catch {
|
|
48359
|
-
}
|
|
48360
|
-
};
|
|
48626
|
+
const onUnload = () => plugin.dispose();
|
|
48361
48627
|
window.addEventListener("beforeunload", onUnload);
|
|
48362
48628
|
return () => {
|
|
48363
48629
|
off?.();
|
|
@@ -48367,7 +48633,7 @@ function Shell() {
|
|
|
48367
48633
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(AppRoot, {}, epoch);
|
|
48368
48634
|
}
|
|
48369
48635
|
async function bootstrap() {
|
|
48370
|
-
await
|
|
48636
|
+
await plugin.activate();
|
|
48371
48637
|
const root = document.getElementById("root");
|
|
48372
48638
|
if (root) {
|
|
48373
48639
|
createRoot(root).render(
|