inplan 0.1.12 → 0.1.14

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.
@@ -43568,6 +43568,8 @@ var EN = {
43568
43568
  "agent.plan": "Plan {pct}%",
43569
43569
  "agent.overIncluded": "— over included",
43570
43570
  "agent.over": "(over)",
43571
+ "agent.nearLimit": "Approaching your usage limit",
43572
+ "agent.atLimit": "Usage limit reached — turns are paused until your plan resets or you upgrade",
43571
43573
  "agent.connection": "Agent connection",
43572
43574
  "agent.localCmdHint": "Paste this to your coding agent:",
43573
43575
  "agent.localCmdBody": "Collaborate with me on my inplan plan. Check the CLI with `inplan --version` (if missing, install it: `npm i -g inplan`), sign in with `inplan login`, then run `{cmd}` and work with me through the comments.",
@@ -44558,6 +44560,7 @@ function AgentIndicator({
44558
44560
  }
44559
44561
  const label = labelFor(location, model);
44560
44562
  const quotaText = quota ? ` · ${Math.round(quota.usedPct * 100)}%${quota.overage ? ` ${t2("agent.over")}` : ""}` : "";
44563
+ const quotaWarn = quota && !quota.overage ? quota.usedPct >= 1 ? "at" : quota.usedPct >= 0.8 ? "near" : null : null;
44561
44564
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-agent", ref, children: [
44562
44565
  /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "ap-agent-btn", title: `${t2("agent.title", { label })}${quotaText}`, "aria-label": t2("agent.connectionLabel", { label }), "aria-expanded": open, onClick: () => setOpen((v2) => !v2), children: [
44563
44566
  icon,
@@ -44566,7 +44569,8 @@ function AgentIndicator({
44566
44569
  open && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-agent-menu", role: "menu", children: [
44567
44570
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-agent-detail", children: [
44568
44571
  location ? `${t2("agent.detail", { where: location === "cloud" ? t2("agent.whereCloud") : t2("agent.whereLocal") })}${model ? ` · ${model}` : ""}` : t2("agent.none"),
44569
- quota && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-agent-quota", children: `${t2("agent.plan", { pct: Math.round(quota.usedPct * 100) })}${quota.overage ? ` ${t2("agent.overIncluded")}` : ""}` })
44572
+ quota && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-agent-quota", children: `${t2("agent.plan", { pct: Math.round(quota.usedPct * 100) })}${quota.overage ? ` ${t2("agent.overIncluded")}` : ""}` }),
44573
+ quotaWarn && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `ap-agent-quota-warn ap-agent-quota-${quotaWarn}`, role: "status", children: t2(quotaWarn === "at" ? "agent.atLimit" : "agent.nearLimit") })
44570
44574
  ] }),
44571
44575
  policy && onSetPolicy && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-agent-policy", role: "radiogroup", "aria-label": t2("agent.connection"), children: POLICY_OPTIONS.map((o) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
44572
44576
  "button",
@@ -46315,16 +46319,7 @@ function App(props = {}) {
46315
46319
  }
46316
46320
  ),
