@loicngr/kobo 1.7.25 → 1.7.26

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to Kōbō are documented here. The format is based on
4
4
  [Keep a Changelog](https://keepachangelog.com/). Each release is an `## <version>`
5
5
  section — the in-app "What's new" dialog reads this file.
6
6
 
7
+ ## 1.7.26
8
+
9
+ - fix(claude-code-engine): migrate compaction reminder to SessionStart hook
10
+
7
11
  ## 1.7.25
8
12
 
9
13
  - feat(models): add Claude Opus 4.8 and make it the default
@@ -3,7 +3,7 @@ import { nanoid } from 'nanoid';
3
3
  import { CLAUDE_CODE_CAPABILITIES } from './capabilities.js';
4
4
  import { createMapperState, mapSdkMessage, QUOTA_PATTERN, tryEmitQuota } from './event-mapper.js';
5
5
  import { buildClaudeOptions } from './options-builder.js';
6
- import { buildPreCompactCustomInstructions } from './precompact-hook.js';
6
+ import { buildCompactionSessionStartOutput } from './precompact-hook.js';
7
7
  import { resolveClaudeBinaryPath } from './resolve-binary.js';
8
8
  /**
9
9
  * Grace window between the SDK's terminal `result` message and the generator
@@ -71,24 +71,20 @@ export function createClaudeCodeEngine() {
71
71
  });
72
72
  });
73
73
  };
74
- // PreCompact's hookSpecificOutput is missing from the SDK type union
75
- // (SyncHookJSONOutput omits it), but the runtime accepts
76
- // `additionalContext` as custom compaction instructions. Cast through
77
- // `unknown` to satisfy the strict union.
74
+ // Re-inject the workspace's task/criteria reminder after a compaction.
75
+ // The current Claude Code hook schema dropped PreCompact's
76
+ // hookSpecificOutput, so the old `{ hookEventName: 'PreCompact', … }`
77
+ // return is rejected at runtime with a ZodError. We use SessionStart
78
+ // instead — it fires with `source: 'compact'` after compaction and does
79
+ // support `additionalContext`. `buildCompactionSessionStartOutput` gates
80
+ // on the compact source so normal startup/resume/clear inject nothing.
78
81
  const hooks = {
79
- PreCompact: [
82
+ SessionStart: [
80
83
  {
81
84
  hooks: [
82
- async () => {
83
- const reminder = buildPreCompactCustomInstructions(options.workspaceId);
84
- if (!reminder)
85
- return {};
86
- return {
87
- hookSpecificOutput: {
88
- hookEventName: 'PreCompact',
89
- additionalContext: reminder,
90
- },
91
- };
85
+ async (input) => {
86
+ const source = input.source ?? '';
87
+ return buildCompactionSessionStartOutput(options.workspaceId, source);
92
88
  },
93
89
  ],
94
90
  },
@@ -25,3 +25,25 @@ export function buildPreCompactCustomInstructions(workspaceId) {
25
25
  }
26
26
  return out;
27
27
  }
28
+ /**
29
+ * Decide what a SessionStart hook should return so the post-compaction segment
30
+ * keeps the workspace's tasks and acceptance criteria in context.
31
+ *
32
+ * The reminder is injected ONLY when the session segment starts because of a
33
+ * compaction (`source === 'compact'`) — normal startup/resume/clear get
34
+ * nothing, matching the prior PreCompact-hook semantics.
35
+ *
36
+ * This replaces the old PreCompact `hookSpecificOutput` injection: the current
37
+ * Claude Code hook schema dropped `PreCompactHookSpecificOutput`, so emitting
38
+ * `{ hookEventName: 'PreCompact', additionalContext }` is rejected at runtime
39
+ * with a ZodError. `SessionStart` (which fires with `source: 'compact'` after
40
+ * compaction) does support `additionalContext` and is a valid output.
41
+ */
42
+ export function buildCompactionSessionStartOutput(workspaceId, source) {
43
+ if (source !== 'compact')
44
+ return {};
45
+ const reminder = buildPreCompactCustomInstructions(workspaceId);
46
+ if (!reminder)
47
+ return {};
48
+ return { hookSpecificOutput: { hookEventName: 'SessionStart', additionalContext: reminder } };
49
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loicngr/kobo",
3
- "version": "1.7.25",
3
+ "version": "1.7.26",
4
4
  "description": "Kōbō — multi-workspace agent manager for Claude Code. Orchestrates isolated git worktrees with dev servers, Notion integration, and MCP tools.",
5
5
  "type": "module",
6
6
  "license": "GPL-3.0-or-later",