inplan 0.3.11 → 0.3.13
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
CHANGED
|
@@ -1203,6 +1203,9 @@ function startCloudSignIn(cloudBase, timeoutMs = 5 * 6e4) {
|
|
|
1203
1203
|
});
|
|
1204
1204
|
});
|
|
1205
1205
|
}
|
|
1206
|
+
function aboutPanelOptions(inplanVersion, electronVersion) {
|
|
1207
|
+
return { applicationName: "inplan", applicationVersion: inplanVersion?.trim() || "dev", version: `Electron ${electronVersion}` };
|
|
1208
|
+
}
|
|
1206
1209
|
const __dirname$1 = node_path.dirname(node_url.fileURLToPath(require("url").pathToFileURL(__filename).href));
|
|
1207
1210
|
widenConnectAttemptBudget();
|
|
1208
1211
|
registerPluginScheme();
|
|
@@ -1214,7 +1217,7 @@ const pluginToken = () => runCli(["token"], void 0, 15e3).then((r) => {
|
|
|
1214
1217
|
}
|
|
1215
1218
|
});
|
|
1216
1219
|
electron.app.setName("inplan");
|
|
1217
|
-
electron.app.setAboutPanelOptions(
|
|
1220
|
+
electron.app.setAboutPanelOptions(aboutPanelOptions("0.3.13", process.versions.electron));
|
|
1218
1221
|
process.on("uncaughtException", (err) => {
|
|
1219
1222
|
process.stderr.write(`[inplan] uncaught exception: ${err instanceof Error ? err.stack ?? err.message : String(err)}
|
|
1220
1223
|
`);
|
|
@@ -47,7 +47,11 @@ body {
|
|
|
47
47
|
.ap-spinner { width: 28px; height: 28px; border: 3px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: ap-spin 0.8s linear infinite; }
|
|
48
48
|
.ap-spinner-sm { width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: ap-spin 0.8s linear infinite; flex-shrink: 0; }
|
|
49
49
|
@keyframes ap-spin { to { transform: rotate(360deg); } }
|
|
50
|
-
|
|
50
|
+
/* Restart: while the replacement launches (up to ~35s) the button must visibly be busy, not look clickable. */
|
|
51
|
+
.ap-restart { display: inline-flex; align-items: center; gap: 6px; }
|
|
52
|
+
.ap-restart:disabled { opacity: 0.6; cursor: progress; }
|
|
53
|
+
.ap-restart .ap-spinner-sm { border-color: color-mix(in srgb, currentColor 40%, transparent); border-top-color: currentColor; }
|
|
54
|
+
@media (prefers-reduced-motion: reduce) { .ap-spinner, .ap-spinner-sm { animation-duration: 2.4s; } }
|
|
51
55
|
|
|
52
56
|
/* top bar */
|
|
53
57
|
.ap-topbar { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
|
|
@@ -43635,6 +43635,9 @@ var EN = {
|
|
|
43635
43635
|
// transient status messages
|
|
43636
43636
|
"msg.proposedReview": "agent proposed changes — review below",
|
|
43637
43637
|
"msg.agentUpdated": "agent updated the document",
|
|
43638
|
+
"msg.agentDraftKeptBoth": "The agent wrote its draft while you were typing — it is below your text. Both are kept; nothing is saved yet.",
|
|
43639
|
+
"msg.agentDraftRevised": "The agent revised its draft below your text — the new version is shown. Nothing is saved yet.",
|
|
43640
|
+
"msg.agentUpdatedKept": "The agent updated the document — its version is shown, and your other unsaved edits are kept.",
|
|
43638
43641
|
"msg.agentUpdatedUnsaved": "The agent updated the document — your unsaved edits are kept here. Save or reopen to see its version.",
|
|
43639
43642
|
"msg.agentCommented": "The agent left a comment — it is in the rail. Your unsaved edits are untouched.",
|
|
43640
43643
|
"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.",
|
|
@@ -43646,6 +43649,9 @@ var EN = {
|
|
|
43646
43649
|
"msg.tookBack": "you took back control — the agent didn't hand it back",
|
|
43647
43650
|
"msg.autosaving": "auto-saving…",
|
|
43648
43651
|
"msg.autosaved": "autosaved (backup)",
|
|
43652
|
+
"msg.saved": "saved",
|
|
43653
|
+
"msg.checkpointSaved": "checkpoint saved",
|
|
43654
|
+
"msg.saveUnconfirmed": "Couldn't confirm your changes are saved — check your connection. inplan keeps retrying.",
|
|
43649
43655
|
"msg.turnFinished": "turn finished — waiting for agent",
|
|
43650
43656
|
"msg.unsavedAnswer": "You have an unsaved answer — click “Answer” to save it, or Send again to skip.",
|
|
43651
43657
|
"msg.cantAnchor": "Comments can't be anchored to this selection",
|
|
@@ -43729,6 +43735,7 @@ var EN = {
|
|
|
43729
43735
|
"banner.restartFailed": "Could not reopen inplan. This window is still open; try Restart again.",
|
|
43730
43736
|
"banner.restartToApply": "— restart inplan to apply.",
|
|
43731
43737
|
"banner.restart": "Restart",
|
|
43738
|
+
"banner.restarting": "Restarting…",
|
|
43732
43739
|
"banner.newVersion": "⬆️ A new version is available",
|
|
43733
43740
|
"banner.updateFailed": "Update failed — try again.",
|
|
43734
43741
|
"banner.updating": "Updating…",
|
|
@@ -43788,6 +43795,10 @@ var EN = {
|
|
|
43788
43795
|
"thread.save": "Save",
|
|
43789
43796
|
"thread.more": "More",
|
|
43790
43797
|
"thread.copyDocLink": "Copy link to document",
|
|
43798
|
+
"thread.copyCommentLink": "Copy link to this comment",
|
|
43799
|
+
"msg.commentLinkGone": "The comment this link points to no longer exists.",
|
|
43800
|
+
"msg.copyCommentLinkDone": "Comment link copied to the clipboard.",
|
|
43801
|
+
"msg.copyCommentLinkFailed": "Copying the comment link failed — nothing was placed on the clipboard.",
|
|
43791
43802
|
"msg.copyDocLinkDone": "Link copied to the clipboard.",
|
|
43792
43803
|
"msg.copyDocLinkFailed": "Copying the link failed — nothing was placed on the clipboard.",
|
|
43793
43804
|
"thread.modify": "Modify",
|
|
@@ -44903,7 +44914,12 @@ var SourceEditor = reactExports.forwardRef(function SourceEditor2({ value, edita
|
|
|
44903
44914
|
if (!v2 || bindingRef.current) return;
|
|
44904
44915
|
const current = v2.state.doc.toString();
|
|
44905
44916
|
if (value !== current) {
|
|
44906
|
-
|
|
44917
|
+
let from = 0;
|
|
44918
|
+
const max = Math.min(value.length, current.length);
|
|
44919
|
+
while (from < max && value.charCodeAt(from) === current.charCodeAt(from)) from++;
|
|
44920
|
+
let tail = 0;
|
|
44921
|
+
while (tail < max - from && value.charCodeAt(value.length - 1 - tail) === current.charCodeAt(current.length - 1 - tail)) tail++;
|
|
44922
|
+
v2.dispatch({ changes: { from, to: current.length - tail, insert: value.slice(from, value.length - tail) } });
|
|
44907
44923
|
}
|
|
44908
44924
|
}, [value]);
|
|
44909
44925
|
reactExports.useEffect(() => {
|
|
@@ -46029,6 +46045,7 @@ var IMAGE_EXT_BY_MIME = {
|
|
|
46029
46045
|
"image/svg+xml": "svg"
|
|
46030
46046
|
};
|
|
46031
46047
|
var BINDING_READY_TIMEOUT_MS = 1e4;
|
|
46048
|
+
var DURABLE_ACK_TIMEOUT_MS = 3e4;
|
|
46032
46049
|
function settleWithin(ready, ms) {
|
|
46033
46050
|
if (!ready) return Promise.resolve(false);
|
|
46034
46051
|
let timer;
|
|
@@ -46044,6 +46061,17 @@ function settleWithin(ready, ms) {
|
|
|
46044
46061
|
}
|
|
46045
46062
|
var ZOOM_MIN = 0.6;
|
|
46046
46063
|
var ZOOM_MAX = 1.8;
|
|
46064
|
+
function commentLinkFor(docLink, param, id2) {
|
|
46065
|
+
if (!param.trim() || !docLink) return "";
|
|
46066
|
+
try {
|
|
46067
|
+
const u2 = new URL(docLink);
|
|
46068
|
+
if (u2.protocol !== "https:" && u2.protocol !== "http:") return "";
|
|
46069
|
+
u2.searchParams.set(param, id2);
|
|
46070
|
+
return u2.toString();
|
|
46071
|
+
} catch {
|
|
46072
|
+
return "";
|
|
46073
|
+
}
|
|
46074
|
+
}
|
|
46047
46075
|
function anchoredText(body, id2) {
|
|
46048
46076
|
const m2 = new RegExp(`\\[([^\\]]*)\\]\\(#${id2}\\)`).exec(body);
|
|
46049
46077
|
return m2 ? m2[1] : null;
|
|
@@ -46229,6 +46257,7 @@ function App(props = {}) {
|
|
|
46229
46257
|
const commentRangeRef = reactExports.useRef(null);
|
|
46230
46258
|
const docPathRef = reactExports.useRef("");
|
|
46231
46259
|
const docLinkRef = reactExports.useRef("");
|
|
46260
|
+
const commentLinkParamRef = reactExports.useRef("");
|
|
46232
46261
|
const railRef = reactExports.useRef(null);
|
|
46233
46262
|
const overlayComments = panes === 1 && commentOverlay;
|
|
46234
46263
|
reactExports.useEffect(() => {
|
|
@@ -46248,12 +46277,32 @@ function App(props = {}) {
|
|
|
46248
46277
|
}, [overlayComments, focused]);
|
|
46249
46278
|
const editorRef = reactExports.useRef(null);
|
|
46250
46279
|
const [pendingFocusCommentId, setPendingFocusCommentId] = reactExports.useState(null);
|
|
46280
|
+
const missingFocusCommentId = reactExports.useRef(null);
|
|
46251
46281
|
const autosaveTimer = reactExports.useRef(null);
|
|
46282
|
+
const durableAckedRef = reactExports.useRef(null);
|
|
46283
|
+
const durablePendingRef = reactExports.useRef(null);
|
|
46284
|
+
const durableTimer = reactExports.useRef(null);
|
|
46285
|
+
const awaitDurable = reactExports.useCallback((content2) => {
|
|
46286
|
+
if (!hostApi().onDurable) return false;
|
|
46287
|
+
if (durableTimer.current) clearTimeout(durableTimer.current);
|
|
46288
|
+
if (durableAckedRef.current === content2) {
|
|
46289
|
+
durablePendingRef.current = null;
|
|
46290
|
+
setStatus(t2("msg.saved"));
|
|
46291
|
+
return true;
|
|
46292
|
+
}
|
|
46293
|
+
durablePendingRef.current = content2;
|
|
46294
|
+
setStatus(t2("msg.autosaving"));
|
|
46295
|
+
durableTimer.current = setTimeout(() => {
|
|
46296
|
+
if (durablePendingRef.current === content2) setStatus(t2("msg.saveUnconfirmed"));
|
|
46297
|
+
}, DURABLE_ACK_TIMEOUT_MS);
|
|
46298
|
+
return true;
|
|
46299
|
+
}, []);
|
|
46252
46300
|
const history2 = reactExports.useRef([]);
|
|
46253
46301
|
const future = reactExports.useRef([]);
|
|
46254
46302
|
const humanTouchedComments = reactExports.useRef(/* @__PURE__ */ new Set());
|
|
46255
46303
|
const historyByDoc = reactExports.useRef(/* @__PURE__ */ new Map());
|
|
46256
46304
|
const savedRef = reactExports.useRef("");
|
|
46305
|
+
const landedBodyRef = reactExports.useRef(null);
|
|
46257
46306
|
const [checkpoint, setCheckpoint] = reactExports.useState("");
|
|
46258
46307
|
const skipPreviewScroll = reactExports.useRef(false);
|
|
46259
46308
|
const autoResolvedRef = reactExports.useRef(/* @__PURE__ */ new Set());
|
|
@@ -46295,11 +46344,12 @@ function App(props = {}) {
|
|
|
46295
46344
|
let cancelled = false;
|
|
46296
46345
|
const adoptedAtStart = externalAdoptedRef.current;
|
|
46297
46346
|
const bindingReady = settleWithin(hostApi().binding?.ready, BINDING_READY_TIMEOUT_MS);
|
|
46298
|
-
Promise.all([hostApi().load(), bindingReady]).then(([{ content: content2, path, readOnly: ro, focusCommentId, shareLink, draftPending }, synced]) => {
|
|
46347
|
+
Promise.all([hostApi().load(), bindingReady]).then(([{ content: content2, path, readOnly: ro, focusCommentId, shareLink, commentLinkParam, draftPending }, synced]) => {
|
|
46299
46348
|
if (cancelled || docGenRef.current !== loadGen) return;
|
|
46300
46349
|
docPathRef.current = path;
|
|
46301
46350
|
humanTouchedComments.current = /* @__PURE__ */ new Set();
|
|
46302
46351
|
docLinkRef.current = shareLink?.trim() ? shareLink : path;
|
|
46352
|
+
commentLinkParamRef.current = commentLinkParam?.trim() ?? "";
|
|
46303
46353
|
setReadOnly(!!ro);
|
|
46304
46354
|
setPendingFocusCommentId(focusCommentId ?? null);
|
|
46305
46355
|
if (externalAdoptedRef.current === adoptedAtStart) {
|
|
@@ -46316,10 +46366,11 @@ function App(props = {}) {
|
|
|
46316
46366
|
void hostApi().getProposal().then((parked) => docGenRef.current === gen && parked != null && showProposal(parked.content, parked.id, parked.baseContent, parked.pending)).catch(() => {
|
|
46317
46367
|
});
|
|
46318
46368
|
}).catch(() => setLoaded(true));
|
|
46319
|
-
const processNavigated = ({ content: content2, path, readOnly: ro, focusCommentId, shareLink, draftPending }) => {
|
|
46369
|
+
const processNavigated = ({ content: content2, path, readOnly: ro, focusCommentId, shareLink, commentLinkParam, draftPending }) => {
|
|
46320
46370
|
if (docPathRef.current) historyByDoc.current.set(docPathRef.current, { undo: history2.current, redo: future.current, touched: humanTouchedComments.current });
|
|
46321
46371
|
docPathRef.current = path;
|
|
46322
46372
|
docLinkRef.current = shareLink?.trim() ? shareLink : path;
|
|
46373
|
+
commentLinkParamRef.current = commentLinkParam?.trim() ?? "";
|
|
46323
46374
|
setLoaded(true);
|
|
46324
46375
|
setReadOnly(!!ro);
|
|
46325
46376
|
resetMentionRoster();
|
|
@@ -46418,7 +46469,37 @@ function App(props = {}) {
|
|
|
46418
46469
|
});
|
|
46419
46470
|
const takenRevisions = revised.filter((c, i) => c !== prevDoc.comments[i]);
|
|
46420
46471
|
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);
|
|
46421
|
-
const
|
|
46472
|
+
const held = landedBodyRef.current;
|
|
46473
|
+
const heldBody = held && held.path === docPathRef.current && held.saved === savedRef.current ? held.body : null;
|
|
46474
|
+
let savedBody = null;
|
|
46475
|
+
try {
|
|
46476
|
+
savedBody = savedRef.current === "" ? "" : parse(savedRef.current).body;
|
|
46477
|
+
} catch {
|
|
46478
|
+
}
|
|
46479
|
+
const bodyBase = heldBody ?? savedBody;
|
|
46480
|
+
const blank = (s) => s.trim() === "";
|
|
46481
|
+
let body = prevDoc.body;
|
|
46482
|
+
let bodyTake = "none";
|
|
46483
|
+
let prefix = "";
|
|
46484
|
+
let inserted = incoming.body;
|
|
46485
|
+
if (!hostApi().binding?.setText && bodyBase !== null && !(blank(bodyBase) ? blank(incoming.body) : incoming.body === bodyBase)) {
|
|
46486
|
+
if (heldBody !== null && held.prefix !== "" && prevDoc.body === held.prefix + held.inserted) {
|
|
46487
|
+
prefix = held.prefix;
|
|
46488
|
+
inserted = incoming.body.replace(/^\s+/, "");
|
|
46489
|
+
body = prefix + inserted;
|
|
46490
|
+
bodyTake = "revised";
|
|
46491
|
+
} else if (prevDoc.body === bodyBase || blank(bodyBase) && blank(prevDoc.body)) {
|
|
46492
|
+
body = incoming.body;
|
|
46493
|
+
bodyTake = "taken";
|
|
46494
|
+
} else if (blank(bodyBase) && heldBody === null) {
|
|
46495
|
+
prefix = prevDoc.body + (prevDoc.body.endsWith("\n\n") ? "" : prevDoc.body.endsWith("\n") ? "\n" : "\n\n");
|
|
46496
|
+
inserted = incoming.body.replace(/^\s+/, "");
|
|
46497
|
+
body = prefix + inserted;
|
|
46498
|
+
bodyTake = "both";
|
|
46499
|
+
}
|
|
46500
|
+
if (bodyTake !== "none") landedBodyRef.current = { path: docPathRef.current, saved: savedRef.current, body: incoming.body, prefix, inserted };
|
|
46501
|
+
}
|
|
46502
|
+
const withComments = commentStore ? { ...prevDoc, body, comments: storeList } : { ...prevDoc, body, comments: orderComments([...revised, ...arriving]) };
|
|
46422
46503
|
const settleList = [];
|
|
46423
46504
|
for (const c of [...settledDelta, ...arriving, ...takenRevisions]) {
|
|
46424
46505
|
if (!settleList.some((x2) => x2.id === c.id)) settleList.push(c);
|
|
@@ -46427,10 +46508,10 @@ function App(props = {}) {
|
|
|
46427
46508
|
setDoc(withComments);
|
|
46428
46509
|
docRef.current = withComments;
|
|
46429
46510
|
externalAdoptedRef.current++;
|
|
46430
|
-
|
|
46431
|
-
|
|
46432
|
-
|
|
46433
|
-
|
|
46511
|
+
const bodyMoved = bodyBase === null ? true : savedRef.current === "" && heldBody === null ? incoming.body.trim() !== "" : incoming.body !== bodyBase;
|
|
46512
|
+
if (bodyTake !== "none") {
|
|
46513
|
+
setStatus(t2(bodyTake === "both" ? "msg.agentDraftKeptBoth" : bodyTake === "revised" ? "msg.agentDraftRevised" : "msg.agentUpdatedKept"));
|
|
46514
|
+
return;
|
|
46434
46515
|
}
|
|
46435
46516
|
const gained = commentStore ? settledDelta.length : arriving.length + takenRevisions.length;
|
|
46436
46517
|
setStatus(t2(gained > 0 ? bodyMoved ? "msg.agentCommentedAndChanged" : "msg.agentCommented" : "msg.agentUpdatedUnsaved"));
|
|
@@ -46642,7 +46723,7 @@ function App(props = {}) {
|
|
|
46642
46723
|
if (mode.autosaveKind === "canonical") {
|
|
46643
46724
|
savedRef.current = content2;
|
|
46644
46725
|
setDirty(false);
|
|
46645
|
-
setStatus(t2("msg.autosaving"));
|
|
46726
|
+
if (!awaitDurable(content2)) setStatus(t2("msg.autosaving"));
|
|
46646
46727
|
} else {
|
|
46647
46728
|
setStatus(t2("msg.autosaved"));
|
|
46648
46729
|
}
|
|
@@ -46651,6 +46732,22 @@ function App(props = {}) {
|
|
|
46651
46732
|
if (autosaveTimer.current) clearTimeout(autosaveTimer.current);
|
|
46652
46733
|
};
|
|
46653
46734
|
}, [doc2, dirty, loaded, cadence]);
|
|
46735
|
+
reactExports.useEffect(() => {
|
|
46736
|
+
const onDurable = hostApi().onDurable;
|
|
46737
|
+
if (!loaded || !onDurable) return;
|
|
46738
|
+
const off = onDurable(() => {
|
|
46739
|
+
const acked = serialize(docRef.current);
|
|
46740
|
+
durableAckedRef.current = acked;
|
|
46741
|
+
if (durablePendingRef.current !== acked || dirtyRef.current) return;
|
|
46742
|
+
durablePendingRef.current = null;
|
|
46743
|
+
if (durableTimer.current) clearTimeout(durableTimer.current);
|
|
46744
|
+
setStatus(t2("msg.saved"));
|
|
46745
|
+
});
|
|
46746
|
+
return () => {
|
|
46747
|
+
off();
|
|
46748
|
+
if (durableTimer.current) clearTimeout(durableTimer.current);
|
|
46749
|
+
};
|
|
46750
|
+
}, [loaded]);
|
|
46654
46751
|
reactExports.useEffect(() => {
|
|
46655
46752
|
if (loaded) void hostApi().reportState(dirty, serialize(docRef.current));
|
|
46656
46753
|
}, [dirty, doc2, loaded]);
|
|
@@ -46821,8 +46918,10 @@ function App(props = {}) {
|
|
|
46821
46918
|
if (kind === "canonical") {
|
|
46822
46919
|
savedRef.current = content2;
|
|
46823
46920
|
setDirty(false);
|
|
46921
|
+
if (!awaitDurable(content2)) setStatus(t2("msg.saved"));
|
|
46922
|
+
} else {
|
|
46923
|
+
setStatus(t2("msg.checkpointSaved"));
|
|
46824
46924
|
}
|
|
46825
|
-
setStatus(kind === "canonical" ? "saved" : "checkpoint saved");
|
|
46826
46925
|
}, [cadence, mode, readOnly2]);
|
|
46827
46926
|
saveNowRef.current = saveNow;
|
|
46828
46927
|
const pendingAnswersRef = reactExports.useRef(/* @__PURE__ */ new Set());
|
|
@@ -47325,8 +47424,17 @@ function App(props = {}) {
|
|
|
47325
47424
|
if (!loaded || !pendingFocusCommentId) return;
|
|
47326
47425
|
const id2 = pendingFocusCommentId;
|
|
47327
47426
|
const c = doc2.comments.find((x2) => x2.id === id2);
|
|
47328
|
-
|
|
47427
|
+
if (!c) {
|
|
47428
|
+
if (missingFocusCommentId.current !== id2) {
|
|
47429
|
+
missingFocusCommentId.current = id2;
|
|
47430
|
+
setStatus(t2("msg.commentLinkGone"));
|
|
47431
|
+
}
|
|
47432
|
+
return;
|
|
47433
|
+
}
|
|
47434
|
+
missingFocusCommentId.current = null;
|
|
47435
|
+
const rootId = c.parentId ?? id2;
|
|
47329
47436
|
if (!visible.some((o) => o.thread.root.id === rootId)) setShowResolvedOrphaned(true);
|
|
47437
|
+
setStatus("");
|
|
47330
47438
|
if (panes === 1) setCommentOverlay(true);
|
|
47331
47439
|
if (panes === 2 && rightTab !== "comments") setRightTab("comments");
|
|
47332
47440
|
const raf = requestAnimationFrame(() => {
|
|
@@ -47334,7 +47442,7 @@ function App(props = {}) {
|
|
|
47334
47442
|
setPendingFocusCommentId(null);
|
|
47335
47443
|
});
|
|
47336
47444
|
return () => cancelAnimationFrame(raf);
|
|
47337
|
-
}, [loaded, pendingFocusCommentId, focusComment, doc2.comments, visible, panes, rightTab]);
|
|
47445
|
+
}, [loaded, pendingFocusCommentId, focusComment, doc2.comments, visible, panes, rightTab, t2]);
|
|
47338
47446
|
const revealTip = resolvedCount > 0 && orphanedCount > 0 ? t2("rail.showResolved", { resolved: resolvedCount, orphaned: orphanedCount }) : resolvedCount > 0 ? t2("rail.showResolvedOnly", { resolved: resolvedCount }) : t2("rail.showOrphanedOnly", { orphaned: orphanedCount });
|
|
47339
47447
|
const selBlocker = reactExports.useMemo(() => {
|
|
47340
47448
|
const sel = window.getSelection();
|
|
@@ -47534,8 +47642,9 @@ function App(props = {}) {
|
|
|
47534
47642
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47535
47643
|
"button",
|
|
47536
47644
|
{
|
|
47537
|
-
className: "ap-primary",
|
|
47645
|
+
className: "ap-primary ap-restart",
|
|
47538
47646
|
disabled: restartState === "running",
|
|
47647
|
+
"aria-busy": restartState === "running",
|
|
47539
47648
|
onClick: async () => {
|
|
47540
47649
|
setRestartState("running");
|
|
47541
47650
|
try {
|
|
@@ -47547,7 +47656,10 @@ function App(props = {}) {
|
|
|
47547
47656
|
}
|
|
47548
47657
|
setRestartState("failed");
|
|
47549
47658
|
},
|
|
47550
|
-
children:
|
|
47659
|
+
children: restartState === "running" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
47660
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-spinner-sm", "aria-hidden": "true" }),
|
|
47661
|
+
t2("banner.restarting")
|
|
47662
|
+
] }) : t2("banner.restart")
|
|
47551
47663
|
}
|
|
47552
47664
|
)
|
|
47553
47665
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
@@ -47874,7 +47986,9 @@ function App(props = {}) {
|
|
|
47874
47986
|
onEdit: (id2, text2) => apply(editCommentText(docRef.current, id2, text2), { type: "comment_modified", payload: { id: id2 } }),
|
|
47875
47987
|
onDelete: (id2) => apply(deleteComment(docRef.current, id2), { type: "comment_deleted", payload: { id: id2 } }),
|
|
47876
47988
|
docLink: () => docLinkRef.current,
|
|
47877
|
-
|
|
47989
|
+
commentLink: (id2) => commentLinkFor(docLinkRef.current, commentLinkParamRef.current, id2),
|
|
47990
|
+
onCopyOutcome: (ok2) => setStatus(t2(ok2 ? "msg.copyDocLinkDone" : "msg.copyDocLinkFailed")),
|
|
47991
|
+
onCopyCommentOutcome: (ok2) => setStatus(t2(ok2 ? "msg.copyCommentLinkDone" : "msg.copyCommentLinkFailed"))
|
|
47878
47992
|
}
|
|
47879
47993
|
)
|
|
47880
47994
|
] }, o.thread.root.id)),
|
|
@@ -48459,6 +48573,18 @@ function ThreadCard(props) {
|
|
|
48459
48573
|
children: t2("thread.copyDocLink")
|
|
48460
48574
|
}
|
|
48461
48575
|
),
|
|
48576
|
+
props.commentLink(c.id) !== "" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
48577
|
+
"button",
|
|
48578
|
+
{
|
|
48579
|
+
onClick: () => {
|
|
48580
|
+
const write = navigator.clipboard?.writeText?.(props.commentLink(c.id));
|
|
48581
|
+
if (write) void write.then(() => props.onCopyCommentOutcome(true), () => props.onCopyCommentOutcome(false));
|
|
48582
|
+
else props.onCopyCommentOutcome(false);
|
|
48583
|
+
setMenuOpenId(null);
|
|
48584
|
+
},
|
|
48585
|
+
children: t2("thread.copyCommentLink")
|
|
48586
|
+
}
|
|
48587
|
+
),
|
|
48462
48588
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
48463
48589
|
"button",
|
|
48464
48590
|
{
|
package/app/renderer/index.html
CHANGED
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
content="default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' inplan-plugin:; img-src 'self' file: https:; connect-src 'self' inplan-plugin: ws://127.0.0.1:* ws://localhost:*; frame-src https://inplan.ai http://127.0.0.1:* http://localhost:*"
|
|
22
22
|
/>
|
|
23
23
|
<title>inplan</title>
|
|
24
|
-
<script type="module" crossorigin src="./assets/index-
|
|
25
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
24
|
+
<script type="module" crossorigin src="./assets/index-DSPgh74Z.js"></script>
|
|
25
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CNr1ZwEx.css">
|
|
26
26
|
</head>
|
|
27
27
|
<body>
|
|
28
28
|
<div id="root"></div>
|
package/bin/cli.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
-
import {
|
|
4
|
+
import { spawn as spawn3, spawnSync } from "child_process";
|
|
5
5
|
import { createHash as createHash4, randomBytes } from "crypto";
|
|
6
6
|
import { createRequire } from "module";
|
|
7
|
-
import { appendFileSync as appendFileSync3, copyFileSync, existsSync as
|
|
7
|
+
import { appendFileSync as appendFileSync3, copyFileSync, existsSync as existsSync12, mkdirSync as mkdirSync10, readdirSync as readdirSync2, readFileSync as readFileSync11, realpathSync, renameSync as renameSync4, statSync as statSync5, writeFileSync as writeFileSync11 } from "fs";
|
|
8
8
|
import { homedir as homedir7 } from "os";
|
|
9
|
-
import { basename as basename3, dirname as dirname11, extname, isAbsolute as isAbsolute2, join as
|
|
9
|
+
import { basename as basename3, dirname as dirname11, extname, isAbsolute as isAbsolute2, join as join11, relative as relative4, resolve as resolve3 } from "path";
|
|
10
10
|
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "url";
|
|
11
11
|
|
|
12
12
|
// ../core/dist/chunk-SJGNSLZ2.js
|
|
@@ -1170,6 +1170,23 @@ function clearAuth() {
|
|
|
1170
1170
|
const path = authPath();
|
|
1171
1171
|
if (existsSync5(path)) rmSync2(path, { force: true });
|
|
1172
1172
|
}
|
|
1173
|
+
async function revokeAndClearAuth() {
|
|
1174
|
+
const auth = loadAuth();
|
|
1175
|
+
let revoked = false;
|
|
1176
|
+
if (auth) {
|
|
1177
|
+
try {
|
|
1178
|
+
const cached = await reuseCached(auth, 0);
|
|
1179
|
+
const session = cached ?? await authedSession();
|
|
1180
|
+
if (session) {
|
|
1181
|
+
const { error } = await session.db.auth.signOut({ scope: "local" });
|
|
1182
|
+
revoked = !error;
|
|
1183
|
+
}
|
|
1184
|
+
} catch {
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
clearAuth();
|
|
1188
|
+
return { revoked };
|
|
1189
|
+
}
|
|
1173
1190
|
var LOCK_WAIT_MS = 1e4;
|
|
1174
1191
|
var LOCK_STALE_MS = 6e4;
|
|
1175
1192
|
function lockDir() {
|
|
@@ -1443,16 +1460,22 @@ import { dirname as dirname6, join as join7 } from "path";
|
|
|
1443
1460
|
import { homedir as homedir4 } from "os";
|
|
1444
1461
|
import { join as join6 } from "path";
|
|
1445
1462
|
import { pathToFileURL } from "url";
|
|
1463
|
+
import * as Y from "yjs";
|
|
1446
1464
|
var DEFAULT_HUB_URL = "wss://inplan-collab.fly.dev";
|
|
1447
1465
|
var resolveHubUrl = () => process.env.INPLAN_PLUGIN_URL || process.env.INPLAN_COLLAB_URL || DEFAULT_HUB_URL;
|
|
1448
1466
|
var hubHttpBase = () => resolveHubUrl().replace(/^ws/, "http").replace(/\/+$/, "");
|
|
1449
1467
|
var PLUGIN_HTTP = hubHttpBase();
|
|
1450
1468
|
var defaultCacheDir = () => join6(process.env.INPLAN_HOME || join6(homedir4(), ".inplan"), "plugin-cache");
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1469
|
+
function shareYjsWithPlugin() {
|
|
1470
|
+
globalThis.__inplanYjs = Y;
|
|
1471
|
+
}
|
|
1472
|
+
function importPluginCli(path) {
|
|
1473
|
+
shareYjsWithPlugin();
|
|
1474
|
+
return import(pathToFileURL(path).href);
|
|
1475
|
+
}
|
|
1476
|
+
var defaultDeps = { resolve: resolvePluginOutcome, importCli: importPluginCli };
|
|
1477
|
+
async function loadPluginGateOutcome(session, options, overrides = {}) {
|
|
1478
|
+
const deps = { ...defaultDeps, ...overrides };
|
|
1456
1479
|
try {
|
|
1457
1480
|
const { plugin, reason } = await deps.resolve({
|
|
1458
1481
|
apiBase: options.apiBase ?? PLUGIN_HTTP,
|
|
@@ -1474,7 +1497,7 @@ async function loadPluginGateOutcome(session, options, deps = defaultDeps) {
|
|
|
1474
1497
|
return { gate: null, reason: "unavailable" };
|
|
1475
1498
|
}
|
|
1476
1499
|
}
|
|
1477
|
-
async function loadPluginGate(session, options, deps =
|
|
1500
|
+
async function loadPluginGate(session, options, deps = {}) {
|
|
1478
1501
|
try {
|
|
1479
1502
|
return (await loadPluginGateOutcome(session, options, deps)).gate;
|
|
1480
1503
|
} catch {
|
|
@@ -1997,6 +2020,32 @@ var RemoteDocState = class {
|
|
|
1997
2020
|
clearReplayPending() {
|
|
1998
2021
|
if (existsSync10(this.pendingPath)) rmSync3(this.pendingPath);
|
|
1999
2022
|
}
|
|
2023
|
+
/** Where a refused working copy with this text is kept (see replaceRefusedCopy). Content-
|
|
2024
|
+
* addressed, so a second, different refusal never overwrites the first, and refusing the same
|
|
2025
|
+
* text twice keeps one file. */
|
|
2026
|
+
refusedPathFor(text) {
|
|
2027
|
+
return `${this.workFile}.refused-${hashBody(text).slice(0, 12)}.md`;
|
|
2028
|
+
}
|
|
2029
|
+
/**
|
|
2030
|
+
* The gate refused the working copy on integrity (#118). The copy is disposable — the document
|
|
2031
|
+
* lives on the hub — but left in place it is validated again on every attach and refused again,
|
|
2032
|
+
* so a stale or broken copy locks the agent out for good. Keep its text aside (the agent may
|
|
2033
|
+
* still want it), then replace the copy with `fresh` canonical and mark it synced, so the next
|
|
2034
|
+
* attach hydrates normally. A pending replay is cleared: what it would have replayed is exactly
|
|
2035
|
+
* the refused text, now kept aside. The proposal record is not touched — it tracks a proposal
|
|
2036
|
+
* already in the cloud, independent of this copy. Order matters: the refused text is written
|
|
2037
|
+
* BEFORE the copy is replaced, so a crash between the two never loses it.
|
|
2038
|
+
* Returns the path the refused text was kept at, or null if there was no copy.
|
|
2039
|
+
*/
|
|
2040
|
+
replaceRefusedCopy(fresh) {
|
|
2041
|
+
const refused = this.readWorkFile();
|
|
2042
|
+
const kept = refused !== null ? this.refusedPathFor(refused) : null;
|
|
2043
|
+
if (refused !== null && kept !== null) writeFileSync8(kept, refused);
|
|
2044
|
+
this.writeWorkFile(fresh);
|
|
2045
|
+
this.recordSynced(fresh);
|
|
2046
|
+
this.clearReplayPending();
|
|
2047
|
+
return kept;
|
|
2048
|
+
}
|
|
2000
2049
|
// ── Proposal record: the durable "did my edit land?" signal (#88) ─────────────────────────────
|
|
2001
2050
|
/**
|
|
2002
2051
|
* Park a proposal: publish the record + its exact text as ONE atomic rename, then refresh the
|
|
@@ -2235,6 +2284,7 @@ async function withdrawOwnPending(store, _canonicalText, landed) {
|
|
|
2235
2284
|
}
|
|
2236
2285
|
|
|
2237
2286
|
// src/gate.ts
|
|
2287
|
+
var integrityKey = (e) => `${e.code}\0${e.commentId ?? ""}\0${e.message}`;
|
|
2238
2288
|
function evaluateAgentEdit(canonicalText, currentText, confirmed) {
|
|
2239
2289
|
const current = parse(currentText);
|
|
2240
2290
|
const canonical = parse(canonicalText);
|
|
@@ -2258,8 +2308,9 @@ function evaluateAgentEdit(canonicalText, currentText, confirmed) {
|
|
|
2258
2308
|
const dangling = [...deletionGraph.values()].filter((c) => c.parentId !== void 0 && removedSet.has(c.parentId) && !removedSet.has(c.id));
|
|
2259
2309
|
const danglingIds = new Set(dangling.map((c) => c.id));
|
|
2260
2310
|
const unconfirmed = [...lost.filter((c) => !confirmed.has(c.id)), ...dangling];
|
|
2311
|
+
const inherited = new Set(checkIntegrity(canonical).errors.map(integrityKey));
|
|
2261
2312
|
const integrityErrors = checkIntegrity(accepted).errors.filter(
|
|
2262
|
-
(e) => e.code !== "span_missing_link" && !(e.code === "missing_parent" && e.commentId !== void 0 && danglingIds.has(e.commentId))
|
|
2313
|
+
(e) => e.code !== "span_missing_link" && !(e.code === "missing_parent" && e.commentId !== void 0 && danglingIds.has(e.commentId)) && !inherited.has(integrityKey(e))
|
|
2263
2314
|
);
|
|
2264
2315
|
return {
|
|
2265
2316
|
integrityOk: integrityErrors.length === 0,
|
|
@@ -2381,10 +2432,20 @@ function demoteSource({ hubReadable, fromStore }) {
|
|
|
2381
2432
|
if (hubReadable) return { use: "hub" };
|
|
2382
2433
|
return fromStore ? { use: "store" } : { use: "abort", reason: "hub_unreadable" };
|
|
2383
2434
|
}
|
|
2435
|
+
async function recoverRefusedCopy(gate, rds) {
|
|
2436
|
+
const fresh = await gate.readCanonical();
|
|
2437
|
+
const refusedCopy = rds.replaceRefusedCopy(fresh);
|
|
2438
|
+
const kept = refusedCopy ? `; the refused text is at ${refusedCopy}` : "";
|
|
2439
|
+
return {
|
|
2440
|
+
workFile: rds.workFile,
|
|
2441
|
+
...refusedCopy ? { refusedCopy } : {},
|
|
2442
|
+
message: `The working copy was refreshed from the latest canonical${kept}. Re-apply your edit to ${rds.workFile} and re-run.`
|
|
2443
|
+
};
|
|
2444
|
+
}
|
|
2384
2445
|
|
|
2385
2446
|
// src/presence.ts
|
|
2386
2447
|
import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
|
2387
|
-
import * as
|
|
2448
|
+
import * as Y2 from "yjs";
|
|
2388
2449
|
import WebSocket2 from "ws";
|
|
2389
2450
|
var COLLAB_URL = resolveHubUrl();
|
|
2390
2451
|
var AUTH_REPORT_DELAY_MS = 15e3;
|
|
@@ -2415,7 +2476,7 @@ function jwtExpMs(token) {
|
|
|
2415
2476
|
}
|
|
2416
2477
|
function announcePresence(docId, token, model) {
|
|
2417
2478
|
try {
|
|
2418
|
-
const ydoc = new
|
|
2479
|
+
const ydoc = new Y2.Doc();
|
|
2419
2480
|
const socket = new HocuspocusProviderWebsocket({ url: COLLAB_URL, WebSocketPolyfill: WebSocket2 });
|
|
2420
2481
|
let reported = false;
|
|
2421
2482
|
let authCheck;
|
|
@@ -2784,6 +2845,42 @@ function trackCli(event, enabled, props) {
|
|
|
2784
2845
|
});
|
|
2785
2846
|
}
|
|
2786
2847
|
|
|
2848
|
+
// src/electronRuntime.ts
|
|
2849
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
2850
|
+
import { existsSync as existsSync11, writeFileSync as writeFileSync10 } from "fs";
|
|
2851
|
+
import { join as join10 } from "path";
|
|
2852
|
+
function electronDistRel(platform) {
|
|
2853
|
+
if (platform === "win32") return "electron.exe";
|
|
2854
|
+
if (platform === "darwin") return join10("Electron.app", "Contents", "MacOS", "Electron");
|
|
2855
|
+
return "electron";
|
|
2856
|
+
}
|
|
2857
|
+
function electronBinaryOnDisk(pkgDir, platform = process.platform) {
|
|
2858
|
+
const rel = electronDistRel(platform);
|
|
2859
|
+
const bin = join10(pkgDir, "dist", rel);
|
|
2860
|
+
if (!existsSync11(bin)) return null;
|
|
2861
|
+
try {
|
|
2862
|
+
const pathFile = join10(pkgDir, "path.txt");
|
|
2863
|
+
if (!existsSync11(pathFile)) writeFileSync10(pathFile, rel);
|
|
2864
|
+
} catch {
|
|
2865
|
+
}
|
|
2866
|
+
return bin;
|
|
2867
|
+
}
|
|
2868
|
+
function resolveElectronBinary(pkgDir, env = process.env, platform = process.platform) {
|
|
2869
|
+
if (env.ELECTRON_OVERRIDE_DIST_PATH) {
|
|
2870
|
+
const bin = join10(env.ELECTRON_OVERRIDE_DIST_PATH, electronDistRel(platform));
|
|
2871
|
+
return existsSync11(bin) ? bin : null;
|
|
2872
|
+
}
|
|
2873
|
+
return electronBinaryOnDisk(pkgDir, platform);
|
|
2874
|
+
}
|
|
2875
|
+
var ELECTRON_INSTALL_TIMEOUT_MS = 18e4;
|
|
2876
|
+
function electronInstallTimeoutMs(env = process.env) {
|
|
2877
|
+
const v = Number(env.INPLAN_ELECTRON_INSTALL_TIMEOUT_MS);
|
|
2878
|
+
return Number.isFinite(v) && v > 0 ? v : ELECTRON_INSTALL_TIMEOUT_MS;
|
|
2879
|
+
}
|
|
2880
|
+
function runElectronInstaller(pkgDir, nodeExe = process.execPath, env = process.env, timeoutMs = electronInstallTimeoutMs(env)) {
|
|
2881
|
+
execFileSync2(nodeExe, [join10(pkgDir, "install.js")], { cwd: pkgDir, stdio: ["ignore", 2, 2], env, timeout: timeoutMs });
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2787
2884
|
// src/cli.ts
|
|
2788
2885
|
var VERSION = versionFromModule(import.meta.url);
|
|
2789
2886
|
function output(obj) {
|
|
@@ -2802,31 +2899,17 @@ function getFlag(args, name) {
|
|
|
2802
2899
|
function hasFlag(args, name) {
|
|
2803
2900
|
return args.includes(`--${name}`);
|
|
2804
2901
|
}
|
|
2805
|
-
function
|
|
2806
|
-
if (platform === "win32") return "electron.exe";
|
|
2807
|
-
if (platform === "darwin") return join10("Electron.app", "Contents", "MacOS", "Electron");
|
|
2808
|
-
return "electron";
|
|
2809
|
-
}
|
|
2810
|
-
function electronBinaryFromDisk(reqUrl) {
|
|
2902
|
+
function electronPkgDir(reqUrl) {
|
|
2811
2903
|
try {
|
|
2812
|
-
|
|
2813
|
-
const rel = electronDistRel(process.platform);
|
|
2814
|
-
const bin = join10(pkgDir, "dist", rel);
|
|
2815
|
-
if (!existsSync11(bin)) return null;
|
|
2816
|
-
try {
|
|
2817
|
-
const pathFile = join10(pkgDir, "path.txt");
|
|
2818
|
-
if (!existsSync11(pathFile)) writeFileSync10(pathFile, rel);
|
|
2819
|
-
} catch {
|
|
2820
|
-
}
|
|
2821
|
-
return bin;
|
|
2904
|
+
return dirname11(createRequire(reqUrl).resolve("electron/package.json"));
|
|
2822
2905
|
} catch {
|
|
2823
2906
|
return null;
|
|
2824
2907
|
}
|
|
2825
2908
|
}
|
|
2826
2909
|
function electronCacheDir() {
|
|
2827
|
-
if (process.platform === "win32") return
|
|
2828
|
-
if (process.platform === "darwin") return
|
|
2829
|
-
return
|
|
2910
|
+
if (process.platform === "win32") return join11(process.env.LOCALAPPDATA ?? join11(homedir7(), "AppData", "Local"), "electron", "Cache");
|
|
2911
|
+
if (process.platform === "darwin") return join11(homedir7(), "Library", "Caches", "electron");
|
|
2912
|
+
return join11(process.env.XDG_CACHE_HOME ?? join11(homedir7(), ".cache"), "electron");
|
|
2830
2913
|
}
|
|
2831
2914
|
function cachedElectronZip(version, platform, arch) {
|
|
2832
2915
|
const root = electronCacheDir();
|
|
@@ -2834,8 +2917,8 @@ function cachedElectronZip(version, platform, arch) {
|
|
|
2834
2917
|
try {
|
|
2835
2918
|
let best = null;
|
|
2836
2919
|
for (const sub of readdirSync2(root)) {
|
|
2837
|
-
const f =
|
|
2838
|
-
if (!
|
|
2920
|
+
const f = join11(root, sub, want);
|
|
2921
|
+
if (!existsSync12(f)) continue;
|
|
2839
2922
|
const mtime = statSync5(f).mtimeMs;
|
|
2840
2923
|
if (!best || mtime > best.mtime) best = { file: f, mtime };
|
|
2841
2924
|
}
|
|
@@ -2855,36 +2938,31 @@ function expandArchiveWindows(zipPath, destDir) {
|
|
|
2855
2938
|
function autoInstallElectron(reqUrl) {
|
|
2856
2939
|
if (process.env.INPLAN_NO_ELECTRON_DOWNLOAD === "1") return false;
|
|
2857
2940
|
try {
|
|
2858
|
-
const pkgDir =
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
if (electronBinaryFromDisk(reqUrl) !== null) return true;
|
|
2941
|
+
const pkgDir = electronPkgDir(reqUrl);
|
|
2942
|
+
if (!pkgDir || !existsSync12(join11(pkgDir, "install.js"))) return false;
|
|
2943
|
+
process.stderr.write("[inplan] downloading the editor runtime \u2026\n");
|
|
2944
|
+
runElectronInstaller(pkgDir);
|
|
2945
|
+
if (electronBinaryOnDisk(pkgDir) !== null) return true;
|
|
2864
2946
|
if (process.platform === "win32") {
|
|
2865
|
-
const { version } = JSON.parse(readFileSync11(
|
|
2947
|
+
const { version } = JSON.parse(readFileSync11(join11(pkgDir, "package.json"), "utf8"));
|
|
2866
2948
|
const zip = cachedElectronZip(version, "win32", process.env.npm_config_arch || process.arch);
|
|
2867
|
-
if (zip && expandArchiveWindows(zip,
|
|
2868
|
-
|
|
2949
|
+
if (zip && expandArchiveWindows(zip, join11(pkgDir, "dist"))) {
|
|
2950
|
+
writeFileSync11(join11(pkgDir, "path.txt"), "electron.exe");
|
|
2869
2951
|
}
|
|
2870
2952
|
}
|
|
2871
|
-
return
|
|
2953
|
+
return electronBinaryOnDisk(pkgDir) !== null;
|
|
2872
2954
|
} catch {
|
|
2873
2955
|
return false;
|
|
2874
2956
|
}
|
|
2875
2957
|
}
|
|
2876
2958
|
function resolveBundledApp() {
|
|
2877
2959
|
const here = dirname11(fileURLToPath2(import.meta.url));
|
|
2878
|
-
const appMain =
|
|
2879
|
-
if (!
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
if (typeof electron === "string" && electron && existsSync11(electron)) return { electron, appMain };
|
|
2883
|
-
} catch {
|
|
2884
|
-
}
|
|
2885
|
-
const onDisk = electronBinaryFromDisk(import.meta.url);
|
|
2960
|
+
const appMain = join11(here, "..", "app", "main", "index.cjs");
|
|
2961
|
+
if (!existsSync12(appMain)) return { appMain: null };
|
|
2962
|
+
const pkgDir = electronPkgDir(import.meta.url);
|
|
2963
|
+
const onDisk = pkgDir ? resolveElectronBinary(pkgDir) : null;
|
|
2886
2964
|
if (onDisk) return { electron: onDisk, appMain };
|
|
2887
|
-
return { appMain, error: "Electron's binary isn't
|
|
2965
|
+
return { appMain, error: pkgDir ? "Electron's binary isn't downloaded yet, or its download was blocked (proxy/AV)" : "the electron package isn't installed" };
|
|
2888
2966
|
}
|
|
2889
2967
|
function spawnApp(file) {
|
|
2890
2968
|
const { ELECTRON_RUN_AS_NODE: _runAsNode, ...inherited } = process.env;
|
|
@@ -3031,7 +3109,8 @@ async function waitCycle(backend, explicitCursor, confirmed, model, gate = null,
|
|
|
3031
3109
|
return "exiting";
|
|
3032
3110
|
}
|
|
3033
3111
|
if (!ev.integrityOk) {
|
|
3034
|
-
|
|
3112
|
+
const recovery = backend.onIntegrityRefused ? await backend.onIntegrityRefused().catch(() => ({})) : {};
|
|
3113
|
+
output({ status: "integrity_error", errors: ev.integrityErrors, ...recovery });
|
|
3035
3114
|
exitAfterFlush(2);
|
|
3036
3115
|
return "exiting";
|
|
3037
3116
|
}
|
|
@@ -3554,12 +3633,12 @@ async function pendingLoginExit(existing) {
|
|
|
3554
3633
|
});
|
|
3555
3634
|
}
|
|
3556
3635
|
function stalenessCache() {
|
|
3557
|
-
const path =
|
|
3636
|
+
const path = join11(sidecarRoot(), ".update-check.json");
|
|
3558
3637
|
return {
|
|
3559
|
-
readCache: () =>
|
|
3638
|
+
readCache: () => existsSync12(path) ? readFileSync11(path, "utf8") : null,
|
|
3560
3639
|
writeCache: (v) => {
|
|
3561
3640
|
mkdirSync10(dirname11(path), { recursive: true });
|
|
3562
|
-
|
|
3641
|
+
writeFileSync11(path, v);
|
|
3563
3642
|
}
|
|
3564
3643
|
};
|
|
3565
3644
|
}
|
|
@@ -3636,13 +3715,13 @@ async function runRemote(cmd, docId, explicitCursor, confirmed, rest, localFile,
|
|
|
3636
3715
|
presenceTokenResolver(backend.token, async () => {
|
|
3637
3716
|
const fresh = await remoteBackend(docId, "cli-agent");
|
|
3638
3717
|
if (fresh) return fresh;
|
|
3639
|
-
if (!
|
|
3718
|
+
if (!existsSync12(authPath())) return null;
|
|
3640
3719
|
throw new Error("transient token refresh failure");
|
|
3641
3720
|
}),
|
|
3642
3721
|
model
|
|
3643
3722
|
);
|
|
3644
3723
|
try {
|
|
3645
|
-
const workFile =
|
|
3724
|
+
const workFile = join11(sidecarRoot(), "remote", `${docId}.plan.md`);
|
|
3646
3725
|
const rds = new RemoteDocState(workFile, docId);
|
|
3647
3726
|
rds.ensureDir();
|
|
3648
3727
|
let canonical = "";
|
|
@@ -3766,7 +3845,7 @@ async function runRemote(cmd, docId, explicitCursor, confirmed, rest, localFile,
|
|
|
3766
3845
|
process.stderr.write(`inplan: the doc moved local, but an unpushed edit remains at ${workFile} \u2014 merge it into ${localFile} by hand if you still want it.
|
|
3767
3846
|
`);
|
|
3768
3847
|
}
|
|
3769
|
-
|
|
3848
|
+
writeFileSync11(localFile, body2);
|
|
3770
3849
|
writeStatus(docPaths(localFile).statusPath, { location: "local", originalPath: localFile, lastSyncedHash: hashBody(body2) });
|
|
3771
3850
|
const pid = spawnApp(localFile);
|
|
3772
3851
|
output({ status: "moved_local", path: localFile, reopened: pid !== null, ...info });
|
|
@@ -3790,6 +3869,10 @@ async function runRemote(cmd, docId, explicitCursor, confirmed, rest, localFile,
|
|
|
3790
3869
|
},
|
|
3791
3870
|
localPendingProposalId: () => rds.pendingProposal()?.id,
|
|
3792
3871
|
// local file read only — see WaitBackend
|
|
3872
|
+
// A refused working copy must not stay in place: attaching validates it, so it would refuse
|
|
3873
|
+
// every later run too, locking the agent out exactly when the doc needs it (#118). Keep the
|
|
3874
|
+
// refused text beside the copy, refresh the copy from the hub, and say where both are.
|
|
3875
|
+
onIntegrityRefused: () => recoverRefusedCopy(gate, rds),
|
|
3793
3876
|
...onSaveLocallyGate ? { onSaveLocally: onSaveLocallyGate } : {}
|
|
3794
3877
|
},
|
|
3795
3878
|
explicitCursor,
|
|
@@ -3830,7 +3913,7 @@ function doPromote(file, args) {
|
|
|
3830
3913
|
process.stderr.write("usage: inplan promote <file> --cloud-doc <docId> [--locator org/repo/path]\n");
|
|
3831
3914
|
process.exit(64);
|
|
3832
3915
|
}
|
|
3833
|
-
const body2 =
|
|
3916
|
+
const body2 = existsSync12(file) ? readFileSync11(file, "utf8") : "";
|
|
3834
3917
|
const status = { location: "cloud", cloudDocId, originalPath: file, lastSyncedHash: hashBody(body2) };
|
|
3835
3918
|
const locator = getFlag(args, "locator");
|
|
3836
3919
|
if (locator) {
|
|
@@ -3875,7 +3958,7 @@ async function doDemote(file, args) {
|
|
|
3875
3958
|
return;
|
|
3876
3959
|
}
|
|
3877
3960
|
const body2 = choice.use === "hub" ? hubBody : await backend.store.loadDoc();
|
|
3878
|
-
|
|
3961
|
+
writeFileSync11(dest, body2);
|
|
3879
3962
|
writeStatus(p.statusPath, { location: "local", originalPath: dest, lastSyncedHash: hashBody(body2) });
|
|
3880
3963
|
output({ status: "demoted", location: "local", path: dest, source: choice.use });
|
|
3881
3964
|
}
|
|
@@ -3911,16 +3994,16 @@ async function doToken() {
|
|
|
3911
3994
|
function bundledSkillPath() {
|
|
3912
3995
|
try {
|
|
3913
3996
|
const override = process.env.INPLAN_SKILL_SRC;
|
|
3914
|
-
if (override) return
|
|
3915
|
-
const p =
|
|
3916
|
-
return
|
|
3997
|
+
if (override) return existsSync12(override) ? override : null;
|
|
3998
|
+
const p = join11(dirname11(fileURLToPath2(import.meta.url)), "..", "skill", "SKILL.md");
|
|
3999
|
+
return existsSync12(p) ? p : null;
|
|
3917
4000
|
} catch {
|
|
3918
4001
|
return null;
|
|
3919
4002
|
}
|
|
3920
4003
|
}
|
|
3921
4004
|
function activeDocForCwd(cwd) {
|
|
3922
4005
|
const root = sidecarRoot();
|
|
3923
|
-
if (!
|
|
4006
|
+
if (!existsSync12(root)) return null;
|
|
3924
4007
|
const real = (p) => {
|
|
3925
4008
|
try {
|
|
3926
4009
|
return realpathSync(p);
|
|
@@ -3932,13 +4015,13 @@ function activeDocForCwd(cwd) {
|
|
|
3932
4015
|
let best = null;
|
|
3933
4016
|
for (const entry of readdirSync2(root)) {
|
|
3934
4017
|
try {
|
|
3935
|
-
const dir =
|
|
3936
|
-
const orig = readStatus(
|
|
4018
|
+
const dir = join11(root, entry);
|
|
4019
|
+
const orig = readStatus(join11(dir, "status.json")).originalPath;
|
|
3937
4020
|
if (!orig) continue;
|
|
3938
4021
|
const rel = relative4(base2, real(orig));
|
|
3939
4022
|
if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) continue;
|
|
3940
|
-
const logPath =
|
|
3941
|
-
const mtime =
|
|
4023
|
+
const logPath = join11(dir, "log.jsonl");
|
|
4024
|
+
const mtime = existsSync12(logPath) ? statSync5(logPath).mtimeMs : 0;
|
|
3942
4025
|
if (!best || mtime > best.mtime) best = { file: resolve3(orig), mtime };
|
|
3943
4026
|
} catch {
|
|
3944
4027
|
}
|
|
@@ -3947,7 +4030,7 @@ function activeDocForCwd(cwd) {
|
|
|
3947
4030
|
}
|
|
3948
4031
|
function relayCursorPath(sessionKey) {
|
|
3949
4032
|
const id = createHash4("sha1").update(sessionKey).digest("hex").slice(0, 16);
|
|
3950
|
-
return
|
|
4033
|
+
return join11(sidecarRoot(), ".relay-cursors", `${id}.json`);
|
|
3951
4034
|
}
|
|
3952
4035
|
function readRelayCursor(sessionKey) {
|
|
3953
4036
|
try {
|
|
@@ -3961,7 +4044,7 @@ function writeRelayCursor(sessionKey, sent) {
|
|
|
3961
4044
|
try {
|
|
3962
4045
|
const p = relayCursorPath(sessionKey);
|
|
3963
4046
|
mkdirSync10(dirname11(p), { recursive: true });
|
|
3964
|
-
|
|
4047
|
+
writeFileSync11(p, JSON.stringify({ sent }) + "\n");
|
|
3965
4048
|
} catch {
|
|
3966
4049
|
}
|
|
3967
4050
|
}
|
|
@@ -4014,7 +4097,7 @@ function notesFromHook(kind, stdin, argv) {
|
|
|
4014
4097
|
const p = parse2(stdin);
|
|
4015
4098
|
const transcript = str(p.transcript_path);
|
|
4016
4099
|
const sessionKey = str(p.session_id) || transcript;
|
|
4017
|
-
const blocks = transcript &&
|
|
4100
|
+
const blocks = transcript && existsSync12(transcript) && sessionKey ? transcriptTextBlocks(transcript) : [];
|
|
4018
4101
|
if (blocks.length > 0) {
|
|
4019
4102
|
const sent = readRelayCursor(sessionKey);
|
|
4020
4103
|
for (let i = Math.max(0, sent); i < blocks.length; i++) notes.push(blocks[i]);
|
|
@@ -4086,19 +4169,19 @@ async function doRelay(args) {
|
|
|
4086
4169
|
function skillTargets() {
|
|
4087
4170
|
const home = homedir7();
|
|
4088
4171
|
return [
|
|
4089
|
-
{ name: "Claude Code", root:
|
|
4090
|
-
{ name: "Pi", root:
|
|
4091
|
-
{ name: "Codex", root:
|
|
4172
|
+
{ name: "Claude Code", root: join11(home, ".claude"), target: join11(home, ".claude", "skills", "inplan", "SKILL.md") },
|
|
4173
|
+
{ name: "Pi", root: join11(home, ".pi", "agent"), target: join11(home, ".pi", "agent", "skills", "inplan", "SKILL.md") },
|
|
4174
|
+
{ name: "Codex", root: join11(home, ".codex"), target: join11(home, ".codex", "skills", "inplan", "SKILL.md") }
|
|
4092
4175
|
];
|
|
4093
4176
|
}
|
|
4094
4177
|
var SKILL_ALLOW = ["Bash(inplan *)", "Edit(**/*.plan.md)", "Read(~/.inplan/**)", "Edit(~/.inplan/**)"];
|
|
4095
4178
|
var SKILL_ALLOW_OBSOLETE = ["Write(**/*.plan.md)", "Write(~/.inplan/**)"];
|
|
4096
4179
|
var SKILL_DIRS = ["~/.inplan/"];
|
|
4097
4180
|
function grantClaudePermissions(claudeRoot) {
|
|
4098
|
-
const settingsPath =
|
|
4181
|
+
const settingsPath = join11(claudeRoot, "settings.json");
|
|
4099
4182
|
let settings = {};
|
|
4100
4183
|
try {
|
|
4101
|
-
if (
|
|
4184
|
+
if (existsSync12(settingsPath)) {
|
|
4102
4185
|
const parsed = JSON.parse(readFileSync11(settingsPath, "utf8"));
|
|
4103
4186
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return false;
|
|
4104
4187
|
settings = parsed;
|
|
@@ -4132,7 +4215,7 @@ function grantClaudePermissions(claudeRoot) {
|
|
|
4132
4215
|
settings.permissions = perms;
|
|
4133
4216
|
try {
|
|
4134
4217
|
const tmp = settingsPath + ".tmp";
|
|
4135
|
-
|
|
4218
|
+
writeFileSync11(tmp, JSON.stringify(settings, null, 2) + "\n");
|
|
4136
4219
|
renameSync4(tmp, settingsPath);
|
|
4137
4220
|
} catch {
|
|
4138
4221
|
return false;
|
|
@@ -4178,7 +4261,7 @@ function mergeRelayHooks(settings, entries) {
|
|
|
4178
4261
|
}
|
|
4179
4262
|
function readJsonObject(path) {
|
|
4180
4263
|
try {
|
|
4181
|
-
if (!
|
|
4264
|
+
if (!existsSync12(path)) return {};
|
|
4182
4265
|
const parsed = JSON.parse(readFileSync11(path, "utf8"));
|
|
4183
4266
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
4184
4267
|
return parsed;
|
|
@@ -4190,7 +4273,7 @@ function writeJsonAtomic(path, value) {
|
|
|
4190
4273
|
try {
|
|
4191
4274
|
mkdirSync10(dirname11(path), { recursive: true });
|
|
4192
4275
|
const tmp = path + ".tmp";
|
|
4193
|
-
|
|
4276
|
+
writeFileSync11(tmp, JSON.stringify(value, null, 2) + "\n");
|
|
4194
4277
|
renameSync4(tmp, path);
|
|
4195
4278
|
return true;
|
|
4196
4279
|
} catch {
|
|
@@ -4198,13 +4281,13 @@ function writeJsonAtomic(path, value) {
|
|
|
4198
4281
|
}
|
|
4199
4282
|
}
|
|
4200
4283
|
function installClaudeHooks(claudeRoot) {
|
|
4201
|
-
const path =
|
|
4284
|
+
const path = join11(claudeRoot, "settings.json");
|
|
4202
4285
|
const settings = readJsonObject(path);
|
|
4203
4286
|
if (!settings || !mergeRelayHooks(settings, CLAUDE_RELAY_HOOKS)) return false;
|
|
4204
4287
|
return writeJsonAtomic(path, settings);
|
|
4205
4288
|
}
|
|
4206
4289
|
function installCodexHooks(codexRoot) {
|
|
4207
|
-
const path =
|
|
4290
|
+
const path = join11(codexRoot, "hooks.json");
|
|
4208
4291
|
const cfg = readJsonObject(path);
|
|
4209
4292
|
if (!cfg || !mergeRelayHooks(cfg, CODEX_RELAY_HOOKS)) return false;
|
|
4210
4293
|
return writeJsonAtomic(path, cfg);
|
|
@@ -4254,16 +4337,16 @@ export default function (pi) {
|
|
|
4254
4337
|
}
|
|
4255
4338
|
`;
|
|
4256
4339
|
function installPiRelayExtension(piAgentRoot) {
|
|
4257
|
-
const path =
|
|
4340
|
+
const path = join11(piAgentRoot, "extensions", "inplan-relay.ts");
|
|
4258
4341
|
try {
|
|
4259
|
-
if (
|
|
4342
|
+
if (existsSync12(path)) {
|
|
4260
4343
|
const cur = readFileSync11(path, "utf8");
|
|
4261
4344
|
if (cur === PI_RELAY_EXTENSION) return false;
|
|
4262
4345
|
if (!cur.startsWith(PI_RELAY_MARKER)) return false;
|
|
4263
4346
|
}
|
|
4264
4347
|
mkdirSync10(dirname11(path), { recursive: true });
|
|
4265
4348
|
const tmp = path + ".tmp";
|
|
4266
|
-
|
|
4349
|
+
writeFileSync11(tmp, PI_RELAY_EXTENSION);
|
|
4267
4350
|
renameSync4(tmp, path);
|
|
4268
4351
|
return true;
|
|
4269
4352
|
} catch {
|
|
@@ -4284,8 +4367,8 @@ function doInstallSkill(args) {
|
|
|
4284
4367
|
const installed = [];
|
|
4285
4368
|
for (const a of skillTargets()) {
|
|
4286
4369
|
try {
|
|
4287
|
-
if (!
|
|
4288
|
-
if (!
|
|
4370
|
+
if (!existsSync12(a.root)) continue;
|
|
4371
|
+
if (!existsSync12(a.target)) {
|
|
4289
4372
|
mkdirSync10(dirname11(a.target), { recursive: true });
|
|
4290
4373
|
copyFileSync(src, a.target);
|
|
4291
4374
|
installed.push(a.name);
|
|
@@ -4293,19 +4376,19 @@ function doInstallSkill(args) {
|
|
|
4293
4376
|
`);
|
|
4294
4377
|
}
|
|
4295
4378
|
if (a.name === "Claude Code" && grantClaudePermissions(a.root)) {
|
|
4296
|
-
process.stderr.write(`inplan: granted scoped auto-approval (plan files + ~/.inplan + inplan CLI) in ${
|
|
4379
|
+
process.stderr.write(`inplan: granted scoped auto-approval (plan files + ~/.inplan + inplan CLI) in ${join11(a.root, "settings.json")}.
|
|
4297
4380
|
`);
|
|
4298
4381
|
}
|
|
4299
4382
|
if (a.name === "Claude Code" && installClaudeHooks(a.root)) {
|
|
4300
|
-
process.stderr.write(`inplan: configured the agent-console relay hooks in ${
|
|
4383
|
+
process.stderr.write(`inplan: configured the agent-console relay hooks in ${join11(a.root, "settings.json")}.
|
|
4301
4384
|
`);
|
|
4302
4385
|
}
|
|
4303
4386
|
if (a.name === "Codex" && installCodexHooks(a.root)) {
|
|
4304
|
-
process.stderr.write(`inplan: configured the agent-console relay hooks in ${
|
|
4387
|
+
process.stderr.write(`inplan: configured the agent-console relay hooks in ${join11(a.root, "hooks.json")}.
|
|
4305
4388
|
`);
|
|
4306
4389
|
}
|
|
4307
4390
|
if (a.name === "Pi" && installPiRelayExtension(a.root)) {
|
|
4308
|
-
process.stderr.write(`inplan: installed the agent-console relay extension in ${
|
|
4391
|
+
process.stderr.write(`inplan: installed the agent-console relay extension in ${join11(a.root, "extensions", "inplan-relay.ts")}.
|
|
4309
4392
|
`);
|
|
4310
4393
|
}
|
|
4311
4394
|
} catch {
|
|
@@ -4313,9 +4396,9 @@ function doInstallSkill(args) {
|
|
|
4313
4396
|
}
|
|
4314
4397
|
if (!quiet) output({ status: "ok", installed });
|
|
4315
4398
|
}
|
|
4316
|
-
function doLogout() {
|
|
4317
|
-
|
|
4318
|
-
output({ status: "logged_out" });
|
|
4399
|
+
async function doLogout() {
|
|
4400
|
+
const { revoked } = await revokeAndClearAuth();
|
|
4401
|
+
output({ status: "logged_out", revoked });
|
|
4319
4402
|
}
|
|
4320
4403
|
async function doUpload(file, args) {
|
|
4321
4404
|
const s = await authedSession();
|
|
@@ -4339,7 +4422,7 @@ async function doUpload(file, args) {
|
|
|
4339
4422
|
process.exit(1);
|
|
4340
4423
|
}
|
|
4341
4424
|
const org = orgOf(pick);
|
|
4342
|
-
const body2 =
|
|
4425
|
+
const body2 = existsSync12(file) ? readFileSync11(file, "utf8") : "";
|
|
4343
4426
|
const prov = gitProvenance(file);
|
|
4344
4427
|
const repo = getFlag(args, "repo") ?? prov.repo;
|
|
4345
4428
|
const path = getFlag(args, "path") ?? prov.path;
|
|
@@ -4394,7 +4477,7 @@ async function doUpload(file, args) {
|
|
|
4394
4477
|
"the document changed in the cloud while migrating images (a live session attached first) \u2014 not overwriting it; the local images were not migrated, re-paste them once you're collaborating on this doc in the cloud"
|
|
4395
4478
|
);
|
|
4396
4479
|
}
|
|
4397
|
-
const onDiskNow =
|
|
4480
|
+
const onDiskNow = existsSync12(file) ? readFileSync11(file, "utf8") : null;
|
|
4398
4481
|
if (onDiskNow !== null && onDiskNow !== body2) {
|
|
4399
4482
|
finalBody = onDiskNow;
|
|
4400
4483
|
throw new Error(
|
|
@@ -4402,10 +4485,10 @@ async function doUpload(file, args) {
|
|
|
4402
4485
|
);
|
|
4403
4486
|
}
|
|
4404
4487
|
try {
|
|
4405
|
-
|
|
4488
|
+
writeFileSync11(file, migrated.body);
|
|
4406
4489
|
finalBody = migrated.body;
|
|
4407
4490
|
} catch (e) {
|
|
4408
|
-
finalBody =
|
|
4491
|
+
finalBody = existsSync12(file) ? readFileSync11(file, "utf8") : body2;
|
|
4409
4492
|
throw new Error(
|
|
4410
4493
|
`the cloud copy was updated, but writing it back to the local file failed (${e instanceof Error ? e.message : String(e)}) \u2014 the local file is now stale; open this doc in the editor (or re-run \`inplan wait\`) to pull the migrated body back down`
|
|
4411
4494
|
);
|
|
@@ -4569,7 +4652,7 @@ async function migrateLocalImages(body2, docDir, db, orgId, docId) {
|
|
|
4569
4652
|
continue;
|
|
4570
4653
|
}
|
|
4571
4654
|
const abs = resolve3(docDir, dest);
|
|
4572
|
-
if (!
|
|
4655
|
+
if (!existsSync12(abs)) continue;
|
|
4573
4656
|
let absReal;
|
|
4574
4657
|
try {
|
|
4575
4658
|
absReal = realpathSync(abs);
|
|
@@ -4634,7 +4717,7 @@ function routeFor(file, cmd, args) {
|
|
|
4634
4717
|
const status = readStatus(p.statusPath);
|
|
4635
4718
|
if (status.location !== "cloud" || !status.cloudDocId) return { kind: "local" };
|
|
4636
4719
|
const docId = status.cloudDocId;
|
|
4637
|
-
if (cmd === "signal" || cmd === "message" || !
|
|
4720
|
+
if (cmd === "signal" || cmd === "message" || !existsSync12(file)) return { kind: "cloud", docId };
|
|
4638
4721
|
const local = readFileSync11(file, "utf8");
|
|
4639
4722
|
const diverged = status.lastSyncedHash !== void 0 && hashBody(local) !== status.lastSyncedHash;
|
|
4640
4723
|
if (!diverged || hasFlag(args, "use-cloud")) return { kind: "cloud", docId };
|
|
@@ -4673,12 +4756,18 @@ async function main() {
|
|
|
4673
4756
|
return;
|
|
4674
4757
|
}
|
|
4675
4758
|
if (cmd === "logout") {
|
|
4676
|
-
doLogout();
|
|
4759
|
+
await doLogout();
|
|
4760
|
+
return;
|
|
4761
|
+
}
|
|
4762
|
+
if (cmd === "prepare-editor") {
|
|
4763
|
+
const bundled = resolveBundledApp();
|
|
4764
|
+
const ready = "electron" in bundled || bundled.appMain !== null && autoInstallElectron(import.meta.url);
|
|
4765
|
+
output({ status: ready ? "ready" : "unavailable" });
|
|
4677
4766
|
return;
|
|
4678
4767
|
}
|
|
4679
4768
|
if (cmd === "launch-editor") {
|
|
4680
4769
|
const target = argv[1] ? resolve3(argv[1]) : "";
|
|
4681
|
-
if (!target || !
|
|
4770
|
+
if (!target || !existsSync12(target)) {
|
|
4682
4771
|
output({ status: "launch_failed", message: `file not found: ${target || "(none)"}` });
|
|
4683
4772
|
process.exitCode = 1;
|
|
4684
4773
|
return;
|
|
@@ -4702,6 +4791,7 @@ async function main() {
|
|
|
4702
4791
|
output({ status: "update_check", pkg, ...await checkForUpdate({ pkg, current: VERSION }) });
|
|
4703
4792
|
} else {
|
|
4704
4793
|
const r = await selfUpdate(pkg);
|
|
4794
|
+
if (r.ok && process.argv[1]) spawnSync(process.execPath, [process.argv[1], "prepare-editor"], { stdio: ["ignore", 2, 2], timeout: electronInstallTimeoutMs() + 3e4, killSignal: "SIGKILL" });
|
|
4705
4795
|
output({ status: r.ok ? "updated" : "update_failed", pkg, output: r.output });
|
|
4706
4796
|
}
|
|
4707
4797
|
return;
|
|
@@ -4804,7 +4894,7 @@ async function main() {
|
|
|
4804
4894
|
output({ status: "messaged" });
|
|
4805
4895
|
return;
|
|
4806
4896
|
}
|
|
4807
|
-
if (cmd !== "open" && !
|
|
4897
|
+
if (cmd !== "open" && !existsSync12(file)) {
|
|
4808
4898
|
process.stderr.write(`inplan ${cmd}: file not found: ${file}
|
|
4809
4899
|
`);
|
|
4810
4900
|
process.exit(1);
|
|
@@ -4840,7 +4930,7 @@ async function main() {
|
|
|
4840
4930
|
...question ? { question } : {},
|
|
4841
4931
|
mayResolve: hasFlag(args, "may-resolve")
|
|
4842
4932
|
});
|
|
4843
|
-
|
|
4933
|
+
writeFileSync11(file, nextText);
|
|
4844
4934
|
const p = docPaths(file);
|
|
4845
4935
|
mkdirSync10(p.controlDir, { recursive: true });
|
|
4846
4936
|
await new FsControlChannel(p).append({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inplan",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.13",
|
|
4
4
|
"description": "inplan — a Markdown editor for human ⇄ coding-agent planning. CLI + desktop editor.",
|
|
5
5
|
"license": "AGPL-3.0-or-later",
|
|
6
6
|
"repository": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"postinstall": "node bin/cli.js install-skill --quiet || true"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"electron": "^
|
|
28
|
+
"electron": "^44.12.0",
|
|
29
29
|
"@hocuspocus/provider": "^2.15.3",
|
|
30
30
|
"@supabase/supabase-js": "^2.45.0",
|
|
31
31
|
"ws": "^8.18.0",
|