inplan 0.1.26 → 0.1.28

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.
@@ -400,32 +400,42 @@ async function fetchAndCache(bundleUrl, leaseToken, opts) {
400
400
  fs.writeFileSync(path.join(opts.cacheDir, "current.txt"), manifest.version);
401
401
  return manifest.version;
402
402
  }
403
- async function resolveDesktopPlugin(options) {
403
+ async function resolvePluginOutcome(options) {
404
404
  const publicKey = options.publicKey ?? PLUGIN_PUBLIC_KEY;
405
405
  const now = options.now ?? Date.now();
406
406
  const fetchImpl = options.fetchImpl ?? fetch;
407
- if (!publicKey) return null;
407
+ const cached = () => {
408
+ try {
409
+ const current = fs.readFileSync(path.join(options.cacheDir, "current.txt"), "utf8").trim();
410
+ const plugin = current ? loadCached(options.cacheDir, current, publicKey, now) : null;
411
+ return plugin ? { plugin, reason: null } : { plugin: null, reason: "unavailable" };
412
+ } catch {
413
+ return { plugin: null, reason: "unavailable" };
414
+ }
415
+ };
416
+ if (!publicKey) return { plugin: null, reason: "unavailable" };
408
417
  if (options.token) {
409
418
  try {
410
419
  const res = await fetchImpl(`${base(options.apiBase)}api/v1/desktop-plugin`, { headers: { authorization: `Bearer ${options.token}` } });
411
420
  if (res.ok) {
412
421
  const grant = await res.json();
413
- if (grant.entitled === false) return null;
422
+ if (grant.entitled === false) return { plugin: null, reason: "unentitled" };
414
423
  if (grant.entitled && grant.lease && grant.bundleUrl) {
415
- if (!verifyLease(grant.lease, publicKey, now)) return null;
424
+ if (!verifyLease(grant.lease, publicKey, now)) return { plugin: null, reason: "unavailable" };
416
425
  const version = await fetchAndCache(grant.bundleUrl, grant.lease, { cacheDir: options.cacheDir, publicKey, fetchImpl });
417
- if (version) return loadCached(options.cacheDir, version, publicKey, now);
426
+ if (version) {
427
+ const plugin = loadCached(options.cacheDir, version, publicKey, now);
428
+ if (plugin) return { plugin, reason: null };
429
+ }
418
430
  }
419
431
  }
420
432
  } catch {
421
433
  }
422
434
  }
423
- try {
424
- const current = fs.readFileSync(path.join(options.cacheDir, "current.txt"), "utf8").trim();
425
- return current ? loadCached(options.cacheDir, current, publicKey, now) : null;
426
- } catch {
427
- return null;
428
- }
435
+ return cached();
436
+ }
437
+ async function resolveDesktopPlugin(options) {
438
+ return (await resolvePluginOutcome(options)).plugin;
429
439
  }
430
440
  const MAX_BACKUPS = 25;
431
441
  class Session {
@@ -134,6 +134,12 @@ body {
134
134
  .ap-agent-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
135
135
  .ap-agent-local { background: #2bb673; } /* agent on your machine */
136
136
  .ap-agent-off { background: var(--danger); } /* no agent connected */
137
+ /* Agent holds the turn. A turn-based local agent drops its presence socket while it works, so this
138
+ covers the window where "no peer" means "busy", not "gone" — amber, and pulsing so it reads as
139
+ activity rather than a warning. */
140
+ .ap-agent-working { background: #e0a23b; animation: ap-agent-pulse 1.6s ease-in-out infinite; }
141
+ @keyframes ap-agent-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
142
+ @media (prefers-reduced-motion: reduce) { .ap-agent-working { animation: none; } }
137
143
  .ap-agent-pie { position: relative; width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; }
138
144
  /* Green "connected" core; only the thin outer band of .ap-agent-pie shows the usage conic. The
139
145
  1px box-shadow ring is the button's background colour, leaving a 1px gap between the core and the
@@ -162,6 +168,10 @@ body {
162
168
  .ap-agent-localcmd-msg { flex: 1; min-width: 0; font-size: 11px; line-height: 1.45; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; color: var(--fg); user-select: text; -webkit-user-select: text; }
163
169
  .ap-agent-localcmd-copy { flex: 0 0 auto; border: 1px solid var(--line-strong); background: var(--bg); border-radius: 6px; padding: 0 9px; font: inherit; font-size: 11px; cursor: pointer; color: var(--fg); }
164
170
  .ap-agent-localcmd-copy:hover { background: var(--accent-soft); }
171
+ /* Same slot as the connect command, when the plan doesn't include a local agent here. */
172
+ .ap-agent-upsell .ap-agent-localcmd-hint { color: var(--fg); line-height: 1.45; }
173
+ .ap-agent-upgrade { width: 100%; border: 1px solid var(--accent); background: var(--accent); color: #fbfaf6; border-radius: 6px; padding: 5px 9px; font: inherit; font-size: 11px; cursor: pointer; }
174
+ .ap-agent-upgrade:hover { filter: brightness(1.06); }
165
175
 
166
176
  .ap-topbar button, .ap-tabs button { font: inherit; }
167
177
  .ap-topbar > button { border: 1px solid var(--line-strong); background: var(--bg); border-radius: 7px; padding: 4px 12px; cursor: pointer; color: var(--fg); }
@@ -43594,12 +43594,15 @@ var EN = {
43594
43594
  "agent.dontConnect": "Don't auto-connect",
43595
43595
  "agent.remote": "remote",
43596
43596
  "agent.local": "local",
43597
+ "agent.working": "working",
43597
43598
  "agent.disconnected": "disconnected",
43598
43599
  "agent.title": "Agent: {label}",
43599
43600
  "agent.connectionLabel": "Agent connection — {label}",
43600
43601
  "agent.whereCloud": "cloud",
43601
43602
  "agent.whereLocal": "your machine",
43602
43603
  "agent.detail": "Agent · {where}",
43604
+ // Busy but with no presence peer, so we can't say where it runs — deliberately location-free.
43605
+ "agent.workingNoWhere": "Agent · working",
43603
43606
  "agent.none": "No agent connected",
43604
43607
  "agent.plan": "Plan {pct}%",
43605
43608
  "agent.overIncluded": "— over included",
@@ -43608,7 +43611,12 @@ var EN = {
43608
43611
  "agent.atLimit": "Usage limit reached — turns are paused until your plan resets or you upgrade",
43609
43612
  "agent.connection": "Agent connection",
43610
43613
  "agent.localCmdHint": "Paste this to your coding agent:",
43611
- "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` if you haven't yet, then run `{cmd}` and work with me through the comments.",
43614
+ // Installs unconditionally rather than only when the CLI is missing: an out-of-date CLI attaches
43615
+ // to a cloud doc and behaves plausibly while lacking the code path the document needs, so
43616
+ // "install it if missing" left the one failure mode that has no symptom.
43617
+ "agent.localCmdBody": "Collaborate with me on my inplan plan. Install or update the CLI with `npm i -g inplan@latest`, sign in with `inplan login` if you haven't yet, then run `{cmd}` and work with me through the comments.",
43618
+ "agent.localLocked": "Connecting your own agent to a cloud document is on Pro and above.",
43619
+ "agent.seePlans": "See plans",
43612
43620
  "agent.copy": "Copy",
43613
43621
  "agent.copied": "Copied",
43614
43622
  // comment rail
@@ -44942,17 +44950,21 @@ function QuotaPie({ pct, color }) {
44942
44950
  }
44943
44951
  function AgentIndicator({
44944
44952
  location,
44953
+ working,
44945
44954
  model,
44946
44955
  quota,
44947
44956
  byoKey,
44948
44957
  policy,
44949
44958
  onSetPolicy,
44959
+ localEntitled,
44960
+ onUpgrade,
44950
44961
  localCommand
44951
44962
  }) {
44952
44963
  const t2 = useT();
44953
44964
  const [open, setOpen] = reactExports.useState(false);
44954
44965
  const [copied, setCopied] = reactExports.useState(false);
44955
44966
  const ref = reactExports.useRef(null);
44967
+ const localGated = localEntitled === false;
44956
44968
  const agentMessage = localCommand ? t2("agent.localCmdBody", { cmd: localCommand }) : "";
44957
44969
  const preview = agentMessage.length > 84 ? `${agentMessage.slice(0, 52)} … ${agentMessage.slice(-26)}` : agentMessage;
44958
44970
  const copy = () => {
@@ -44974,9 +44986,10 @@ function AgentIndicator({
44974
44986
  { value: "manual", label: t2("agent.dontConnect") }
44975
44987
  ];
44976
44988
  const labelFor = (loc, m2) => {
44977
- if (loc === "cloud") return `${t2("agent.remote")}${m2 ? ` (${m2})` : ""}`;
44978
- if (loc === "local") return `${t2("agent.local")}${m2 ? ` (${m2})` : ""}`;
44979
- return t2("agent.disconnected");
44989
+ const suffix = `${m2 ? ` (${m2})` : ""}${working ? ` · ${t2("agent.working")}` : ""}`;
44990
+ if (loc === "cloud") return `${t2("agent.remote")}${suffix}`;
44991
+ if (loc === "local") return `${t2("agent.local")}${suffix}`;
44992
+ return working ? `${t2("agent.working")}` : t2("agent.disconnected");
44980
44993
  };
44981
44994
  reactExports.useEffect(() => {
44982
44995
  const onDown = (e) => {
@@ -44990,7 +45003,9 @@ function AgentIndicator({
44990
45003
  const color = byoKey ? "var(--agent-byo, #1e3a8a)" : quota ? quota.overage || quota.usedPct >= 0.95 ? "#c0392b" : quota.usedPct >= 0.75 ? "#e0a23b" : "#3fa46a" : "var(--accent)";
44991
45004
  icon = quota ? /* @__PURE__ */ jsxRuntimeExports.jsx(QuotaPie, { pct: quota.usedPct, color }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-agent-dot", style: { background: color }, "aria-hidden": "true" });
44992
45005
  } else if (location === "local") {
44993
- icon = /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-agent-dot ap-agent-local", "aria-hidden": "true" });
45006
+ icon = /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `ap-agent-dot ap-agent-local${working ? " ap-agent-working" : ""}`, "aria-hidden": "true" });
45007
+ } else if (working) {
45008
+ icon = /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-agent-dot ap-agent-working", "aria-hidden": "true" });
44994
45009
  } else {
44995
45010
  icon = /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ap-agent-dot ap-agent-off", "aria-hidden": "true" });
44996
45011
  }
@@ -45004,7 +45019,12 @@ function AgentIndicator({
45004
45019
  ] }),
45005
45020
  open && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-agent-menu", role: "menu", children: [
45006
45021
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-agent-detail", children: [
45007
- location ? `${t2("agent.detail", { where: location === "cloud" ? t2("agent.whereCloud") : t2("agent.whereLocal") })}${model ? ` · ${model}` : ""}` : t2("agent.none"),
45022
+ location ? `${t2("agent.detail", { where: location === "cloud" ? t2("agent.whereCloud") : t2("agent.whereLocal") })}${model ? ` · ${model}` : ""}${working ? ` · ${t2("agent.working")}` : ""}` : (
45023
+ // Busy with no peer: report the state WITHOUT claiming where it runs. `working` carries
45024
+ // no location, and inferring "your machine" would only be right because a local CLI
45025
+ // happens to be the one agent shaped this way today.
45026
+ working ? `${t2("agent.workingNoWhere")}` : t2("agent.none")
45027
+ ),
45008
45028
  quota && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-agent-quota", children: `${t2("agent.plan", { pct: Math.round(quota.usedPct * 100) })}${quota.overage ? ` ${t2("agent.overIncluded")}` : ""}` }),
45009
45029
  quotaWarn && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `ap-agent-quota-warn ap-agent-quota-${quotaWarn}`, role: "status", children: t2(quotaWarn === "at" ? "agent.atLimit" : "agent.nearLimit") })
45010
45030
  ] }),
@@ -45022,7 +45042,11 @@ function AgentIndicator({
45022
45042
  },
45023
45043
  o.value
45024
45044
  )) }),
45025
- policy === "local" && agentMessage && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-agent-localcmd", children: [
45045
+ policy === "local" && localGated && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-agent-localcmd ap-agent-upsell", children: [
45046
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-agent-localcmd-hint", children: t2("agent.localLocked") }),
45047
+ onUpgrade && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "ap-agent-upgrade", onClick: () => void onUpgrade(), children: t2("agent.seePlans") })
45048
+ ] }),
45049
+ policy === "local" && !localGated && agentMessage && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-agent-localcmd", children: [
45026
45050
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-agent-localcmd-hint", children: t2("agent.localCmdHint") }),
45027
45051
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ap-agent-localcmd-row", children: [
45028
45052
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ap-agent-localcmd-msg", title: agentMessage, children: preview }),
@@ -45876,7 +45900,7 @@ function App(props = {}) {
45876
45900
  document.addEventListener("keydown", onKey);
45877
45901
  return () => document.removeEventListener("keydown", onKey);
45878
45902
  }, [composer, findOpen, proposal, reviewOpen, undo2, redo2, readOnly2]);
