inplan 0.3.6 → 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.
@@ -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 with `inplan open`, while its first
716
- * draft is still to come. Null otherwise. The log is never reset, so the entry must be retired by
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
- const entries = readLog(this.paths.logPath);
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();
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-56Z7HGQ3.js
12
+ // ../core/dist/chunk-SJGNSLZ2.js
13
13
  function isReply(c) {
14
14
  return c.parentId !== void 0;
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inplan",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
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": {