46317
46321
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-main", style: { zoom }, children: [
46318
- sidePanels.length > 0 && !activePanel && !closingPanel && /* @__PURE__ */ jsxRuntimeExports.jsx(
46319
- "button",
46320
- {
46321
- className: "ap-sidepanel-bump",
46322
- title: sidePanels[0].title,
46323
- "aria-label": sidePanels[0].title,
46324
- onClick: () => setOpenPanel(sidePanels[0].id),
46325
- children: sidePanels[0].icon ?? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-iconbtn-fallback", children: sidePanels[0].title.slice(0, 1) })
46326
- }
46327
- ),
46322
+ sidePanels.length > 0 && !activePanel && !closingPanel && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-sidepanel-bumps", children: sidePanels.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-sidepanel-bump", title: p2.title, "aria-label": p2.title, onClick: () => setOpenPanel(p2.id), children: p2.icon ?? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-iconbtn-fallback", children: p2.title.slice(0, 1) }) }, p2.id)) }),
46328
46323
  (activePanel || closingPanel) && /* @__PURE__ */ jsxRuntimeExports.jsx(
46329
46324
  "aside",
46330
46325
  {
@@ -130,6 +130,9 @@ body {
130
130
  .ap-agent-menu { position: absolute; top: 34px; right: 0; z-index: 40; width: 220px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 8px; }
131
131
  .ap-agent-detail { font-size: 12px; padding: 2px 6px 6px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
132
132
  .ap-agent-quota { font-size: 11px; color: var(--muted); margin-top: 2px; }
133
+ .ap-agent-quota-warn { font-size: 11px; margin-top: 4px; line-height: 1.35; }
134
+ .ap-agent-quota-near { color: #b7791f; }
135
+ .ap-agent-quota-at { color: #c0392b; font-weight: 600; }
133
136
  .ap-agent-policy { display: flex; flex-direction: column; gap: 2px; }
134
137
  .ap-agent-policy-opt { display: flex; align-items: center; gap: 7px; text-align: left; border: 0; background: none; padding: 5px 6px; font: inherit; font-size: 12px; cursor: pointer; border-radius: 6px; color: var(--muted); }
135
138
  .ap-agent-policy-opt:hover { background: var(--accent-soft); }
@@ -181,8 +184,8 @@ body {
181
184
  /* main layout */
182
185
  .ap-main { flex: 1; display: flex; min-height: 0; position: relative; }
183
186
  /* "Bump" handle on the preview's top-left that reveals a host side panel (e.g. the TOC). */
187
+ .ap-sidepanel-bumps { position: absolute; top: 12px; left: 0; z-index: 20; display: flex; flex-direction: column; gap: 8px; }
184
188
  .ap-sidepanel-bump {
185
- position: absolute; top: 12px; left: 0; z-index: 20;
186
189
  display: inline-flex; align-items: center; justify-content: center;
187
190
  width: 20px; height: 38px; padding: 0;
188
191
  border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 9px 9px 0;
@@ -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-mE-gsS63.js"></script>
15
- <link rel="stylesheet" crossorigin href="./assets/index-DOP9u7n4.css">
14
+ <script type="module" crossorigin src="./assets/index-B5mCdcn1.js"></script>
15
+ <link rel="stylesheet" crossorigin href="./assets/index-Hw2I1zYD.css">
16
16
  </head>
17
17
  <body>
18
18
  <div id="root"></div>
package/bin/cli.js CHANGED
@@ -663,8 +663,16 @@ var SupabaseControlChannel = class {
663
663
  db;
664
664
  docId;
665
665
  consumerId;
666
- async append(event) {
667
- const { data, error } = await this.db.from("events").insert({ doc_id: this.docId, actor: event.actor, type: event.type, payload: event.payload ?? null }).select("seq, ts, actor, type, payload").single();
666
+ async append(event, opts) {
667
+ const { data, error } = await this.db.from("events").insert({
668
+ doc_id: this.docId,
669
+ actor: event.actor,
670
+ type: event.type,
671
+ payload: event.payload ?? null,
672
+ // Only set user_id when attributed — older deployments may not have the column, and an
673
+ // unattributed (agent-internal) event leaves it null.
674
+ ...opts?.userId ? { user_id: opts.userId } : {}
675
+ }).select("seq, ts, actor, type, payload").single();
668
676
  if (error) throw new Error(`append failed: ${error.message}`);
669
677
  return rowToEntry(data);
670
678
  }
@@ -745,10 +753,29 @@ var SupabaseDocumentStore = class {
745
753
  async clearProposed() {
746
754
  await this.writeColumns({ proposed: null });
747
755
  }
748
- async backup(content) {
749
- const { error } = await this.db.from("doc_versions").insert({ doc_id: this.docId, body: content });
756
+ async backup(content, meta) {
757
+ const { data: latest } = await this.db.from("doc_versions").select("body").eq("doc_id", this.docId).order("created_at", { ascending: false }).order("id", { ascending: false }).limit(1).maybeSingle();
758
+ if (latest?.body === content) return;
759
+ const row = { doc_id: this.docId, body: content };
760
+ if (meta?.actor) row.actor = meta.actor;
761
+ if (meta?.kind) row.kind = meta.kind;
762
+ if (meta?.author) row.author = meta.author;
763
+ const { error } = await this.db.from("doc_versions").insert(row);
750
764
  if (error) throw new Error(`backup failed: ${error.message}`);
751
765
  }
766
+ /** Recent version checkpoints (newest first), metadata only — for a history list. */
767
+ async listVersions(limit = 50) {
768
+ const { data, error } = await this.db.from("doc_versions").select("id, created_at, actor, kind, author").eq("doc_id", this.docId).order("created_at", { ascending: false }).order("id", { ascending: false }).limit(limit);
769
+ if (error) throw new Error(`listVersions failed: ${error.message}`);
770
+ return data ?? [];
771
+ }
772
+ /** The body of one version (scoped to this doc), or null if it no longer exists. */
773
+ async getVersion(id) {
774
+ const { data, error } = await this.db.from("doc_versions").select("body").eq("id", id).eq("doc_id", this.docId).maybeSingle();
775
+ if (error) throw new Error(`getVersion failed: ${error.message}`);
776
+ const body = data?.body;
777
+ return typeof body === "string" ? body : null;
778
+ }
752
779
  async readColumn(name) {
753
780
  const { data, error } = await this.db.from("documents").select(name).eq("id", this.docId).maybeSingle();
754
781
  if (error) throw new Error(`read ${name} failed: ${error.message}`);
@@ -1213,17 +1240,39 @@ function hasFlag(args, name) {
1213
1240
  }
1214
1241
  var debounceMs = Number(process.env.INPLAN_DEBOUNCE_MS ?? 3e3);
1215
1242
  var pollMs = Number(process.env.INPLAN_POLL_MS ?? 200);
1243
+ function electronDistRel(platform) {
1244
+ if (platform === "win32") return "electron.exe";
1245
+ if (platform === "darwin") return join9("Electron.app", "Contents", "MacOS", "Electron");
1246
+ return "electron";
1247
+ }
1248
+ function electronBinaryFromDisk(reqUrl) {
1249
+ try {
1250
+ const pkgDir = dirname9(createRequire(reqUrl).resolve("electron/package.json"));
1251
+ const rel = electronDistRel(process.platform);
1252
+ const bin = join9(pkgDir, "dist", rel);
1253
+ if (!existsSync9(bin)) return null;
1254
+ try {
1255
+ const pathFile = join9(pkgDir, "path.txt");
1256
+ if (!existsSync9(pathFile)) writeFileSync8(pathFile, rel);
1257
+ } catch {
1258
+ }
1259
+ return bin;
1260
+ } catch {
1261
+ return null;
1262
+ }
1263
+ }
1216
1264
  function resolveBundledApp() {
1217
1265
  const here = dirname9(fileURLToPath2(import.meta.url));
1218
1266
  const appMain = join9(here, "..", "app", "main", "index.js");
1219
1267
  if (!existsSync9(appMain)) return { appMain: null };
1220
1268
  try {
1221
1269
  const electron = createRequire(import.meta.url)("electron");
1222
- if (typeof electron === "string" && electron) return { electron, appMain };
1223
- return { appMain, error: "the electron dependency did not resolve to a runtime path" };
1224
- } catch (e) {
1225
- return { appMain, error: e instanceof Error ? e.message : String(e) };
1270
+ if (typeof electron === "string" && electron && existsSync9(electron)) return { electron, appMain };
1271
+ } catch {
1226
1272
  }
1273
+ const onDisk = electronBinaryFromDisk(import.meta.url);
1274
+ if (onDisk) return { electron: onDisk, appMain };
1275
+ return { appMain, error: "Electron's binary isn't installed \u2014 its download was likely blocked (proxy/AV), and path.txt is missing" };
1227
1276
  }
1228
1277
  function spawnApp(file) {
1229
1278
  const env = { ...process.env, INPLAN_CLI: process.argv[1] ?? "" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inplan",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
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": {