inplan 0.3.5 → 0.3.7
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
|
@@ -125,6 +125,22 @@ function parseLogLine(line) {
|
|
|
125
125
|
function parseLog(text) {
|
|
126
126
|
return text.split("\n").map((l) => l.trim()).filter((l) => l.length > 0).map(parseLogLine);
|
|
127
127
|
}
|
|
128
|
+
function draftPendingFrom(entries) {
|
|
129
|
+
let model = null;
|
|
130
|
+
for (const e of entries) {
|
|
131
|
+
if (e.type === LogEventType.DraftPending) {
|
|
132
|
+
const m = e.payload?.model;
|
|
133
|
+
model = typeof m === "string" && m.trim() ? m : null;
|
|
134
|
+
} else if (e.actor === "agent" && (e.type === LogEventType.DocumentEdited || e.type === LogEventType.AgentRevisionProposed)) {
|
|
135
|
+
model = null;
|
|
136
|
+
} else if (e.type === LogEventType.SessionClosed) {
|
|
137
|
+
model = null;
|
|
138
|
+
} else if (e.actor === "user" && (e.type === LogEventType.DocumentEdited || e.type === LogEventType.TurnEnded)) {
|
|
139
|
+
model = null;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return model ? { model } : null;
|
|
143
|
+
}
|
|
128
144
|
function mintProposalId() {
|
|
129
145
|
const c = globalThis.crypto;
|
|
130
146
|
if (c?.randomUUID) return c.randomUUID();
|
|
@@ -712,28 +728,10 @@ class Session {
|
|
|
712
728
|
}
|
|
713
729
|
}
|
|
714
730
|
}
|
|
715
|
-
/** The model an agent named when it created this document
|
|
716
|
-
*
|
|
717
|
-
* whatever ends that expectation — not only the draft arriving (as an edit, or parked as a
|
|
718
|
-
* proposal), but the session it was raised in closing, or the human saving the document.
|
|
719
|
-
* Otherwise an agent that died before writing, or a page the human later cleared, would bring the
|
|
720
|
-
* banner back on some later open with no agent anywhere. */
|
|
731
|
+
/** The model an agent named when it created this document, while its first draft is still to come
|
|
732
|
+
* (see draftPendingFrom in @inplan/core, which the CLI's tests drive with a real `inplan open`). */
|
|
721
733
|
draftPending() {
|
|
722
|
-
|
|
723
|
-
let model = null;
|
|
724
|
-
for (const e of entries) {
|
|
725
|
-
if (e.type === LogEventType.DraftPending) {
|
|
726
|
-
const m = e.payload?.model;
|
|
727
|
-
model = typeof m === "string" && m.trim() ? m : null;
|
|
728
|
-
} else if (e.actor === "agent" && (e.type === LogEventType.DocumentEdited || e.type === LogEventType.AgentRevised || e.type === LogEventType.AgentRevisionProposed)) {
|
|
729
|
-
model = null;
|
|
730
|
-
} else if (e.type === LogEventType.SessionClosed) {
|
|
731
|
-
model = null;
|
|
732
|
-
} else if (e.actor === "user" && (e.type === LogEventType.DocumentEdited || e.type === LogEventType.TurnEnded)) {
|
|
733
|
-
model = null;
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
return model ? { model } : null;
|
|
734
|
+
return draftPendingFrom(readLog(this.paths.logPath));
|
|
737
735
|
}
|
|
738
736
|
async load() {
|
|
739
737
|
const pendingDraft = this.draftPending();
|
|
@@ -1204,7 +1202,7 @@ function startCloudSignIn(cloudBase, timeoutMs = 5 * 6e4) {
|
|
|
1204
1202
|
const __dirname$1 = node_path.dirname(node_url.fileURLToPath(require("url").pathToFileURL(__filename).href));
|
|
1205
1203
|
widenConnectAttemptBudget();
|
|
1206
1204
|
registerPluginScheme();
|
|
1207
|
-
const pluginToken = () => runCli(["token"]).then((r) => {
|
|
1205
|
+
const pluginToken = () => runCli(["token"], void 0, 15e3).then((r) => {
|
|
1208
1206
|
try {
|
|
1209
1207
|
return JSON.parse(r.stdout.trim() || "{}").token ?? null;
|
|
1210
1208
|
} catch {
|
|
@@ -1229,7 +1227,7 @@ function resolveTargetFile() {
|
|
|
1229
1227
|
return node_fs.existsSync(abs) ? abs : null;
|
|
1230
1228
|
}
|
|
1231
1229
|
const nav = createNavTracker();
|
|
1232
|
-
const pluginRefreshes = createSerialQueue((err) => console.error("[inplan] refreshing the plugin
|
|
1230
|
+
const pluginRefreshes = createSerialQueue((err) => console.error("[inplan] starting or refreshing the plugin failed", err));
|
|
1233
1231
|
let session = null;
|
|
1234
1232
|
let win = null;
|
|
1235
1233
|
let stopWatching = null;
|
|
@@ -1749,7 +1747,9 @@ ${body.replace(/\s*$/, "")}
|
|
|
1749
1747
|
});
|
|
1750
1748
|
electron.ipcMain.handle("i18n:get", () => i18n.getSnapshot());
|
|
1751
1749
|
electron.ipcMain.handle("i18n:set-locale", (_e, code) => i18n.setLocale(code));
|
|
1752
|
-
electron.ipcMain.handle("plugin:info", () => {
|
|
1750
|
+
electron.ipcMain.handle("plugin:info", async () => {
|
|
1751
|
+
await pluginRefreshes.run(async () => {
|
|
1752
|
+
});
|
|
1753
1753
|
const info = pluginInfo();
|
|
1754
1754
|
nav.rendererActivated(info !== null);
|
|
1755
1755
|
return info;
|
|
@@ -1764,8 +1764,7 @@ void electron.app.whenReady().then(async () => {
|
|
|
1764
1764
|
session.logEditorPid(process.pid);
|
|
1765
1765
|
navHistory.push(target);
|
|
1766
1766
|
navIdx = 0;
|
|
1767
|
-
|
|
1768
|
-
nav.rendererActivated(pluginInfo() !== null);
|
|
1767
|
+
void pluginRefreshes.run(() => startDesktopPlugin(target, pluginToken));
|
|
1769
1768
|
track("app_opened", session.getSettings().telemetry === true);
|
|
1770
1769
|
}
|
|
1771
1770
|
registerIpc();
|
package/app/preload/index.mjs
CHANGED
|
@@ -49,6 +49,10 @@ function createI18nController() {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
+
let lastUpdate = null;
|
|
53
|
+
ipcRenderer.on("app:update-available", (_e, info) => {
|
|
54
|
+
lastUpdate = info;
|
|
55
|
+
});
|
|
52
56
|
const api = {
|
|
53
57
|
load: () => ipcRenderer.invoke("doc:load"),
|
|
54
58
|
save: (content, options) => ipcRenderer.invoke("doc:save", content, options),
|
|
@@ -130,6 +134,7 @@ const api = {
|
|
|
130
134
|
onUpdateAvailable: (cb) => {
|
|
131
135
|
const h = (_e, info) => cb(info);
|
|
132
136
|
ipcRenderer.on("app:update-available", h);
|
|
137
|
+
if (lastUpdate) cb(lastUpdate);
|
|
133
138
|
return () => ipcRenderer.removeListener("app:update-available", h);
|
|
134
139
|
},
|
|
135
140
|
applyUpdate: () => ipcRenderer.invoke("app:apply-update"),
|
|
@@ -48662,12 +48662,15 @@ function Shell() {
|
|
|
48662
48662
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(AppRoot, {}, epoch);
|
|
48663
48663
|
}
|
|
48664
48664
|
async function bootstrap() {
|
|
48665
|
+
const el2 = document.getElementById("root");
|
|
48666
|
+
if (!el2) return;
|
|
48667
|
+
const root = createRoot(el2);
|
|
48668
|
+
root.render(
|
|
48669
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-loading", role: "status", "aria-label": "Loading", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-spinner", "aria-hidden": "true" }) })
|
|
48670
|
+
);
|
|
48665
48671
|
await plugin.activate();
|
|
48666
|
-
|
|
48667
|
-
|
|
48668
|
-
|
|
48669
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(React.StrictMode, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Shell, {}) })
|
|
48670
|
-
);
|
|
48671
|
-
}
|
|
48672
|
+
root.render(
|
|
48673
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(React.StrictMode, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Shell, {}) })
|
|
48674
|
+
);
|
|
48672
48675
|
}
|
|
48673
48676
|
void bootstrap();
|
package/app/renderer/index.html
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
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-
|
|
24
|
+
<script type="module" crossorigin src="./assets/index-Dm0uGzyR.js"></script>
|
|
25
25
|
<link rel="stylesheet" crossorigin href="./assets/index-DziuyBKZ.css">
|
|
26
26
|
</head>
|
|
27
27
|
<body>
|
package/bin/cli.js
CHANGED
|
@@ -9,7 +9,7 @@ import { homedir as homedir7 } from "os";
|
|
|
9
9
|
import { basename as basename3, dirname as dirname11, extname, isAbsolute as isAbsolute2, join as join10, relative as relative4, resolve as resolve3 } from "path";
|
|
10
10
|
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "url";
|
|
11
11
|
|
|
12
|
-
// ../core/dist/chunk-
|
|
12
|
+
// ../core/dist/chunk-SJGNSLZ2.js
|
|
13
13
|
function isReply(c) {
|
|
14
14
|
return c.parentId !== void 0;
|
|
15
15
|
}
|