45879
- const agentLocked = mode.locksEditor && agentThinking;
45903
+ const agentLocked = agentThinking;
45880
45904
  const editingLocked = agentLocked || readOnly2;
45881
45905
  const takeBackControl = reactExports.useCallback(() => {
45882
45906
  setAgentThinking(false);
@@ -46622,6 +46646,7 @@ function App(props = {}) {
46622
46646
  } : void 0,
46623
46647
  forceSettingsOpen,
46624
46648
  locked: editingLocked,
46649
+ agentThinking,
46625
46650
  nav: typeof hostApi().navigate === "function" ? { canBack: navState.canBack, canForward: navState.canForward, onBack: () => void hostApi().navigate?.("back"), onForward: () => void hostApi().navigate?.("forward") } : void 0
46626
46651
  }
46627
46652
  ),
@@ -47108,7 +47133,7 @@ function TopBar(props) {
47108
47133
  const { cadence, acceptance, panes, onMode } = props;
47109
47134
  const profile = useProfile();
47110
47135
  const t2 = useT();
47111
- const noAgent = profile?.presenceAware === true && profile.agentAvailable !== true && profile.agentLocation == null;
47136
+ const noAgent = profile?.presenceAware === true && profile.agentAvailable !== true && profile.agentLocation == null && props.agentThinking !== true;
47112
47137
  const noAgentTitle = noAgent ? t2("topbar.noAgent") : void 0;
47113
47138
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("header", { className: "ap-topbar", children: [
47114
47139
  props.onBack && /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "ap-iconbtn ap-iconbtn--primary", onClick: props.onBack, title: t2("topbar.back"), "aria-label": t2("topbar.back"), children: [
@@ -47186,11 +47211,14 @@ function TopBar(props) {
47186
47211
  AgentIndicator,
47187
47212
  {
47188
47213
  location: profile.agentLocation,
47214
+ working: props.agentThinking === true,
47189
47215
  model: profile.agentModel,
47190
47216
  quota: profile.agentQuota,
47191
47217
  byoKey: profile.agentByoKey,
47192
47218
  policy: profile.agentPolicy,
47193
47219
  onSetPolicy: profile.onSetAgentPolicy,
47220
+ localEntitled: profile.agentLocalEntitled,
47221
+ onUpgrade: profile.onUpgrade,
47194
47222
  localCommand: hostApi().localAgentCommand
47195
47223
  }
47196
47224
  ),
@@ -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-CJjtgrEi.js"></script>
25
- <link rel="stylesheet" crossorigin href="./assets/index-i6zzDOQL.css">
24
+ <script type="module" crossorigin src="./assets/index-CLk_2VIF.js"></script>
25
+ <link rel="stylesheet" crossorigin href="./assets/index-BsT_GmrR.css">
26
26
  </head>
27
27
  <body>
28
28
  <div id="root"></div>