@cogit/cli 0.20.0 → 0.21.0

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cogit",
3
3
  "displayName": "cogit",
4
- "version": "0.20.0",
4
+ "version": "0.21.0",
5
5
  "description": "Git remembers what changed. cogit remembers why.",
6
6
  "author": {
7
7
  "name": "Eren Sertkaya"
@@ -20219,10 +20219,11 @@ var Config = external_exports.object({
20219
20219
  sessionEndCatchUp: external_exports.boolean().default(true),
20220
20220
  /**
20221
20221
  * Who writes the record (Story 12.1): the main agent (`agent`), both (`mixed`,
20222
- * the default: a side model often, the agent rarely), or only the side model
20223
- * (`side`, the agent is never interrupted).
20222
+ * "Detailed" in the panel: a side model often, the agent rarely), or only the
20223
+ * side model (`side`, "Economical", the default since 0.21: the agent is never
20224
+ * interrupted and the session-end pass writes the branches).
20224
20225
  */
20225
- recorder: external_exports.enum(["agent", "mixed", "side"]).default("mixed"),
20226
+ recorder: external_exports.enum(["agent", "mixed", "side"]).default("side"),
20226
20227
  /** Model the side runs use: the headless catch-up and the periodic records. */
20227
20228
  sideModel: external_exports.string().trim().min(1).max(64).default("haiku"),
20228
20229
  /** How often the side model records, in turns (Story 12.1). */
@@ -20413,6 +20414,12 @@ var Session = external_exports.object({
20413
20414
  startedAt: IsoDate,
20414
20415
  updatedAt: IsoDate,
20415
20416
  status: Status.default({ goal: "", done: [], pending: [], next: "" }),
20417
+ /**
20418
+ * One line on where the session left off (L0), so a later session can tell
20419
+ * whether it continues this one without reading the branches. Written by the
20420
+ * session-end pass; old records have none.
20421
+ */
20422
+ leftOff: external_exports.string().max(400).optional(),
20416
20423
  nodes: external_exports.array(LineageNode).default([]),
20417
20424
  /** The linked git worktree the session ran in; set by the CLI, never by the agent. */
20418
20425
  worktree: external_exports.object({ path: external_exports.string().min(1), branch: external_exports.string().min(1).nullable() }).optional(),
@@ -20441,6 +20448,7 @@ var SessionInput = external_exports.object({
20441
20448
  title: external_exports.string().max(200).optional(),
20442
20449
  epoch: Slug.nullable().optional(),
20443
20450
  status: Status.optional(),
20451
+ leftOff: external_exports.string().max(400).optional(),
20444
20452
  nodes: external_exports.array(LineageNodeInput).optional()
20445
20453
  });
20446
20454
 
@@ -21065,13 +21073,23 @@ function displayTurn(turn, roots) {
21065
21073
  ...turn,
21066
21074
  text: capped(text),
21067
21075
  replies: turn.replies.map(capped),
21068
- tools: { ...turn.tools, files: turn.tools.files.map(relative3) }
21076
+ // Steps and questions feed the recorder only; the map keeps the counts.
21077
+ tools: {
21078
+ commands: turn.tools.commands,
21079
+ files: turn.tools.files.map(relative3),
21080
+ other: turn.tools.other
21081
+ }
21069
21082
  };
21070
21083
  }
21071
21084
  var EDIT_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
21072
21085
  var CLEAR = /<command-name>\s*\/clear\s*<\/command-name>/;
21073
21086
  var LINE_UUID = /"uuid":"([^"]+)"/;
21074
21087
  var LINE_PARENT = /"parentUuid":"([^"]+)"/;
21088
+ var LIST_LIMIT = 40;
21089
+ function addOnce(tools, key, text) {
21090
+ const list = tools[key] ?? [];
21091
+ if (list.length < LIST_LIMIT && !list.includes(text)) tools[key] = [...list, text.slice(0, 300)];
21092
+ }
21075
21093
  function addAssistant(turn, line) {
21076
21094
  if (line.isSidechain) return;
21077
21095
  const content = line.message?.content;
@@ -21080,11 +21098,23 @@ function addAssistant(turn, line) {
21080
21098
  if (block?.type === "text" && typeof block.text === "string" && block.text.trim() !== "") {
21081
21099
  turn.replies.push(block.text);
21082
21100
  } else if (block?.type === "tool_use") {
21083
- const path = block.input?.file_path;
21084
- if (block.name === "Bash") turn.tools.commands += 1;
21085
- else if (EDIT_TOOLS.has(block.name) && typeof path === "string") {
21101
+ const input2 = block.input ?? {};
21102
+ const path = input2.file_path;
21103
+ if (block.name === "Bash") {
21104
+ turn.tools.commands += 1;
21105
+ if (typeof input2.description === "string" && input2.description.trim() !== "")
21106
+ addOnce(turn.tools, "steps", input2.description.trim());
21107
+ } else if (EDIT_TOOLS.has(block.name) && typeof path === "string") {
21086
21108
  if (!turn.tools.files.includes(path)) turn.tools.files.push(path);
21087
- } else turn.tools.other += 1;
21109
+ } else {
21110
+ turn.tools.other += 1;
21111
+ if (block.name === "AskUserQuestion" && Array.isArray(input2.questions))
21112
+ for (const q of input2.questions) {
21113
+ if (typeof q?.question !== "string") continue;
21114
+ const options = Array.isArray(q.options) ? q.options.map((o) => o?.label).filter((label) => typeof label === "string") : [];
21115
+ addOnce(turn.tools, "asks", `${q.question} [${options.join(" | ")}]`);
21116
+ }
21117
+ }
21088
21118
  }
21089
21119
  }
21090
21120
  }
@@ -21851,6 +21881,8 @@ export {
21851
21881
  Config,
21852
21882
  SESSION_SCHEMA,
21853
21883
  MESSAGE_ID,
21884
+ BranchSummary,
21885
+ Status,
21854
21886
  SessionInput,
21855
21887
  STATE_SCHEMA,
21856
21888
  LockBusyError,