@cogit/cli 0.20.0 → 0.21.1

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.1",
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
 
@@ -20462,7 +20470,12 @@ var HookState = external_exports.object({
20462
20470
  * and a file with nothing to say is remembered too, so every edit does not
20463
20471
  * walk the history again.
20464
20472
  */
20465
- notedFiles: external_exports.array(external_exports.string().min(1).max(500)).default([])
20473
+ notedFiles: external_exports.array(external_exports.string().min(1).max(500)).default([]),
20474
+ /**
20475
+ * Closing passes a later session started for this one because its own, at
20476
+ * the session end, never finished (machine shut down, run hung or failed).
20477
+ */
20478
+ closeRetries: external_exports.number().int().min(0).optional()
20466
20479
  });
20467
20480
 
20468
20481
  // src/schema/versioned.ts
@@ -21065,13 +21078,23 @@ function displayTurn(turn, roots) {
21065
21078
  ...turn,
21066
21079
  text: capped(text),
21067
21080
  replies: turn.replies.map(capped),
21068
- tools: { ...turn.tools, files: turn.tools.files.map(relative3) }
21081
+ // Steps and questions feed the recorder only; the map keeps the counts.
21082
+ tools: {
21083
+ commands: turn.tools.commands,
21084
+ files: turn.tools.files.map(relative3),
21085
+ other: turn.tools.other
21086
+ }
21069
21087
  };
21070
21088
  }
21071
21089
  var EDIT_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
21072
21090
  var CLEAR = /<command-name>\s*\/clear\s*<\/command-name>/;
21073
21091
  var LINE_UUID = /"uuid":"([^"]+)"/;
21074
21092
  var LINE_PARENT = /"parentUuid":"([^"]+)"/;
21093
+ var LIST_LIMIT = 40;
21094
+ function addOnce(tools, key, text) {
21095
+ const list = tools[key] ?? [];
21096
+ if (list.length < LIST_LIMIT && !list.includes(text)) tools[key] = [...list, text.slice(0, 300)];
21097
+ }
21075
21098
  function addAssistant(turn, line) {
21076
21099
  if (line.isSidechain) return;
21077
21100
  const content = line.message?.content;
@@ -21080,11 +21103,23 @@ function addAssistant(turn, line) {
21080
21103
  if (block?.type === "text" && typeof block.text === "string" && block.text.trim() !== "") {
21081
21104
  turn.replies.push(block.text);
21082
21105
  } 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") {
21106
+ const input2 = block.input ?? {};
21107
+ const path = input2.file_path;
21108
+ if (block.name === "Bash") {
21109
+ turn.tools.commands += 1;
21110
+ if (typeof input2.description === "string" && input2.description.trim() !== "")
21111
+ addOnce(turn.tools, "steps", input2.description.trim());
21112
+ } else if (EDIT_TOOLS.has(block.name) && typeof path === "string") {
21086
21113
  if (!turn.tools.files.includes(path)) turn.tools.files.push(path);
21087
- } else turn.tools.other += 1;
21114
+ } else {
21115
+ turn.tools.other += 1;
21116
+ if (block.name === "AskUserQuestion" && Array.isArray(input2.questions))
21117
+ for (const q of input2.questions) {
21118
+ if (typeof q?.question !== "string") continue;
21119
+ const options = Array.isArray(q.options) ? q.options.map((o) => o?.label).filter((label) => typeof label === "string") : [];
21120
+ addOnce(turn.tools, "asks", `${q.question} [${options.join(" | ")}]`);
21121
+ }
21122
+ }
21088
21123
  }
21089
21124
  }
21090
21125
  }
@@ -21851,6 +21886,8 @@ export {
21851
21886
  Config,
21852
21887
  SESSION_SCHEMA,
21853
21888
  MESSAGE_ID,
21889
+ BranchSummary,
21890
+ Status,
21854
21891
  SessionInput,
21855
21892
  STATE_SCHEMA,
21856
21893
  LockBusyError,