inplan 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app/main/index.js
CHANGED
|
@@ -969,12 +969,31 @@ async function readProfile() {
|
|
|
969
969
|
async function collaborateOnCloud() {
|
|
970
970
|
if (!session) return;
|
|
971
971
|
if (session.hasUnsaved) session.complete(session.pending);
|
|
972
|
-
const
|
|
972
|
+
const file = session.paths.file;
|
|
973
|
+
let r = await runCli(["upload", file]);
|
|
973
974
|
let out = {};
|
|
974
975
|
try {
|
|
975
976
|
out = JSON.parse(r.stdout.trim() || "{}");
|
|
976
977
|
} catch {
|
|
977
978
|
}
|
|
979
|
+
if (out.status === "limit") {
|
|
980
|
+
const lruTitle = out.lru?.title?.trim() || "your least-recently-used document";
|
|
981
|
+
const choice = dialog.showMessageBoxSync(win, {
|
|
982
|
+
type: "question",
|
|
983
|
+
buttons: ["Deactivate & upload", "Cancel"],
|
|
984
|
+
defaultId: 0,
|
|
985
|
+
cancelId: 1,
|
|
986
|
+
message: "Document limit reached",
|
|
987
|
+
detail: `You’re at your ${out.limit ?? ""}-document limit. Deactivate the least-recently-used “${lruTitle}” to make room?`
|
|
988
|
+
});
|
|
989
|
+
if (choice !== 0) return;
|
|
990
|
+
r = await runCli(["upload", file, "--evict-lru"]);
|
|
991
|
+
try {
|
|
992
|
+
out = JSON.parse(r.stdout.trim() || "{}");
|
|
993
|
+
} catch {
|
|
994
|
+
out = {};
|
|
995
|
+
}
|
|
996
|
+
}
|
|
978
997
|
if (out.status !== "uploaded" || !out.cloudDocId) {
|
|
979
998
|
dialog.showMessageBoxSync(win, { type: "error", message: "Couldn't move this plan to the cloud.", detail: r.stderr.trim() || "Are you signed in? Run `inplan login`." });
|
|
980
999
|
return;
|
|
@@ -43458,6 +43458,10 @@ var EN = {
|
|
|
43458
43458
|
"newdoc.linkExisting": "Link to it",
|
|
43459
43459
|
"newdoc.failed": "Couldn’t create the document.",
|
|
43460
43460
|
"newdoc.cantMove": "Can’t move this selection — it crosses formatting or a comment’s edge.",
|
|
43461
|
+
"newdoc.limitTitle": "Document limit reached",
|
|
43462
|
+
"newdoc.limitBody": "You’re at your {limit}-document limit. Deactivate the least-recently-used “{title}” to make room?",
|
|
43463
|
+
"newdoc.deactivateAndCreate": "Deactivate & create",
|
|
43464
|
+
"newdoc.limitCancelled": "Cancelled — no document was created.",
|
|
43461
43465
|
"topbar.cantOverlap": "Comments can't overlap",
|
|
43462
43466
|
"topbar.cantWhitespace": "Comments can't be added to white space",
|
|
43463
43467
|
"topbar.cantSpanBlocks": "Comments can't span multiple blocks",
|
|
@@ -44790,6 +44794,31 @@ function QuitDialog({
|
|
|
44790
44794
|
] })
|
|
44791
44795
|
] }) });
|
|
44792
44796
|
}
|
|
44797
|
+
function CapLimitDialog({
|
|
44798
|
+
limit,
|
|
44799
|
+
lruTitle,
|
|
44800
|
+
onConfirm,
|
|
44801
|
+
onCancel
|
|
44802
|
+
}) {
|
|
44803
|
+
const t2 = useT();
|
|
44804
|
+
const ref = reactExports.useRef(null);
|
|
44805
|
+
reactExports.useEffect(() => ref.current?.querySelector(".ap-link")?.focus(), []);
|
|
44806
|
+
reactExports.useEffect(() => {
|
|
44807
|
+
const onKey = (e) => {
|
|
44808
|
+
if (e.key === "Escape") onCancel();
|
|
44809
|
+
};
|
|
44810
|
+
document.addEventListener("keydown", onKey);
|
|
44811
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
44812
|
+
}, [onCancel]);
|
|
44813
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-modal-backdrop", onMouseDown: onCancel, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-modal ap-quit", role: "dialog", "aria-modal": "true", "aria-label": t2("newdoc.limitTitle"), ref, onMouseDown: (e) => e.stopPropagation(), children: [
|
|
44814
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-quit-title", children: t2("newdoc.limitTitle") }),
|
|
44815
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "ap-quit-body", children: t2("newdoc.limitBody", { limit, title: lruTitle }) }),
|
|
44816
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-quit-actions", children: [
|
|
44817
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-link", onClick: onCancel, children: t2("quit.cancel") }),
|
|
44818
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-primary", onClick: onConfirm, children: t2("newdoc.deactivateAndCreate") })
|
|
44819
|
+
] })
|
|
44820
|
+
] }) });
|
|
44821
|
+
}
|
|
44793
44822
|
var EditorErrorBoundary = class extends reactExports.Component {
|
|
44794
44823
|
state = { error: null };
|
|
44795
44824
|
static getDerivedStateFromError(error2) {
|
|
@@ -45459,6 +45488,10 @@ function App(props = {}) {
|
|
|
45459
45488
|
});
|
|
45460
45489
|
reactExports.useEffect(() => {
|
|
45461
45490
|
const onKey = (e) => {
|
|
45491
|
+
if (readOnly2 && (e.metaKey || e.ctrlKey) && !e.altKey && ["z", "Z", "/", "s", "S"].includes(e.key)) {
|
|
45492
|
+
e.preventDefault();
|
|
45493
|
+
return;
|
|
45494
|
+
}
|
|
45462
45495
|
if ((e.metaKey || e.ctrlKey) && (e.key === "z" || e.key === "Z")) {
|
|
45463
45496
|
const active = document.activeElement;
|
|
45464
45497
|
if (active?.closest(".ap-source") || active?.closest(".ap-ihunk-edit-ta")) return;
|
|
@@ -45490,7 +45523,7 @@ function App(props = {}) {
|
|
|
45490
45523
|
};
|
|
45491
45524
|
document.addEventListener("keydown", onKey);
|
|
45492
45525
|
return () => document.removeEventListener("keydown", onKey);
|
|
45493
|
-
}, [composer, findOpen, proposal, reviewOpen, undo2, redo2]);
|
|
45526
|
+
}, [composer, findOpen, proposal, reviewOpen, undo2, redo2, readOnly2]);
|
|
45494
45527
|
const agentLocked = mode.locksEditor && agentThinking;
|
|
45495
45528
|
const editingLocked = agentLocked || readOnly2;
|
|
45496
45529
|
const takeBackControl = reactExports.useCallback(() => {
|
|
@@ -45634,6 +45667,7 @@ function App(props = {}) {
|
|
|
45634
45667
|
setZoom((z2) => dir === 0 ? 1 : Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, +(z2 + dir * 0.1).toFixed(2))));
|
|
45635
45668
|
}, []);
|
|
45636
45669
|
const saveNow = reactExports.useCallback(() => {
|
|
45670
|
+
if (readOnly2) return;
|
|
45637
45671
|
const content2 = serialize(docRef.current);
|
|
45638
45672
|
const kind = mode.autosaveKind;
|
|
45639
45673
|
void hostApi().save(content2, { kind, cadence }).then(() => setCheckpoint(content2));
|
|
@@ -45642,7 +45676,7 @@ function App(props = {}) {
|
|
|
45642
45676
|
setDirty(false);
|
|
45643
45677
|
}
|
|
45644
45678
|
setStatus(kind === "canonical" ? "saved" : "checkpoint saved");
|
|
45645
|
-
}, [cadence, mode]);
|
|
45679
|
+
}, [cadence, mode, readOnly2]);
|
|
45646
45680
|
saveNowRef.current = saveNow;
|
|
45647
45681
|
const pendingAnswersRef = reactExports.useRef(/* @__PURE__ */ new Set());
|
|
45648
45682
|
const nudgedAnswersRef = reactExports.useRef(/* @__PURE__ */ new Set());
|
|
@@ -45671,6 +45705,11 @@ function App(props = {}) {
|
|
|
45671
45705
|
setStatus(t2("msg.turnFinished"));
|
|
45672
45706
|
}, [setQuestionPending]);
|
|
45673
45707
|
const [quitOpen, setQuitOpen] = reactExports.useState(false);
|
|
45708
|
+
const [capConfirm, setCapConfirm] = reactExports.useState(null);
|
|
45709
|
+
const askEvictLru = reactExports.useCallback(
|
|
45710
|
+
(limit, lruTitle) => new Promise((resolve) => setCapConfirm({ limit, lruTitle, resolve })),
|
|
45711
|
+
[]
|
|
45712
|
+
);
|
|
45674
45713
|
const [forceSettingsOpen, setForceSettingsOpen] = reactExports.useState(false);
|
|
45675
45714
|
const confirmQuit = reactExports.useCallback((opts) => {
|
|
45676
45715
|
realHostApi().exit?.quit(serialize(docRef.current), opts);
|
|
@@ -45788,12 +45827,24 @@ function App(props = {}) {
|
|
|
45788
45827
|
content2 = `# ${title}
|
|
45789
45828
|
`;
|
|
45790
45829
|
}
|
|
45791
|
-
const draftOpts = req.mode === "create" && opts.draftPrompt ? { draftPrompt: opts.draftPrompt } :
|
|
45792
|
-
|
|
45830
|
+
const draftOpts = req.mode === "create" && opts.draftPrompt ? { draftPrompt: opts.draftPrompt } : void 0;
|
|
45831
|
+
let res = draftOpts ? await api.newDoc.create(path, content2, draftOpts) : await api.newDoc.create(path, content2);
|
|
45832
|
+
if (res && res.status === "limit") {
|
|
45833
|
+
const ok2 = await askEvictLru(res.limit, res.lruTitle);
|
|
45834
|
+
if (!ok2) {
|
|
45835
|
+
setStatus(t2("newdoc.limitCancelled"));
|
|
45836
|
+
return;
|
|
45837
|
+
}
|
|
45838
|
+
res = await api.newDoc.create(path, content2, { ...draftOpts ?? {}, evictLru: true });
|
|
45839
|
+
}
|
|
45793
45840
|
if (!res) {
|
|
45794
45841
|
setStatus(t2("newdoc.failed"));
|
|
45795
45842
|
return;
|
|
45796
45843
|
}
|
|
45844
|
+
if (res.status === "limit") {
|
|
45845
|
+
setStatus(t2("newdoc.failed"));
|
|
45846
|
+
return;
|
|
45847
|
+
}
|
|
45797
45848
|
if (res.status === "exists") {
|
|
45798
45849
|
setNewDocReq({ ...req, existing: res.linkTarget });
|
|
45799
45850
|
setStatus(t2("newdoc.exists"));
|
|
@@ -46321,6 +46372,21 @@ function App(props = {}) {
|
|
|
46321
46372
|
}
|
|
46322
46373
|
),
|
|
46323
46374
|
quitOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(QuitDialog, { onQuit: confirmQuit, onCancel: () => setQuitOpen(false) }),
|
|
46375
|
+
capConfirm && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46376
|
+
CapLimitDialog,
|
|
46377
|
+
{
|
|
46378
|
+
limit: capConfirm.limit,
|
|
46379
|
+
lruTitle: capConfirm.lruTitle,
|
|
46380
|
+
onConfirm: () => {
|
|
46381
|
+
capConfirm.resolve(true);
|
|
46382
|
+
setCapConfirm(null);
|
|
46383
|
+
},
|
|
46384
|
+
onCancel: () => {
|
|
46385
|
+
capConfirm.resolve(false);
|
|
46386
|
+
setCapConfirm(null);
|
|
46387
|
+
}
|
|
46388
|
+
}
|
|
46389
|
+
),
|
|
46324
46390
|
newDocReq && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46325
46391
|
NewDocModal,
|
|
46326
46392
|
{
|
|
@@ -46712,7 +46778,7 @@ function TopBar(props) {
|
|
|
46712
46778
|
)
|
|
46713
46779
|
] }),
|
|
46714
46780
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-iconrow", role: "group", "aria-label": "save and turn", children: [
|
|
46715
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "ap-iconbtn", onClick: props.onSave, title: props.dirty ? t2("topbar.saveUnsaved") : t2("topbar.save"), "aria-label": t2("topbar.save"), children: [
|
|
46781
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "ap-iconbtn", onClick: props.onSave, disabled: props.locked, title: props.dirty ? t2("topbar.saveUnsaved") : t2("topbar.save"), "aria-label": t2("topbar.save"), children: [
|
|
46716
46782
|
/* @__PURE__ */ jsxRuntimeExports.jsx(IconSave, {}),
|
|
46717
46783
|
props.dirty && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-dirty", "aria-hidden": "true" })
|
|
46718
46784
|
] }),
|
|
@@ -356,6 +356,7 @@ input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outlin
|
|
|
356
356
|
.ap-newdoc-path input { flex: 1; }
|
|
357
357
|
.ap-newdoc-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 4px; }
|
|
358
358
|
.ap-quit-title { font-weight: 600; font-size: 15px; margin-bottom: 12px; }
|
|
359
|
+
.ap-quit-body { font-size: 13px; line-height: 1.5; margin: 0 0 14px; color: var(--ink-soft, inherit); }
|
|
359
360
|
.ap-quit-opts { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
|
|
360
361
|
.ap-quit-opt { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
|
|
361
362
|
.ap-quit-actions { display: flex; justify-content: flex-end; gap: 10px; align-items: center; }
|
package/app/renderer/index.html
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
content="default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' inplan-plugin:; connect-src 'self' inplan-plugin: ws://127.0.0.1:* ws://localhost:*; frame-src https://inplan.ai http://127.0.0.1:* http://localhost:*"
|
|
12
12
|
/>
|
|
13
13
|
<title>inplan</title>
|
|
14
|
-
<script type="module" crossorigin src="./assets/index-
|
|
15
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
14
|
+
<script type="module" crossorigin src="./assets/index-BDWDaguV.js"></script>
|
|
15
|
+
<link rel="stylesheet" crossorigin href="./assets/index-Ch7xZBdu.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
18
18
|
<div id="root"></div>
|
package/bin/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import { createRequire } from "module";
|
|
|
7
7
|
import { appendFileSync as appendFileSync2, copyFileSync, existsSync as existsSync9, mkdirSync as mkdirSync8, readdirSync as readdirSync2, readFileSync as readFileSync9, realpathSync, renameSync, statSync as statSync2, writeFileSync as writeFileSync8 } from "fs";
|
|
8
8
|
import { homedir as homedir6 } from "os";
|
|
9
9
|
import { basename as basename3, dirname as dirname9, isAbsolute as isAbsolute2, join as join9, relative as relative4, resolve as resolve3 } from "path";
|
|
10
|
-
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
10
|
+
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "url";
|
|
11
11
|
|
|
12
12
|
// ../core/dist/chunk-2A42CIA7.js
|
|
13
13
|
function isReply(c) {
|
|
@@ -2116,13 +2116,40 @@ async function doUpload(file, args) {
|
|
|
2116
2116
|
const repo = getFlag(args, "repo") ?? prov.repo;
|
|
2117
2117
|
const path = getFlag(args, "path") ?? prov.path;
|
|
2118
2118
|
const title = firstHeading(body) ?? basename3(path);
|
|
2119
|
-
const { data:
|
|
2120
|
-
|
|
2119
|
+
const { data: res, error: de } = await s.db.rpc("create_document", {
|
|
2120
|
+
p_org: pick.org_id,
|
|
2121
|
+
p_repo: repo,
|
|
2122
|
+
p_path: path,
|
|
2123
|
+
p_title: title,
|
|
2124
|
+
p_body: body,
|
|
2125
|
+
p_draft_pending: false,
|
|
2126
|
+
p_evict_lru: hasFlag(args, "evict-lru")
|
|
2127
|
+
});
|
|
2128
|
+
const out0 = res;
|
|
2129
|
+
if (de || !out0) {
|
|
2121
2130
|
process.stderr.write(`inplan upload: ${de?.message ?? "could not create the cloud document"}
|
|
2122
2131
|
`);
|
|
2123
2132
|
process.exit(1);
|
|
2124
2133
|
}
|
|
2125
|
-
|
|
2134
|
+
if (out0.status === "limit") {
|
|
2135
|
+
output({ status: "limit", limit: out0.limit ?? 0, lru: { id: out0.lru_id ?? "", title: out0.lru_title ?? "" } });
|
|
2136
|
+
return;
|
|
2137
|
+
}
|
|
2138
|
+
let cloudDocId;
|
|
2139
|
+
if (out0.status === "exists") {
|
|
2140
|
+
const { data: ex } = await s.db.from("documents").select("id").eq("org_id", pick.org_id).eq("repo", repo).eq("path", path).maybeSingle();
|
|
2141
|
+
const exId = ex?.id;
|
|
2142
|
+
if (!exId) {
|
|
2143
|
+
process.stderr.write("inplan upload: a document already exists at this path but could not be resolved\n");
|
|
2144
|
+
process.exit(1);
|
|
2145
|
+
}
|
|
2146
|
+
cloudDocId = exId;
|
|
2147
|
+
} else if (out0.status === "created" && out0.id) {
|
|
2148
|
+
cloudDocId = out0.id;
|
|
2149
|
+
} else {
|
|
2150
|
+
process.stderr.write("inplan upload: could not create the cloud document\n");
|
|
2151
|
+
process.exit(1);
|
|
2152
|
+
}
|
|
2126
2153
|
const status = {
|
|
2127
2154
|
location: "cloud",
|
|
2128
2155
|
cloudDocId,
|
|
@@ -2200,7 +2227,7 @@ async function main() {
|
|
|
2200
2227
|
);
|
|
2201
2228
|
if (!cmd || !["open", "wait", "signal", "message", "relay", "status", "promote", "demote", "upload"].includes(cmd)) {
|
|
2202
2229
|
process.stderr.write(
|
|
2203
|
-
'usage: inplan <open|wait|signal> <file|--remote DOC_ID> [--model NAME] [--cursor N] [--confirmed-comment-deletion=a,b] [--done] [--reload]\n inplan message <file> "your message" (relay a note to the editor status bar)\n inplan relay [--hook <kind> | --text <s> [--activity]] (agent-hook \u2192 editor; resolves the active doc)\n inplan status <file>\n inplan upload <file> [--org <slug>] [--repo <name>] [--path <p>] (Collaborate on Cloud)\n inplan promote <file> --cloud-doc <docId> [--locator org/repo/path]\n inplan demote <file>\n inplan login (opens the browser to sign in; or --url <url> --anon <key> --refresh <token> for scripts)\n inplan whoami | logout\n'
|
|
2230
|
+
'usage: inplan <open|wait|signal> <file|--remote DOC_ID> [--model NAME] [--cursor N] [--confirmed-comment-deletion=a,b] [--done] [--reload]\n inplan message <file> "your message" (relay a note to the editor status bar)\n inplan relay [--hook <kind> | --text <s> [--activity]] (agent-hook \u2192 editor; resolves the active doc)\n inplan status <file>\n inplan upload <file> [--org <slug>] [--repo <name>] [--path <p>] [--evict-lru] (Collaborate on Cloud)\n inplan promote <file> --cloud-doc <docId> [--locator org/repo/path]\n inplan demote <file>\n inplan login (opens the browser to sign in; or --url <url> --anon <key> --refresh <token> for scripts)\n inplan whoami | logout\n'
|
|
2204
2231
|
);
|
|
2205
2232
|
process.exit(64);
|
|
2206
2233
|
}
|
|
@@ -2305,13 +2332,25 @@ async function main() {
|
|
|
2305
2332
|
}
|
|
2306
2333
|
await waitCycle(fsBackend(file), explicitCursor, confirmed, model, gate);
|
|
2307
2334
|
}
|
|
2308
|
-
|
|
2309
|
-
process.
|
|
2335
|
+
function isProgramEntry() {
|
|
2336
|
+
const argv1 = process.argv[1];
|
|
2337
|
+
if (!argv1) return false;
|
|
2338
|
+
try {
|
|
2339
|
+
return import.meta.url === pathToFileURL2(realpathSync(argv1)).href;
|
|
2340
|
+
} catch {
|
|
2341
|
+
return import.meta.url === pathToFileURL2(argv1).href;
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
if (isProgramEntry()) {
|
|
2345
|
+
main().catch((err) => {
|
|
2346
|
+
process.stderr.write(`inplan: ${err.message}
|
|
2310
2347
|
`);
|
|
2311
|
-
|
|
2312
|
-
});
|
|
2348
|
+
process.exit(1);
|
|
2349
|
+
});
|
|
2350
|
+
}
|
|
2313
2351
|
export {
|
|
2314
2352
|
activeDocForCwd,
|
|
2353
|
+
doUpload,
|
|
2315
2354
|
notesFromHook,
|
|
2316
2355
|
transcriptTextBlocks
|
|
2317
2356
|
};
|