@scotthamilton77/sidekick 0.1.30 → 0.1.32
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/dist/bin.js +82 -129
- package/dist/daemon.js +85 -213
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -28151,6 +28151,35 @@ var require_error_utils = __commonJS({
|
|
|
28151
28151
|
}
|
|
28152
28152
|
});
|
|
28153
28153
|
|
|
28154
|
+
// ../sidekick-core/dist/claude-paths.js
|
|
28155
|
+
var require_claude_paths = __commonJS({
|
|
28156
|
+
"../sidekick-core/dist/claude-paths.js"(exports2) {
|
|
28157
|
+
"use strict";
|
|
28158
|
+
var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
|
|
28159
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
28160
|
+
};
|
|
28161
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
28162
|
+
exports2.claudeConfigDir = claudeConfigDir;
|
|
28163
|
+
exports2.encodeProjectPath = encodeProjectPath;
|
|
28164
|
+
exports2.reconstructTranscriptPath = reconstructTranscriptPath;
|
|
28165
|
+
var os_1 = require("os");
|
|
28166
|
+
var path_1 = __importDefault2(require("path"));
|
|
28167
|
+
function claudeConfigDir(home) {
|
|
28168
|
+
const override = process.env.CLAUDE_CONFIG_DIR?.trim();
|
|
28169
|
+
if (override)
|
|
28170
|
+
return override;
|
|
28171
|
+
return path_1.default.join(home ?? (0, os_1.homedir)(), ".claude");
|
|
28172
|
+
}
|
|
28173
|
+
function encodeProjectPath(projectDir) {
|
|
28174
|
+
return projectDir.replace(/\//g, "-");
|
|
28175
|
+
}
|
|
28176
|
+
function reconstructTranscriptPath(projectDir, sessionId) {
|
|
28177
|
+
const encodedPath = encodeProjectPath(projectDir);
|
|
28178
|
+
return path_1.default.join(claudeConfigDir(), "projects", encodedPath, `${sessionId}.jsonl`);
|
|
28179
|
+
}
|
|
28180
|
+
}
|
|
28181
|
+
});
|
|
28182
|
+
|
|
28154
28183
|
// ../sidekick-core/dist/assets.js
|
|
28155
28184
|
var require_assets = __commonJS({
|
|
28156
28185
|
"../sidekick-core/dist/assets.js"(exports2) {
|
|
@@ -28165,6 +28194,7 @@ var require_assets = __commonJS({
|
|
|
28165
28194
|
var node_os_1 = require("node:os");
|
|
28166
28195
|
var node_path_1 = require("node:path");
|
|
28167
28196
|
var error_utils_js_1 = require_error_utils();
|
|
28197
|
+
var claude_paths_js_1 = require_claude_paths();
|
|
28168
28198
|
function createCascadingResolver(options) {
|
|
28169
28199
|
const { cascadeLayers } = options;
|
|
28170
28200
|
const findFile = (relativePath) => {
|
|
@@ -28223,7 +28253,7 @@ var require_assets = __commonJS({
|
|
|
28223
28253
|
function buildCascadeLayers(defaultAssetsDir, homeDir, projectRoot) {
|
|
28224
28254
|
const layers = [];
|
|
28225
28255
|
layers.push(defaultAssetsDir);
|
|
28226
|
-
const userInstalled = (0, node_path_1.join)(
|
|
28256
|
+
const userInstalled = (0, node_path_1.join)((0, claude_paths_js_1.claudeConfigDir)(homeDir), "hooks", "sidekick", "assets");
|
|
28227
28257
|
layers.push(userInstalled);
|
|
28228
28258
|
const userPersistent = (0, node_path_1.join)(homeDir, ".sidekick", "assets");
|
|
28229
28259
|
layers.push(userPersistent);
|
|
@@ -28253,28 +28283,6 @@ var require_assets = __commonJS({
|
|
|
28253
28283
|
}
|
|
28254
28284
|
});
|
|
28255
28285
|
|
|
28256
|
-
// ../sidekick-core/dist/claude-paths.js
|
|
28257
|
-
var require_claude_paths = __commonJS({
|
|
28258
|
-
"../sidekick-core/dist/claude-paths.js"(exports2) {
|
|
28259
|
-
"use strict";
|
|
28260
|
-
var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
|
|
28261
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
28262
|
-
};
|
|
28263
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
28264
|
-
exports2.encodeProjectPath = encodeProjectPath;
|
|
28265
|
-
exports2.reconstructTranscriptPath = reconstructTranscriptPath;
|
|
28266
|
-
var os_1 = require("os");
|
|
28267
|
-
var path_1 = __importDefault2(require("path"));
|
|
28268
|
-
function encodeProjectPath(projectDir) {
|
|
28269
|
-
return projectDir.replace(/\//g, "-");
|
|
28270
|
-
}
|
|
28271
|
-
function reconstructTranscriptPath(projectDir, sessionId) {
|
|
28272
|
-
const encodedPath = encodeProjectPath(projectDir);
|
|
28273
|
-
return path_1.default.join((0, os_1.homedir)(), ".claude", "projects", encodedPath, `${sessionId}.jsonl`);
|
|
28274
|
-
}
|
|
28275
|
-
}
|
|
28276
|
-
});
|
|
28277
|
-
|
|
28278
28286
|
// ../sidekick-core/dist/sidekick-paths.js
|
|
28279
28287
|
var require_sidekick_paths = __commonJS({
|
|
28280
28288
|
"../sidekick-core/dist/sidekick-paths.js"(exports2) {
|
|
@@ -47579,7 +47587,7 @@ var require_build_identity = __commonJS({
|
|
|
47579
47587
|
var path_1 = __importDefault2(require("path"));
|
|
47580
47588
|
var DEV_PREFIX = "dev:";
|
|
47581
47589
|
var NO_DIST_SENTINEL = "nodist";
|
|
47582
|
-
function computeBuildIdentity(injectedVersion = true ? "0.1.
|
|
47590
|
+
function computeBuildIdentity(injectedVersion = true ? "0.1.32" : void 0, devFingerprint = computeDevFingerprint) {
|
|
47583
47591
|
return injectedVersion !== void 0 ? injectedVersion : DEV_PREFIX + devFingerprint();
|
|
47584
47592
|
}
|
|
47585
47593
|
function computeDevFingerprint() {
|
|
@@ -59107,6 +59115,7 @@ var require_plugin_detector = __commonJS({
|
|
|
59107
59115
|
var node_child_process_1 = require("node:child_process");
|
|
59108
59116
|
var api_key_detector_js_1 = require_api_key_detector();
|
|
59109
59117
|
var error_utils_js_1 = require_error_utils();
|
|
59118
|
+
var claude_paths_js_1 = require_claude_paths();
|
|
59110
59119
|
function isSidekickStatuslineCommand(command) {
|
|
59111
59120
|
return command?.toLowerCase().includes("sidekick") ?? false;
|
|
59112
59121
|
}
|
|
@@ -59165,7 +59174,7 @@ var require_plugin_detector = __commonJS({
|
|
|
59165
59174
|
});
|
|
59166
59175
|
}
|
|
59167
59176
|
async function detectActualStatusline(projectDir, homeDir) {
|
|
59168
|
-
const userSettingsPath = path.join(
|
|
59177
|
+
const userSettingsPath = path.join((0, claude_paths_js_1.claudeConfigDir)(homeDir), "settings.json");
|
|
59169
59178
|
const projectSettingsPath = path.join(projectDir, ".claude", "settings.local.json");
|
|
59170
59179
|
let inUser = false;
|
|
59171
59180
|
let inProject = false;
|
|
@@ -59244,7 +59253,7 @@ var require_plugin_detector = __commonJS({
|
|
|
59244
59253
|
}
|
|
59245
59254
|
async function detectDevModeFromSettings(projectDir, homeDir) {
|
|
59246
59255
|
const settingsPaths = [
|
|
59247
|
-
path.join(
|
|
59256
|
+
path.join((0, claude_paths_js_1.claudeConfigDir)(homeDir), "settings.json"),
|
|
59248
59257
|
path.join(projectDir, ".claude", "settings.local.json")
|
|
59249
59258
|
];
|
|
59250
59259
|
for (const settingsPath of settingsPaths) {
|
|
@@ -61989,7 +61998,7 @@ var require_transcript_metrics_engine = __commonJS({
|
|
|
61989
61998
|
exports2.isExcludedBuiltinCommandInvocation = isExcludedBuiltinCommandInvocation;
|
|
61990
61999
|
exports2.updateToolsPerTurn = updateToolsPerTurn;
|
|
61991
62000
|
var transcript_helpers_js_1 = require_transcript_helpers();
|
|
61992
|
-
async function processEntry(entry, lineNumber, metrics, toolUseIdToName, emitEvent) {
|
|
62001
|
+
async function processEntry(entry, lineNumber, metrics, toolUseIdToName, emitEvent, signalCompaction) {
|
|
61993
62002
|
const entryType = entry.type;
|
|
61994
62003
|
switch (entryType) {
|
|
61995
62004
|
case "user": {
|
|
@@ -62018,8 +62027,13 @@ var require_transcript_metrics_engine = __commonJS({
|
|
|
62018
62027
|
await emitEvent("AssistantMessage", entry, lineNumber);
|
|
62019
62028
|
await processNestedToolUses(entry, lineNumber, metrics, toolUseIdToName, emitEvent);
|
|
62020
62029
|
break;
|
|
62021
|
-
case "system":
|
|
62030
|
+
case "system": {
|
|
62031
|
+
const subtype = entry.subtype;
|
|
62032
|
+
if (subtype === "compact_boundary") {
|
|
62033
|
+
await signalCompaction?.(lineNumber);
|
|
62034
|
+
}
|
|
62022
62035
|
break;
|
|
62036
|
+
}
|
|
62023
62037
|
}
|
|
62024
62038
|
}
|
|
62025
62039
|
function extractTokenUsage(entry, metrics) {
|
|
@@ -64477,10 +64491,12 @@ var require_transcript_service = __commonJS({
|
|
|
64477
64491
|
// ============================================================================
|
|
64478
64492
|
// Compaction Management
|
|
64479
64493
|
// ============================================================================
|
|
64480
|
-
async signalCompaction() {
|
|
64494
|
+
async signalCompaction(lineNumber) {
|
|
64495
|
+
if (this.metrics.isPostCompactIndeterminate)
|
|
64496
|
+
return;
|
|
64481
64497
|
this.metrics.currentContextTokens = null;
|
|
64482
64498
|
this.metrics.isPostCompactIndeterminate = true;
|
|
64483
|
-
await this.emitEvent("Compact", {}, this.metrics.lastProcessedLine);
|
|
64499
|
+
await this.emitEvent("Compact", {}, lineNumber ?? this.metrics.lastProcessedLine);
|
|
64484
64500
|
this.notifyMetricsChange();
|
|
64485
64501
|
this.schedulePersistence();
|
|
64486
64502
|
}
|
|
@@ -64538,7 +64554,7 @@ var require_transcript_service = __commonJS({
|
|
|
64538
64554
|
return;
|
|
64539
64555
|
const self = this;
|
|
64540
64556
|
await (0, transcript_file_watcher_js_1.processTranscriptFile)(this.transcriptPath, this.streamingState, this.metrics, async (entry, lineNumber) => {
|
|
64541
|
-
await (0, transcript_metrics_engine_js_1.processEntry)(entry, lineNumber, this.metrics, this.toolUseIdToName, (eventType, e, ln) => this.emitEvent(eventType, e, ln));
|
|
64557
|
+
await (0, transcript_metrics_engine_js_1.processEntry)(entry, lineNumber, this.metrics, this.toolUseIdToName, (eventType, e, ln) => this.emitEvent(eventType, e, ln), (ln) => this.signalCompaction(ln));
|
|
64542
64558
|
}, async (lineNumber, _durationMs) => {
|
|
64543
64559
|
await this.emitEvent("BulkProcessingComplete", {}, lineNumber);
|
|
64544
64560
|
}, this.options.logger, this.sessionId, {
|
|
@@ -65708,9 +65724,9 @@ var require_dist4 = __commonJS({
|
|
|
65708
65724
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
|
|
65709
65725
|
};
|
|
65710
65726
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
65711
|
-
exports2.
|
|
65712
|
-
exports2.
|
|
65713
|
-
exports2.computeBuildIdentity = exports2.CoalescingGuard = exports2.loadUserProfile = exports2.parseGitStatusOutput = exports2.getGitFileStatus = exports2.toErrorMessage = exports2.isInSandbox = exports2.updateDaemonHealth = exports2.readDaemonHealth = exports2.ProjectRegistryService = exports2.encodeProjectDir = exports2.DaemonGlobalLogMetricsDescriptor = exports2.CliLogMetricsDescriptor = exports2.DaemonLogMetricsDescriptor = exports2.CompactionHistoryDescriptor = exports2.TranscriptMetricsDescriptor = exports2.GlobalStateAccessor = exports2.SessionStateAccessor = exports2.globalState = exports2.sessionState = exports2.StateCorruptError = exports2.StateNotFoundError = exports2.StateService = exports2.createHookableLogger = exports2.InstrumentedProfileProviderFactory = exports2.InstrumentedLLMProvider = exports2.ServiceFactoryImpl = exports2.TranscriptServiceImpl = exports2.createDefaultTokenUsage = void 0;
|
|
65727
|
+
exports2.USER_STATUS_FILENAME = exports2.createSetupStatusService = exports2.SetupStatusService = exports2.DaemonClient = exports2.findZombieDaemons = exports2.killZombieDaemons = exports2.killAllDaemons = exports2.SessionLogWriter = exports2.setSessionLogWriter = exports2.logEvent = exports2.LogEvents = exports2.DEFAULT_MAX_FILES = exports2.DEFAULT_ROTATE_SIZE_BYTES = exports2.getComponentLogLevel = exports2.setupGlobalErrorHandlers = exports2.createLoggerFacade = exports2.createLogManager = exports2.createConsoleLogger = exports2.getUserDaemonsDir = exports2.getUserPidPath = exports2.getTokenPath = exports2.getSocketPath = exports2.getProjectHash = exports2.getPidPath = exports2.getLockPath = exports2.IpcService = exports2.IpcServer = exports2.loadPersonaFile = exports2.getDefaultPersonasDir = exports2.discoverPersonas = exports2.createPersonaLoader = exports2.claudeConfigDir = exports2.reconstructTranscriptPath = exports2.encodeProjectPath = exports2.isSubagentStopEvent = exports2.isSubagentStartEvent = exports2.isPreCompactEvent = exports2.isStopEvent = exports2.isPostToolUseEvent = exports2.isPreToolUseEvent = exports2.isUserPromptSubmitEvent = exports2.isSessionEndEvent = exports2.isSessionStartEvent = exports2.isTranscriptEvent = exports2.isHookEvent = exports2.MetricsPersistPayloadSchema = exports2.CleanupPayloadSchema = exports2.ResumeGenerationPayloadSchema = exports2.SessionSummaryPayloadSchema = exports2.TaskTypes = void 0;
|
|
65728
|
+
exports2.copyWithTimestampSync = exports2.renameWithTimestampSync = exports2.renameWithTimestamp = exports2.copyWithTimestamp = exports2.getTimestampedPath = exports2.extractToolResultPreview = exports2.extractToolCallPreview = exports2.extractTextFromContent = exports2.extractContentPreview = exports2.HandlerRegistryImpl = exports2.extractConsumedTimestamp = exports2.createConsumedFilePattern = exports2.CONSUMED_FILE_PATTERN = exports2.filterActiveReminderFiles = exports2.validatePathSegment = exports2.isValidPathSegment = exports2.getReminderPath = exports2.getHookDir = exports2.getStagingRoot = exports2.SessionScopedStagingService = exports2.StagingServiceCore = exports2.GITIGNORE_ENTRIES = exports2.SIDEKICK_GITIGNORE_HEADER = exports2.SIDEKICK_SECTION_END = exports2.SIDEKICK_SECTION_START = exports2.removeLegacyGitignoreSection = exports2.detectLegacyGitignoreSection = exports2.detectGitignoreStatus = exports2.removeGitignoreSection = exports2.installGitignoreSection = exports2.validateOpenAIKey = exports2.validateOpenRouterKey = exports2.runDoctorCheck = exports2.detectPluginLiveness = exports2.detectPluginInstallation = exports2.detectDevModeFromSettings = exports2.detectActualStatusline = exports2.spawnWithTimeout = exports2.getDoctorTimeout = exports2.DOCTOR_TIMEOUTS = exports2.projectApiKeyStatusFromHealth = exports2.userApiKeyStatusFromHealth = exports2.buildProjectApiKeyStatus = exports2.buildUserApiKeyStatus = exports2.detectAllApiKeys = exports2.detectActualApiKey = exports2.readKeyFromEnvFile = exports2.determineOverallStatus = exports2.toScopeStatus = exports2.PROJECT_STATUS_FILENAME = void 0;
|
|
65729
|
+
exports2.computeBuildIdentity = exports2.CoalescingGuard = exports2.loadUserProfile = exports2.parseGitStatusOutput = exports2.getGitFileStatus = exports2.toErrorMessage = exports2.isInSandbox = exports2.updateDaemonHealth = exports2.readDaemonHealth = exports2.ProjectRegistryService = exports2.encodeProjectDir = exports2.DaemonGlobalLogMetricsDescriptor = exports2.CliLogMetricsDescriptor = exports2.DaemonLogMetricsDescriptor = exports2.CompactionHistoryDescriptor = exports2.TranscriptMetricsDescriptor = exports2.GlobalStateAccessor = exports2.SessionStateAccessor = exports2.globalState = exports2.sessionState = exports2.StateCorruptError = exports2.StateNotFoundError = exports2.StateService = exports2.createHookableLogger = exports2.InstrumentedProfileProviderFactory = exports2.InstrumentedLLMProvider = exports2.ServiceFactoryImpl = exports2.TranscriptServiceImpl = exports2.createDefaultTokenUsage = exports2.createDefaultMetrics = void 0;
|
|
65714
65730
|
var types_1 = require_dist();
|
|
65715
65731
|
Object.defineProperty(exports2, "TaskTypes", { enumerable: true, get: function() {
|
|
65716
65732
|
return types_1.TaskTypes;
|
|
@@ -65769,6 +65785,9 @@ var require_dist4 = __commonJS({
|
|
|
65769
65785
|
Object.defineProperty(exports2, "reconstructTranscriptPath", { enumerable: true, get: function() {
|
|
65770
65786
|
return claude_paths_1.reconstructTranscriptPath;
|
|
65771
65787
|
} });
|
|
65788
|
+
Object.defineProperty(exports2, "claudeConfigDir", { enumerable: true, get: function() {
|
|
65789
|
+
return claude_paths_1.claudeConfigDir;
|
|
65790
|
+
} });
|
|
65772
65791
|
__exportStar(require_sidekick_paths(), exports2);
|
|
65773
65792
|
var persona_loader_1 = require_persona_loader();
|
|
65774
65793
|
Object.defineProperty(exports2, "createPersonaLoader", { enumerable: true, get: function() {
|
|
@@ -78154,28 +78173,6 @@ var require_dist5 = __commonJS({
|
|
|
78154
78173
|
}
|
|
78155
78174
|
});
|
|
78156
78175
|
|
|
78157
|
-
// ../feature-reminders/dist/handlers/consumption/session-type-gate.js
|
|
78158
|
-
var require_session_type_gate = __commonJS({
|
|
78159
|
-
"../feature-reminders/dist/handlers/consumption/session-type-gate.js"(exports2) {
|
|
78160
|
-
"use strict";
|
|
78161
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
78162
|
-
exports2.suppressReminderForSessionType = suppressReminderForSessionType;
|
|
78163
|
-
var types_js_1 = require_types2();
|
|
78164
|
-
var PERSONA_REMINDERS = /* @__PURE__ */ new Set([types_js_1.ReminderIds.REMEMBER_YOUR_PERSONA, types_js_1.ReminderIds.PERSONA_CHANGED]);
|
|
78165
|
-
function suppressReminderForSessionType(reminderName, sessionType, config) {
|
|
78166
|
-
if (sessionType !== "non-interactive")
|
|
78167
|
-
return false;
|
|
78168
|
-
if (PERSONA_REMINDERS.has(reminderName)) {
|
|
78169
|
-
return config.injectPersonaIntoNonInteractiveSessions !== true;
|
|
78170
|
-
}
|
|
78171
|
-
if (reminderName === types_js_1.ReminderIds.CAVEMAN_MODE) {
|
|
78172
|
-
return config.injectCavemanIntoNonInteractiveSessions !== true;
|
|
78173
|
-
}
|
|
78174
|
-
return false;
|
|
78175
|
-
}
|
|
78176
|
-
}
|
|
78177
|
-
});
|
|
78178
|
-
|
|
78179
78176
|
// ../feature-reminders/dist/handlers/staging/stage-persona-reminders.js
|
|
78180
78177
|
var require_stage_persona_reminders = __commonJS({
|
|
78181
78178
|
"../feature-reminders/dist/handlers/staging/stage-persona-reminders.js"(exports2) {
|
|
@@ -78183,7 +78180,6 @@ var require_stage_persona_reminders = __commonJS({
|
|
|
78183
78180
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
78184
78181
|
exports2.restagePersonaRemindersForActiveSessions = restagePersonaRemindersForActiveSessions;
|
|
78185
78182
|
exports2.stagePersonaRemindersForSession = stagePersonaRemindersForSession;
|
|
78186
|
-
exports2.resolvePersonaContextForSnapshot = resolvePersonaContextForSnapshot;
|
|
78187
78183
|
exports2.registerStagePersonaReminders = registerStagePersonaReminders;
|
|
78188
78184
|
var core_1 = require_dist4();
|
|
78189
78185
|
var feature_session_summary_1 = require_dist5();
|
|
@@ -78191,7 +78187,6 @@ var require_stage_persona_reminders = __commonJS({
|
|
|
78191
78187
|
var types_1 = require_dist();
|
|
78192
78188
|
var reminder_utils_js_1 = require_reminder_utils();
|
|
78193
78189
|
var types_js_1 = require_types2();
|
|
78194
|
-
var session_type_gate_js_1 = require_session_type_gate();
|
|
78195
78190
|
var throttle_utils_js_1 = require_throttle_utils();
|
|
78196
78191
|
async function restagePersonaRemindersForActiveSessions(ctxFactory, sessionIds, logger) {
|
|
78197
78192
|
logger.info("Re-staging persona reminders for active sessions", { count: sessionIds.length });
|
|
@@ -78404,24 +78399,6 @@ var require_stage_persona_reminders = __commonJS({
|
|
|
78404
78399
|
includeChanged: options?.includeChangedReminder ?? false
|
|
78405
78400
|
});
|
|
78406
78401
|
}
|
|
78407
|
-
async function resolvePersonaContextForSnapshot(ctx, sessionId) {
|
|
78408
|
-
if (!isPersonaInjectionEnabled(ctx))
|
|
78409
|
-
return void 0;
|
|
78410
|
-
const personaConfig = ctx.config.getFeature("session-summary").settings?.personas ?? {};
|
|
78411
|
-
if ((0, session_type_gate_js_1.suppressReminderForSessionType)(types_js_1.ReminderIds.REMEMBER_YOUR_PERSONA, ctx.sessionType, personaConfig)) {
|
|
78412
|
-
return void 0;
|
|
78413
|
-
}
|
|
78414
|
-
const persona = await loadPersonaForSession(ctx, sessionId);
|
|
78415
|
-
if (!persona)
|
|
78416
|
-
return void 0;
|
|
78417
|
-
const templateContext = buildPersonaTemplateContext(persona);
|
|
78418
|
-
const reminder = (0, reminder_utils_js_1.resolveReminder)(types_js_1.ReminderIds.REMEMBER_YOUR_PERSONA, {
|
|
78419
|
-
context: templateContext,
|
|
78420
|
-
assets: ctx.assets,
|
|
78421
|
-
logger: ctx.logger
|
|
78422
|
-
});
|
|
78423
|
-
return reminder?.additionalContext ?? void 0;
|
|
78424
|
-
}
|
|
78425
78402
|
function registerStagePersonaReminders(context) {
|
|
78426
78403
|
if (!(0, types_1.isDaemonContext)(context))
|
|
78427
78404
|
return;
|
|
@@ -78450,7 +78427,6 @@ var require_stage_user_profile_reminders = __commonJS({
|
|
|
78450
78427
|
"use strict";
|
|
78451
78428
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
78452
78429
|
exports2.stageUserProfileRemindersForSession = stageUserProfileRemindersForSession;
|
|
78453
|
-
exports2.resolveUserProfileContextForSnapshot = resolveUserProfileContextForSnapshot;
|
|
78454
78430
|
exports2.registerStageUserProfileReminders = registerStageUserProfileReminders;
|
|
78455
78431
|
var core_1 = require_dist4();
|
|
78456
78432
|
var events_js_1 = require_events2();
|
|
@@ -78490,21 +78466,6 @@ var require_stage_user_profile_reminders = __commonJS({
|
|
|
78490
78466
|
ctx.logger.warn("Failed to resolve user-profile reminder", { sessionId });
|
|
78491
78467
|
}
|
|
78492
78468
|
}
|
|
78493
|
-
function resolveUserProfileContextForSnapshot(ctx) {
|
|
78494
|
-
const profile = (0, core_1.loadUserProfile)({ logger: ctx.logger });
|
|
78495
|
-
if (!profile)
|
|
78496
|
-
return void 0;
|
|
78497
|
-
const templateContext = {
|
|
78498
|
-
user_name: profile.name,
|
|
78499
|
-
user_role: profile.role,
|
|
78500
|
-
user_interests: profile.interests.join(", ")
|
|
78501
|
-
};
|
|
78502
|
-
const reminder = (0, reminder_utils_js_1.resolveReminder)(types_js_1.ReminderIds.USER_PROFILE, {
|
|
78503
|
-
context: templateContext,
|
|
78504
|
-
assets: ctx.assets
|
|
78505
|
-
});
|
|
78506
|
-
return reminder?.additionalContext ?? void 0;
|
|
78507
|
-
}
|
|
78508
78469
|
function registerStageUserProfileReminders(context) {
|
|
78509
78470
|
if (!(0, types_1.isDaemonContext)(context))
|
|
78510
78471
|
return;
|
|
@@ -78796,6 +78757,28 @@ var require_cli_staging_reader = __commonJS({
|
|
|
78796
78757
|
}
|
|
78797
78758
|
});
|
|
78798
78759
|
|
|
78760
|
+
// ../feature-reminders/dist/handlers/consumption/session-type-gate.js
|
|
78761
|
+
var require_session_type_gate = __commonJS({
|
|
78762
|
+
"../feature-reminders/dist/handlers/consumption/session-type-gate.js"(exports2) {
|
|
78763
|
+
"use strict";
|
|
78764
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
78765
|
+
exports2.suppressReminderForSessionType = suppressReminderForSessionType;
|
|
78766
|
+
var types_js_1 = require_types2();
|
|
78767
|
+
var PERSONA_REMINDERS = /* @__PURE__ */ new Set([types_js_1.ReminderIds.REMEMBER_YOUR_PERSONA, types_js_1.ReminderIds.PERSONA_CHANGED]);
|
|
78768
|
+
function suppressReminderForSessionType(reminderName, sessionType, config) {
|
|
78769
|
+
if (sessionType !== "non-interactive")
|
|
78770
|
+
return false;
|
|
78771
|
+
if (PERSONA_REMINDERS.has(reminderName)) {
|
|
78772
|
+
return config.injectPersonaIntoNonInteractiveSessions !== true;
|
|
78773
|
+
}
|
|
78774
|
+
if (reminderName === types_js_1.ReminderIds.CAVEMAN_MODE) {
|
|
78775
|
+
return config.injectCavemanIntoNonInteractiveSessions !== true;
|
|
78776
|
+
}
|
|
78777
|
+
return false;
|
|
78778
|
+
}
|
|
78779
|
+
}
|
|
78780
|
+
});
|
|
78781
|
+
|
|
78799
78782
|
// ../feature-reminders/dist/handlers/consumption/consumption-handler-factory.js
|
|
78800
78783
|
var require_consumption_handler_factory = __commonJS({
|
|
78801
78784
|
"../feature-reminders/dist/handlers/consumption/consumption-handler-factory.js"(exports2) {
|
|
@@ -79108,22 +79091,6 @@ var require_inject_session_start = __commonJS({
|
|
|
79108
79091
|
}
|
|
79109
79092
|
});
|
|
79110
79093
|
|
|
79111
|
-
// ../feature-reminders/dist/handlers/consumption/inject-post-compact.js
|
|
79112
|
-
var require_inject_post_compact = __commonJS({
|
|
79113
|
-
"../feature-reminders/dist/handlers/consumption/inject-post-compact.js"(exports2) {
|
|
79114
|
-
"use strict";
|
|
79115
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
79116
|
-
exports2.registerInjectPostCompact = registerInjectPostCompact;
|
|
79117
|
-
var consumption_handler_factory_js_1 = require_consumption_handler_factory();
|
|
79118
|
-
function registerInjectPostCompact(context) {
|
|
79119
|
-
(0, consumption_handler_factory_js_1.createConsumptionHandler)(context, {
|
|
79120
|
-
id: "reminders:inject-post-compact",
|
|
79121
|
-
hook: "PostCompact"
|
|
79122
|
-
});
|
|
79123
|
-
}
|
|
79124
|
-
}
|
|
79125
|
-
});
|
|
79126
|
-
|
|
79127
79094
|
// ../feature-reminders/dist/handlers/consumption/index.js
|
|
79128
79095
|
var require_consumption = __commonJS({
|
|
79129
79096
|
"../feature-reminders/dist/handlers/consumption/index.js"(exports2) {
|
|
@@ -79135,14 +79102,12 @@ var require_consumption = __commonJS({
|
|
|
79135
79102
|
var inject_post_tool_use_1 = require_inject_post_tool_use();
|
|
79136
79103
|
var inject_stop_1 = require_inject_stop();
|
|
79137
79104
|
var inject_session_start_1 = require_inject_session_start();
|
|
79138
|
-
var inject_post_compact_js_1 = require_inject_post_compact();
|
|
79139
79105
|
function registerConsumptionHandlers(context) {
|
|
79140
79106
|
(0, inject_user_prompt_submit_1.registerInjectUserPromptSubmit)(context);
|
|
79141
79107
|
(0, inject_pre_tool_use_1.registerInjectPreToolUse)(context);
|
|
79142
79108
|
(0, inject_post_tool_use_1.registerInjectPostToolUse)(context);
|
|
79143
79109
|
(0, inject_stop_1.registerInjectStop)(context);
|
|
79144
79110
|
(0, inject_session_start_1.registerInjectSessionStart)(context);
|
|
79145
|
-
(0, inject_post_compact_js_1.registerInjectPostCompact)(context);
|
|
79146
79111
|
}
|
|
79147
79112
|
}
|
|
79148
79113
|
});
|
|
@@ -79587,7 +79552,7 @@ var require_dist6 = __commonJS({
|
|
|
79587
79552
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
|
|
79588
79553
|
};
|
|
79589
79554
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
79590
|
-
exports2.createRemindersState = exports2.ReminderOrchestrator = exports2.ReminderEvents = exports2.handleVCUnverifiedClear = exports2.handleVCUnverifiedSet = exports2.handleReminderConsumed = exports2.classifyCompletion = exports2.
|
|
79555
|
+
exports2.createRemindersState = exports2.ReminderOrchestrator = exports2.ReminderEvents = exports2.handleVCUnverifiedClear = exports2.handleVCUnverifiedSet = exports2.handleReminderConsumed = exports2.classifyCompletion = exports2.restagePersonaRemindersForActiveSessions = exports2.stagePersonaRemindersForSession = exports2.registerStagingHandlers = exports2.registerConsumptionHandlers = exports2.manifest = void 0;
|
|
79591
79556
|
exports2.register = register;
|
|
79592
79557
|
var staging_1 = require_staging2();
|
|
79593
79558
|
var consumption_1 = require_consumption();
|
|
@@ -79621,13 +79586,6 @@ var require_dist6 = __commonJS({
|
|
|
79621
79586
|
Object.defineProperty(exports2, "restagePersonaRemindersForActiveSessions", { enumerable: true, get: function() {
|
|
79622
79587
|
return stage_persona_reminders_1.restagePersonaRemindersForActiveSessions;
|
|
79623
79588
|
} });
|
|
79624
|
-
Object.defineProperty(exports2, "resolvePersonaContextForSnapshot", { enumerable: true, get: function() {
|
|
79625
|
-
return stage_persona_reminders_1.resolvePersonaContextForSnapshot;
|
|
79626
|
-
} });
|
|
79627
|
-
var stage_user_profile_reminders_1 = require_stage_user_profile_reminders();
|
|
79628
|
-
Object.defineProperty(exports2, "resolveUserProfileContextForSnapshot", { enumerable: true, get: function() {
|
|
79629
|
-
return stage_user_profile_reminders_1.resolveUserProfileContextForSnapshot;
|
|
79630
|
-
} });
|
|
79631
79589
|
var completion_classifier_1 = require_completion_classifier();
|
|
79632
79590
|
Object.defineProperty(exports2, "classifyCompletion", { enumerable: true, get: function() {
|
|
79633
79591
|
return completion_classifier_1.classifyCompletion;
|
|
@@ -80179,12 +80137,6 @@ var require_hook_command = __commonJS({
|
|
|
80179
80137
|
}
|
|
80180
80138
|
function translatePostCompact(internal) {
|
|
80181
80139
|
const response = {};
|
|
80182
|
-
if (internal.additionalContext) {
|
|
80183
|
-
response.hookSpecificOutput = {
|
|
80184
|
-
hookEventName: "PostCompact",
|
|
80185
|
-
additionalContext: internal.additionalContext
|
|
80186
|
-
};
|
|
80187
|
-
}
|
|
80188
80140
|
addUserMessage(response, internal.userMessage);
|
|
80189
80141
|
return response;
|
|
80190
80142
|
}
|
|
@@ -85234,6 +85186,7 @@ var require_helpers = __commonJS({
|
|
|
85234
85186
|
var fs = __importStar(require("node:fs/promises"));
|
|
85235
85187
|
var path = __importStar(require("node:path"));
|
|
85236
85188
|
var settings_js_1 = require_settings();
|
|
85189
|
+
var core_1 = require_dist4();
|
|
85237
85190
|
exports2.STATUSLINE_COMMAND = "npx @scotthamilton77/sidekick statusline --project-dir=$CLAUDE_PROJECT_DIR";
|
|
85238
85191
|
function classifyStatusLine(existing) {
|
|
85239
85192
|
const command = existing?.command;
|
|
@@ -85248,7 +85201,7 @@ var require_helpers = __commonJS({
|
|
|
85248
85201
|
function statuslineSettingsPath(scope, homeDir, projectDir) {
|
|
85249
85202
|
switch (scope) {
|
|
85250
85203
|
case "user":
|
|
85251
|
-
return path.join(
|
|
85204
|
+
return path.join((0, core_1.claudeConfigDir)(homeDir), "settings.json");
|
|
85252
85205
|
case "project":
|
|
85253
85206
|
return path.join(projectDir, ".claude", "settings.json");
|
|
85254
85207
|
case "local":
|
|
@@ -86981,7 +86934,7 @@ var require_uninstall = __commonJS({
|
|
|
86981
86934
|
});
|
|
86982
86935
|
}
|
|
86983
86936
|
if (userDetected) {
|
|
86984
|
-
await cleanSettingsFile(path.join(
|
|
86937
|
+
await cleanSettingsFile(path.join((0, core_1.claudeConfigDir)(userHome), "settings.json"), "user", logger, actions, {
|
|
86985
86938
|
dryRun,
|
|
86986
86939
|
removeHooks: false
|
|
86987
86940
|
});
|
|
@@ -87098,7 +87051,7 @@ var require_uninstall = __commonJS({
|
|
|
87098
87051
|
return true;
|
|
87099
87052
|
} catch {
|
|
87100
87053
|
try {
|
|
87101
|
-
const content = await fs.readFile(path.join(
|
|
87054
|
+
const content = await fs.readFile(path.join((0, core_1.claudeConfigDir)(userHome), "settings.json"), "utf-8");
|
|
87102
87055
|
return content.includes("sidekick");
|
|
87103
87056
|
} catch {
|
|
87104
87057
|
return false;
|
|
@@ -87177,7 +87130,7 @@ var require_uninstall = __commonJS({
|
|
|
87177
87130
|
}
|
|
87178
87131
|
}
|
|
87179
87132
|
if (userDetected) {
|
|
87180
|
-
const userSettings = await (0, fs_js_1.readFileOrNull)(path.join(
|
|
87133
|
+
const userSettings = await (0, fs_js_1.readFileOrNull)(path.join((0, core_1.claudeConfigDir)(userHome), "settings.json"));
|
|
87181
87134
|
if (userSettings) {
|
|
87182
87135
|
try {
|
|
87183
87136
|
const settings = JSON.parse(userSettings);
|
|
@@ -87568,7 +87521,7 @@ var require_cli = __commonJS({
|
|
|
87568
87521
|
var promises_12 = require("node:fs/promises");
|
|
87569
87522
|
var node_stream_1 = require("node:stream");
|
|
87570
87523
|
var yargs_parser_1 = __importDefault2(require_build());
|
|
87571
|
-
var VERSION = true ? "0.1.
|
|
87524
|
+
var VERSION = true ? "0.1.32" : "dev";
|
|
87572
87525
|
var SANDBOX_ERROR_MESSAGE = `Error: Daemon commands cannot run in sandbox mode.
|
|
87573
87526
|
|
|
87574
87527
|
Claude Code's sandbox blocks Unix socket operations required for daemon IPC.
|
package/dist/daemon.js
CHANGED
|
@@ -27175,6 +27175,35 @@ var require_error_utils = __commonJS({
|
|
|
27175
27175
|
}
|
|
27176
27176
|
});
|
|
27177
27177
|
|
|
27178
|
+
// ../sidekick-core/dist/claude-paths.js
|
|
27179
|
+
var require_claude_paths = __commonJS({
|
|
27180
|
+
"../sidekick-core/dist/claude-paths.js"(exports2) {
|
|
27181
|
+
"use strict";
|
|
27182
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
27183
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
27184
|
+
};
|
|
27185
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
27186
|
+
exports2.claudeConfigDir = claudeConfigDir;
|
|
27187
|
+
exports2.encodeProjectPath = encodeProjectPath;
|
|
27188
|
+
exports2.reconstructTranscriptPath = reconstructTranscriptPath;
|
|
27189
|
+
var os_1 = require("os");
|
|
27190
|
+
var path_1 = __importDefault(require("path"));
|
|
27191
|
+
function claudeConfigDir(home) {
|
|
27192
|
+
const override = process.env.CLAUDE_CONFIG_DIR?.trim();
|
|
27193
|
+
if (override)
|
|
27194
|
+
return override;
|
|
27195
|
+
return path_1.default.join(home ?? (0, os_1.homedir)(), ".claude");
|
|
27196
|
+
}
|
|
27197
|
+
function encodeProjectPath(projectDir2) {
|
|
27198
|
+
return projectDir2.replace(/\//g, "-");
|
|
27199
|
+
}
|
|
27200
|
+
function reconstructTranscriptPath(projectDir2, sessionId) {
|
|
27201
|
+
const encodedPath = encodeProjectPath(projectDir2);
|
|
27202
|
+
return path_1.default.join(claudeConfigDir(), "projects", encodedPath, `${sessionId}.jsonl`);
|
|
27203
|
+
}
|
|
27204
|
+
}
|
|
27205
|
+
});
|
|
27206
|
+
|
|
27178
27207
|
// ../sidekick-core/dist/assets.js
|
|
27179
27208
|
var require_assets = __commonJS({
|
|
27180
27209
|
"../sidekick-core/dist/assets.js"(exports2) {
|
|
@@ -27189,6 +27218,7 @@ var require_assets = __commonJS({
|
|
|
27189
27218
|
var node_os_1 = require("node:os");
|
|
27190
27219
|
var node_path_1 = require("node:path");
|
|
27191
27220
|
var error_utils_js_1 = require_error_utils();
|
|
27221
|
+
var claude_paths_js_1 = require_claude_paths();
|
|
27192
27222
|
function createCascadingResolver(options) {
|
|
27193
27223
|
const { cascadeLayers } = options;
|
|
27194
27224
|
const findFile = (relativePath) => {
|
|
@@ -27247,7 +27277,7 @@ var require_assets = __commonJS({
|
|
|
27247
27277
|
function buildCascadeLayers(defaultAssetsDir, homeDir, projectRoot) {
|
|
27248
27278
|
const layers = [];
|
|
27249
27279
|
layers.push(defaultAssetsDir);
|
|
27250
|
-
const userInstalled = (0, node_path_1.join)(
|
|
27280
|
+
const userInstalled = (0, node_path_1.join)((0, claude_paths_js_1.claudeConfigDir)(homeDir), "hooks", "sidekick", "assets");
|
|
27251
27281
|
layers.push(userInstalled);
|
|
27252
27282
|
const userPersistent = (0, node_path_1.join)(homeDir, ".sidekick", "assets");
|
|
27253
27283
|
layers.push(userPersistent);
|
|
@@ -27277,28 +27307,6 @@ var require_assets = __commonJS({
|
|
|
27277
27307
|
}
|
|
27278
27308
|
});
|
|
27279
27309
|
|
|
27280
|
-
// ../sidekick-core/dist/claude-paths.js
|
|
27281
|
-
var require_claude_paths = __commonJS({
|
|
27282
|
-
"../sidekick-core/dist/claude-paths.js"(exports2) {
|
|
27283
|
-
"use strict";
|
|
27284
|
-
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
27285
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
27286
|
-
};
|
|
27287
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
27288
|
-
exports2.encodeProjectPath = encodeProjectPath;
|
|
27289
|
-
exports2.reconstructTranscriptPath = reconstructTranscriptPath;
|
|
27290
|
-
var os_1 = require("os");
|
|
27291
|
-
var path_1 = __importDefault(require("path"));
|
|
27292
|
-
function encodeProjectPath(projectDir2) {
|
|
27293
|
-
return projectDir2.replace(/\//g, "-");
|
|
27294
|
-
}
|
|
27295
|
-
function reconstructTranscriptPath(projectDir2, sessionId) {
|
|
27296
|
-
const encodedPath = encodeProjectPath(projectDir2);
|
|
27297
|
-
return path_1.default.join((0, os_1.homedir)(), ".claude", "projects", encodedPath, `${sessionId}.jsonl`);
|
|
27298
|
-
}
|
|
27299
|
-
}
|
|
27300
|
-
});
|
|
27301
|
-
|
|
27302
27310
|
// ../sidekick-core/dist/sidekick-paths.js
|
|
27303
27311
|
var require_sidekick_paths = __commonJS({
|
|
27304
27312
|
"../sidekick-core/dist/sidekick-paths.js"(exports2) {
|
|
@@ -46603,7 +46611,7 @@ var require_build_identity = __commonJS({
|
|
|
46603
46611
|
var path_1 = __importDefault(require("path"));
|
|
46604
46612
|
var DEV_PREFIX = "dev:";
|
|
46605
46613
|
var NO_DIST_SENTINEL = "nodist";
|
|
46606
|
-
function computeBuildIdentity(injectedVersion = true ? "0.1.
|
|
46614
|
+
function computeBuildIdentity(injectedVersion = true ? "0.1.32" : void 0, devFingerprint = computeDevFingerprint) {
|
|
46607
46615
|
return injectedVersion !== void 0 ? injectedVersion : DEV_PREFIX + devFingerprint();
|
|
46608
46616
|
}
|
|
46609
46617
|
function computeDevFingerprint() {
|
|
@@ -58131,6 +58139,7 @@ var require_plugin_detector = __commonJS({
|
|
|
58131
58139
|
var node_child_process_1 = require("node:child_process");
|
|
58132
58140
|
var api_key_detector_js_1 = require_api_key_detector();
|
|
58133
58141
|
var error_utils_js_1 = require_error_utils();
|
|
58142
|
+
var claude_paths_js_1 = require_claude_paths();
|
|
58134
58143
|
function isSidekickStatuslineCommand(command) {
|
|
58135
58144
|
return command?.toLowerCase().includes("sidekick") ?? false;
|
|
58136
58145
|
}
|
|
@@ -58189,7 +58198,7 @@ var require_plugin_detector = __commonJS({
|
|
|
58189
58198
|
});
|
|
58190
58199
|
}
|
|
58191
58200
|
async function detectActualStatusline(projectDir2, homeDir) {
|
|
58192
|
-
const userSettingsPath = path.join(
|
|
58201
|
+
const userSettingsPath = path.join((0, claude_paths_js_1.claudeConfigDir)(homeDir), "settings.json");
|
|
58193
58202
|
const projectSettingsPath = path.join(projectDir2, ".claude", "settings.local.json");
|
|
58194
58203
|
let inUser = false;
|
|
58195
58204
|
let inProject = false;
|
|
@@ -58268,7 +58277,7 @@ var require_plugin_detector = __commonJS({
|
|
|
58268
58277
|
}
|
|
58269
58278
|
async function detectDevModeFromSettings(projectDir2, homeDir) {
|
|
58270
58279
|
const settingsPaths = [
|
|
58271
|
-
path.join(
|
|
58280
|
+
path.join((0, claude_paths_js_1.claudeConfigDir)(homeDir), "settings.json"),
|
|
58272
58281
|
path.join(projectDir2, ".claude", "settings.local.json")
|
|
58273
58282
|
];
|
|
58274
58283
|
for (const settingsPath of settingsPaths) {
|
|
@@ -61013,7 +61022,7 @@ var require_transcript_metrics_engine = __commonJS({
|
|
|
61013
61022
|
exports2.isExcludedBuiltinCommandInvocation = isExcludedBuiltinCommandInvocation;
|
|
61014
61023
|
exports2.updateToolsPerTurn = updateToolsPerTurn;
|
|
61015
61024
|
var transcript_helpers_js_1 = require_transcript_helpers();
|
|
61016
|
-
async function processEntry(entry, lineNumber, metrics, toolUseIdToName, emitEvent) {
|
|
61025
|
+
async function processEntry(entry, lineNumber, metrics, toolUseIdToName, emitEvent, signalCompaction) {
|
|
61017
61026
|
const entryType = entry.type;
|
|
61018
61027
|
switch (entryType) {
|
|
61019
61028
|
case "user": {
|
|
@@ -61042,8 +61051,13 @@ var require_transcript_metrics_engine = __commonJS({
|
|
|
61042
61051
|
await emitEvent("AssistantMessage", entry, lineNumber);
|
|
61043
61052
|
await processNestedToolUses(entry, lineNumber, metrics, toolUseIdToName, emitEvent);
|
|
61044
61053
|
break;
|
|
61045
|
-
case "system":
|
|
61054
|
+
case "system": {
|
|
61055
|
+
const subtype = entry.subtype;
|
|
61056
|
+
if (subtype === "compact_boundary") {
|
|
61057
|
+
await signalCompaction?.(lineNumber);
|
|
61058
|
+
}
|
|
61046
61059
|
break;
|
|
61060
|
+
}
|
|
61047
61061
|
}
|
|
61048
61062
|
}
|
|
61049
61063
|
function extractTokenUsage(entry, metrics) {
|
|
@@ -63501,10 +63515,12 @@ var require_transcript_service = __commonJS({
|
|
|
63501
63515
|
// ============================================================================
|
|
63502
63516
|
// Compaction Management
|
|
63503
63517
|
// ============================================================================
|
|
63504
|
-
async signalCompaction() {
|
|
63518
|
+
async signalCompaction(lineNumber) {
|
|
63519
|
+
if (this.metrics.isPostCompactIndeterminate)
|
|
63520
|
+
return;
|
|
63505
63521
|
this.metrics.currentContextTokens = null;
|
|
63506
63522
|
this.metrics.isPostCompactIndeterminate = true;
|
|
63507
|
-
await this.emitEvent("Compact", {}, this.metrics.lastProcessedLine);
|
|
63523
|
+
await this.emitEvent("Compact", {}, lineNumber ?? this.metrics.lastProcessedLine);
|
|
63508
63524
|
this.notifyMetricsChange();
|
|
63509
63525
|
this.schedulePersistence();
|
|
63510
63526
|
}
|
|
@@ -63562,7 +63578,7 @@ var require_transcript_service = __commonJS({
|
|
|
63562
63578
|
return;
|
|
63563
63579
|
const self = this;
|
|
63564
63580
|
await (0, transcript_file_watcher_js_1.processTranscriptFile)(this.transcriptPath, this.streamingState, this.metrics, async (entry, lineNumber) => {
|
|
63565
|
-
await (0, transcript_metrics_engine_js_1.processEntry)(entry, lineNumber, this.metrics, this.toolUseIdToName, (eventType, e, ln) => this.emitEvent(eventType, e, ln));
|
|
63581
|
+
await (0, transcript_metrics_engine_js_1.processEntry)(entry, lineNumber, this.metrics, this.toolUseIdToName, (eventType, e, ln) => this.emitEvent(eventType, e, ln), (ln) => this.signalCompaction(ln));
|
|
63566
63582
|
}, async (lineNumber, _durationMs) => {
|
|
63567
63583
|
await this.emitEvent("BulkProcessingComplete", {}, lineNumber);
|
|
63568
63584
|
}, this.options.logger, this.sessionId, {
|
|
@@ -64732,9 +64748,9 @@ var require_dist4 = __commonJS({
|
|
|
64732
64748
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
|
|
64733
64749
|
};
|
|
64734
64750
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
64735
|
-
exports2.
|
|
64736
|
-
exports2.
|
|
64737
|
-
exports2.computeBuildIdentity = exports2.CoalescingGuard = exports2.loadUserProfile = exports2.parseGitStatusOutput = exports2.getGitFileStatus = exports2.toErrorMessage = exports2.isInSandbox = exports2.updateDaemonHealth = exports2.readDaemonHealth = exports2.ProjectRegistryService = exports2.encodeProjectDir = exports2.DaemonGlobalLogMetricsDescriptor = exports2.CliLogMetricsDescriptor = exports2.DaemonLogMetricsDescriptor = exports2.CompactionHistoryDescriptor = exports2.TranscriptMetricsDescriptor = exports2.GlobalStateAccessor = exports2.SessionStateAccessor = exports2.globalState = exports2.sessionState = exports2.StateCorruptError = exports2.StateNotFoundError = exports2.StateService = exports2.createHookableLogger = exports2.InstrumentedProfileProviderFactory = exports2.InstrumentedLLMProvider = exports2.ServiceFactoryImpl = exports2.TranscriptServiceImpl = exports2.createDefaultTokenUsage = void 0;
|
|
64751
|
+
exports2.USER_STATUS_FILENAME = exports2.createSetupStatusService = exports2.SetupStatusService = exports2.DaemonClient = exports2.findZombieDaemons = exports2.killZombieDaemons = exports2.killAllDaemons = exports2.SessionLogWriter = exports2.setSessionLogWriter = exports2.logEvent = exports2.LogEvents = exports2.DEFAULT_MAX_FILES = exports2.DEFAULT_ROTATE_SIZE_BYTES = exports2.getComponentLogLevel = exports2.setupGlobalErrorHandlers = exports2.createLoggerFacade = exports2.createLogManager = exports2.createConsoleLogger = exports2.getUserDaemonsDir = exports2.getUserPidPath = exports2.getTokenPath = exports2.getSocketPath = exports2.getProjectHash = exports2.getPidPath = exports2.getLockPath = exports2.IpcService = exports2.IpcServer = exports2.loadPersonaFile = exports2.getDefaultPersonasDir = exports2.discoverPersonas = exports2.createPersonaLoader = exports2.claudeConfigDir = exports2.reconstructTranscriptPath = exports2.encodeProjectPath = exports2.isSubagentStopEvent = exports2.isSubagentStartEvent = exports2.isPreCompactEvent = exports2.isStopEvent = exports2.isPostToolUseEvent = exports2.isPreToolUseEvent = exports2.isUserPromptSubmitEvent = exports2.isSessionEndEvent = exports2.isSessionStartEvent = exports2.isTranscriptEvent = exports2.isHookEvent = exports2.MetricsPersistPayloadSchema = exports2.CleanupPayloadSchema = exports2.ResumeGenerationPayloadSchema = exports2.SessionSummaryPayloadSchema = exports2.TaskTypes = void 0;
|
|
64752
|
+
exports2.copyWithTimestampSync = exports2.renameWithTimestampSync = exports2.renameWithTimestamp = exports2.copyWithTimestamp = exports2.getTimestampedPath = exports2.extractToolResultPreview = exports2.extractToolCallPreview = exports2.extractTextFromContent = exports2.extractContentPreview = exports2.HandlerRegistryImpl = exports2.extractConsumedTimestamp = exports2.createConsumedFilePattern = exports2.CONSUMED_FILE_PATTERN = exports2.filterActiveReminderFiles = exports2.validatePathSegment = exports2.isValidPathSegment = exports2.getReminderPath = exports2.getHookDir = exports2.getStagingRoot = exports2.SessionScopedStagingService = exports2.StagingServiceCore = exports2.GITIGNORE_ENTRIES = exports2.SIDEKICK_GITIGNORE_HEADER = exports2.SIDEKICK_SECTION_END = exports2.SIDEKICK_SECTION_START = exports2.removeLegacyGitignoreSection = exports2.detectLegacyGitignoreSection = exports2.detectGitignoreStatus = exports2.removeGitignoreSection = exports2.installGitignoreSection = exports2.validateOpenAIKey = exports2.validateOpenRouterKey = exports2.runDoctorCheck = exports2.detectPluginLiveness = exports2.detectPluginInstallation = exports2.detectDevModeFromSettings = exports2.detectActualStatusline = exports2.spawnWithTimeout = exports2.getDoctorTimeout = exports2.DOCTOR_TIMEOUTS = exports2.projectApiKeyStatusFromHealth = exports2.userApiKeyStatusFromHealth = exports2.buildProjectApiKeyStatus = exports2.buildUserApiKeyStatus = exports2.detectAllApiKeys = exports2.detectActualApiKey = exports2.readKeyFromEnvFile = exports2.determineOverallStatus = exports2.toScopeStatus = exports2.PROJECT_STATUS_FILENAME = void 0;
|
|
64753
|
+
exports2.computeBuildIdentity = exports2.CoalescingGuard = exports2.loadUserProfile = exports2.parseGitStatusOutput = exports2.getGitFileStatus = exports2.toErrorMessage = exports2.isInSandbox = exports2.updateDaemonHealth = exports2.readDaemonHealth = exports2.ProjectRegistryService = exports2.encodeProjectDir = exports2.DaemonGlobalLogMetricsDescriptor = exports2.CliLogMetricsDescriptor = exports2.DaemonLogMetricsDescriptor = exports2.CompactionHistoryDescriptor = exports2.TranscriptMetricsDescriptor = exports2.GlobalStateAccessor = exports2.SessionStateAccessor = exports2.globalState = exports2.sessionState = exports2.StateCorruptError = exports2.StateNotFoundError = exports2.StateService = exports2.createHookableLogger = exports2.InstrumentedProfileProviderFactory = exports2.InstrumentedLLMProvider = exports2.ServiceFactoryImpl = exports2.TranscriptServiceImpl = exports2.createDefaultTokenUsage = exports2.createDefaultMetrics = void 0;
|
|
64738
64754
|
var types_1 = require_dist();
|
|
64739
64755
|
Object.defineProperty(exports2, "TaskTypes", { enumerable: true, get: function() {
|
|
64740
64756
|
return types_1.TaskTypes;
|
|
@@ -64793,6 +64809,9 @@ var require_dist4 = __commonJS({
|
|
|
64793
64809
|
Object.defineProperty(exports2, "reconstructTranscriptPath", { enumerable: true, get: function() {
|
|
64794
64810
|
return claude_paths_1.reconstructTranscriptPath;
|
|
64795
64811
|
} });
|
|
64812
|
+
Object.defineProperty(exports2, "claudeConfigDir", { enumerable: true, get: function() {
|
|
64813
|
+
return claude_paths_1.claudeConfigDir;
|
|
64814
|
+
} });
|
|
64796
64815
|
__exportStar(require_sidekick_paths(), exports2);
|
|
64797
64816
|
var persona_loader_1 = require_persona_loader();
|
|
64798
64817
|
Object.defineProperty(exports2, "createPersonaLoader", { enumerable: true, get: function() {
|
|
@@ -76918,28 +76937,6 @@ var require_dist5 = __commonJS({
|
|
|
76918
76937
|
}
|
|
76919
76938
|
});
|
|
76920
76939
|
|
|
76921
|
-
// ../feature-reminders/dist/handlers/consumption/session-type-gate.js
|
|
76922
|
-
var require_session_type_gate = __commonJS({
|
|
76923
|
-
"../feature-reminders/dist/handlers/consumption/session-type-gate.js"(exports2) {
|
|
76924
|
-
"use strict";
|
|
76925
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
76926
|
-
exports2.suppressReminderForSessionType = suppressReminderForSessionType;
|
|
76927
|
-
var types_js_1 = require_types2();
|
|
76928
|
-
var PERSONA_REMINDERS = /* @__PURE__ */ new Set([types_js_1.ReminderIds.REMEMBER_YOUR_PERSONA, types_js_1.ReminderIds.PERSONA_CHANGED]);
|
|
76929
|
-
function suppressReminderForSessionType(reminderName, sessionType, config) {
|
|
76930
|
-
if (sessionType !== "non-interactive")
|
|
76931
|
-
return false;
|
|
76932
|
-
if (PERSONA_REMINDERS.has(reminderName)) {
|
|
76933
|
-
return config.injectPersonaIntoNonInteractiveSessions !== true;
|
|
76934
|
-
}
|
|
76935
|
-
if (reminderName === types_js_1.ReminderIds.CAVEMAN_MODE) {
|
|
76936
|
-
return config.injectCavemanIntoNonInteractiveSessions !== true;
|
|
76937
|
-
}
|
|
76938
|
-
return false;
|
|
76939
|
-
}
|
|
76940
|
-
}
|
|
76941
|
-
});
|
|
76942
|
-
|
|
76943
76940
|
// ../feature-reminders/dist/handlers/staging/stage-persona-reminders.js
|
|
76944
76941
|
var require_stage_persona_reminders = __commonJS({
|
|
76945
76942
|
"../feature-reminders/dist/handlers/staging/stage-persona-reminders.js"(exports2) {
|
|
@@ -76947,7 +76944,6 @@ var require_stage_persona_reminders = __commonJS({
|
|
|
76947
76944
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
76948
76945
|
exports2.restagePersonaRemindersForActiveSessions = restagePersonaRemindersForActiveSessions;
|
|
76949
76946
|
exports2.stagePersonaRemindersForSession = stagePersonaRemindersForSession;
|
|
76950
|
-
exports2.resolvePersonaContextForSnapshot = resolvePersonaContextForSnapshot;
|
|
76951
76947
|
exports2.registerStagePersonaReminders = registerStagePersonaReminders;
|
|
76952
76948
|
var core_1 = require_dist4();
|
|
76953
76949
|
var feature_session_summary_1 = require_dist5();
|
|
@@ -76955,7 +76951,6 @@ var require_stage_persona_reminders = __commonJS({
|
|
|
76955
76951
|
var types_1 = require_dist();
|
|
76956
76952
|
var reminder_utils_js_1 = require_reminder_utils();
|
|
76957
76953
|
var types_js_1 = require_types2();
|
|
76958
|
-
var session_type_gate_js_1 = require_session_type_gate();
|
|
76959
76954
|
var throttle_utils_js_1 = require_throttle_utils();
|
|
76960
76955
|
async function restagePersonaRemindersForActiveSessions(ctxFactory, sessionIds, logger) {
|
|
76961
76956
|
logger.info("Re-staging persona reminders for active sessions", { count: sessionIds.length });
|
|
@@ -77168,24 +77163,6 @@ var require_stage_persona_reminders = __commonJS({
|
|
|
77168
77163
|
includeChanged: options?.includeChangedReminder ?? false
|
|
77169
77164
|
});
|
|
77170
77165
|
}
|
|
77171
|
-
async function resolvePersonaContextForSnapshot(ctx, sessionId) {
|
|
77172
|
-
if (!isPersonaInjectionEnabled(ctx))
|
|
77173
|
-
return void 0;
|
|
77174
|
-
const personaConfig = ctx.config.getFeature("session-summary").settings?.personas ?? {};
|
|
77175
|
-
if ((0, session_type_gate_js_1.suppressReminderForSessionType)(types_js_1.ReminderIds.REMEMBER_YOUR_PERSONA, ctx.sessionType, personaConfig)) {
|
|
77176
|
-
return void 0;
|
|
77177
|
-
}
|
|
77178
|
-
const persona = await loadPersonaForSession(ctx, sessionId);
|
|
77179
|
-
if (!persona)
|
|
77180
|
-
return void 0;
|
|
77181
|
-
const templateContext = buildPersonaTemplateContext(persona);
|
|
77182
|
-
const reminder = (0, reminder_utils_js_1.resolveReminder)(types_js_1.ReminderIds.REMEMBER_YOUR_PERSONA, {
|
|
77183
|
-
context: templateContext,
|
|
77184
|
-
assets: ctx.assets,
|
|
77185
|
-
logger: ctx.logger
|
|
77186
|
-
});
|
|
77187
|
-
return reminder?.additionalContext ?? void 0;
|
|
77188
|
-
}
|
|
77189
77166
|
function registerStagePersonaReminders(context) {
|
|
77190
77167
|
if (!(0, types_1.isDaemonContext)(context))
|
|
77191
77168
|
return;
|
|
@@ -77214,7 +77191,6 @@ var require_stage_user_profile_reminders = __commonJS({
|
|
|
77214
77191
|
"use strict";
|
|
77215
77192
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
77216
77193
|
exports2.stageUserProfileRemindersForSession = stageUserProfileRemindersForSession;
|
|
77217
|
-
exports2.resolveUserProfileContextForSnapshot = resolveUserProfileContextForSnapshot;
|
|
77218
77194
|
exports2.registerStageUserProfileReminders = registerStageUserProfileReminders;
|
|
77219
77195
|
var core_1 = require_dist4();
|
|
77220
77196
|
var events_js_1 = require_events2();
|
|
@@ -77254,21 +77230,6 @@ var require_stage_user_profile_reminders = __commonJS({
|
|
|
77254
77230
|
ctx.logger.warn("Failed to resolve user-profile reminder", { sessionId });
|
|
77255
77231
|
}
|
|
77256
77232
|
}
|
|
77257
|
-
function resolveUserProfileContextForSnapshot(ctx) {
|
|
77258
|
-
const profile = (0, core_1.loadUserProfile)({ logger: ctx.logger });
|
|
77259
|
-
if (!profile)
|
|
77260
|
-
return void 0;
|
|
77261
|
-
const templateContext = {
|
|
77262
|
-
user_name: profile.name,
|
|
77263
|
-
user_role: profile.role,
|
|
77264
|
-
user_interests: profile.interests.join(", ")
|
|
77265
|
-
};
|
|
77266
|
-
const reminder = (0, reminder_utils_js_1.resolveReminder)(types_js_1.ReminderIds.USER_PROFILE, {
|
|
77267
|
-
context: templateContext,
|
|
77268
|
-
assets: ctx.assets
|
|
77269
|
-
});
|
|
77270
|
-
return reminder?.additionalContext ?? void 0;
|
|
77271
|
-
}
|
|
77272
77233
|
function registerStageUserProfileReminders(context) {
|
|
77273
77234
|
if (!(0, types_1.isDaemonContext)(context))
|
|
77274
77235
|
return;
|
|
@@ -77560,6 +77521,28 @@ var require_cli_staging_reader = __commonJS({
|
|
|
77560
77521
|
}
|
|
77561
77522
|
});
|
|
77562
77523
|
|
|
77524
|
+
// ../feature-reminders/dist/handlers/consumption/session-type-gate.js
|
|
77525
|
+
var require_session_type_gate = __commonJS({
|
|
77526
|
+
"../feature-reminders/dist/handlers/consumption/session-type-gate.js"(exports2) {
|
|
77527
|
+
"use strict";
|
|
77528
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
77529
|
+
exports2.suppressReminderForSessionType = suppressReminderForSessionType;
|
|
77530
|
+
var types_js_1 = require_types2();
|
|
77531
|
+
var PERSONA_REMINDERS = /* @__PURE__ */ new Set([types_js_1.ReminderIds.REMEMBER_YOUR_PERSONA, types_js_1.ReminderIds.PERSONA_CHANGED]);
|
|
77532
|
+
function suppressReminderForSessionType(reminderName, sessionType, config) {
|
|
77533
|
+
if (sessionType !== "non-interactive")
|
|
77534
|
+
return false;
|
|
77535
|
+
if (PERSONA_REMINDERS.has(reminderName)) {
|
|
77536
|
+
return config.injectPersonaIntoNonInteractiveSessions !== true;
|
|
77537
|
+
}
|
|
77538
|
+
if (reminderName === types_js_1.ReminderIds.CAVEMAN_MODE) {
|
|
77539
|
+
return config.injectCavemanIntoNonInteractiveSessions !== true;
|
|
77540
|
+
}
|
|
77541
|
+
return false;
|
|
77542
|
+
}
|
|
77543
|
+
}
|
|
77544
|
+
});
|
|
77545
|
+
|
|
77563
77546
|
// ../feature-reminders/dist/handlers/consumption/consumption-handler-factory.js
|
|
77564
77547
|
var require_consumption_handler_factory = __commonJS({
|
|
77565
77548
|
"../feature-reminders/dist/handlers/consumption/consumption-handler-factory.js"(exports2) {
|
|
@@ -77872,22 +77855,6 @@ var require_inject_session_start = __commonJS({
|
|
|
77872
77855
|
}
|
|
77873
77856
|
});
|
|
77874
77857
|
|
|
77875
|
-
// ../feature-reminders/dist/handlers/consumption/inject-post-compact.js
|
|
77876
|
-
var require_inject_post_compact = __commonJS({
|
|
77877
|
-
"../feature-reminders/dist/handlers/consumption/inject-post-compact.js"(exports2) {
|
|
77878
|
-
"use strict";
|
|
77879
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
77880
|
-
exports2.registerInjectPostCompact = registerInjectPostCompact;
|
|
77881
|
-
var consumption_handler_factory_js_1 = require_consumption_handler_factory();
|
|
77882
|
-
function registerInjectPostCompact(context) {
|
|
77883
|
-
(0, consumption_handler_factory_js_1.createConsumptionHandler)(context, {
|
|
77884
|
-
id: "reminders:inject-post-compact",
|
|
77885
|
-
hook: "PostCompact"
|
|
77886
|
-
});
|
|
77887
|
-
}
|
|
77888
|
-
}
|
|
77889
|
-
});
|
|
77890
|
-
|
|
77891
77858
|
// ../feature-reminders/dist/handlers/consumption/index.js
|
|
77892
77859
|
var require_consumption = __commonJS({
|
|
77893
77860
|
"../feature-reminders/dist/handlers/consumption/index.js"(exports2) {
|
|
@@ -77899,14 +77866,12 @@ var require_consumption = __commonJS({
|
|
|
77899
77866
|
var inject_post_tool_use_1 = require_inject_post_tool_use();
|
|
77900
77867
|
var inject_stop_1 = require_inject_stop();
|
|
77901
77868
|
var inject_session_start_1 = require_inject_session_start();
|
|
77902
|
-
var inject_post_compact_js_1 = require_inject_post_compact();
|
|
77903
77869
|
function registerConsumptionHandlers(context) {
|
|
77904
77870
|
(0, inject_user_prompt_submit_1.registerInjectUserPromptSubmit)(context);
|
|
77905
77871
|
(0, inject_pre_tool_use_1.registerInjectPreToolUse)(context);
|
|
77906
77872
|
(0, inject_post_tool_use_1.registerInjectPostToolUse)(context);
|
|
77907
77873
|
(0, inject_stop_1.registerInjectStop)(context);
|
|
77908
77874
|
(0, inject_session_start_1.registerInjectSessionStart)(context);
|
|
77909
|
-
(0, inject_post_compact_js_1.registerInjectPostCompact)(context);
|
|
77910
77875
|
}
|
|
77911
77876
|
}
|
|
77912
77877
|
});
|
|
@@ -78351,7 +78316,7 @@ var require_dist6 = __commonJS({
|
|
|
78351
78316
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
|
|
78352
78317
|
};
|
|
78353
78318
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
78354
|
-
exports2.createRemindersState = exports2.ReminderOrchestrator = exports2.ReminderEvents = exports2.handleVCUnverifiedClear = exports2.handleVCUnverifiedSet = exports2.handleReminderConsumed = exports2.classifyCompletion = exports2.
|
|
78319
|
+
exports2.createRemindersState = exports2.ReminderOrchestrator = exports2.ReminderEvents = exports2.handleVCUnverifiedClear = exports2.handleVCUnverifiedSet = exports2.handleReminderConsumed = exports2.classifyCompletion = exports2.restagePersonaRemindersForActiveSessions = exports2.stagePersonaRemindersForSession = exports2.registerStagingHandlers = exports2.registerConsumptionHandlers = exports2.manifest = void 0;
|
|
78355
78320
|
exports2.register = register;
|
|
78356
78321
|
var staging_1 = require_staging2();
|
|
78357
78322
|
var consumption_1 = require_consumption();
|
|
@@ -78385,13 +78350,6 @@ var require_dist6 = __commonJS({
|
|
|
78385
78350
|
Object.defineProperty(exports2, "restagePersonaRemindersForActiveSessions", { enumerable: true, get: function() {
|
|
78386
78351
|
return stage_persona_reminders_1.restagePersonaRemindersForActiveSessions;
|
|
78387
78352
|
} });
|
|
78388
|
-
Object.defineProperty(exports2, "resolvePersonaContextForSnapshot", { enumerable: true, get: function() {
|
|
78389
|
-
return stage_persona_reminders_1.resolvePersonaContextForSnapshot;
|
|
78390
|
-
} });
|
|
78391
|
-
var stage_user_profile_reminders_1 = require_stage_user_profile_reminders();
|
|
78392
|
-
Object.defineProperty(exports2, "resolveUserProfileContextForSnapshot", { enumerable: true, get: function() {
|
|
78393
|
-
return stage_user_profile_reminders_1.resolveUserProfileContextForSnapshot;
|
|
78394
|
-
} });
|
|
78395
78353
|
var completion_classifier_1 = require_completion_classifier();
|
|
78396
78354
|
Object.defineProperty(exports2, "classifyCompletion", { enumerable: true, get: function() {
|
|
78397
78355
|
return completion_classifier_1.classifyCompletion;
|
|
@@ -80702,8 +80660,6 @@ var require_daemon = __commonJS({
|
|
|
80702
80660
|
registryService;
|
|
80703
80661
|
timerManager;
|
|
80704
80662
|
sessionLogWriter;
|
|
80705
|
-
/** In-memory compaction snapshots keyed by sessionId. Populated by PreCompact, consumed by PostCompact. */
|
|
80706
|
-
compactionSnapshots = /* @__PURE__ */ new Map();
|
|
80707
80663
|
/**
|
|
80708
80664
|
* Parent session type keyed by sessionId. Only updated by parent hooks
|
|
80709
80665
|
* (interactive/non-interactive); subagent 'agent' hooks share the parent
|
|
@@ -81189,36 +81145,29 @@ var require_daemon = __commonJS({
|
|
|
81189
81145
|
if (hook === "UserPromptSubmit") {
|
|
81190
81146
|
await this.handleUserPromptSubmitCleanup(event, { logger: requestLogger });
|
|
81191
81147
|
}
|
|
81192
|
-
if (hook === "PreCompact") {
|
|
81193
|
-
await this.handlePreCompact(event, { logger: requestLogger });
|
|
81194
|
-
}
|
|
81195
|
-
let postCompactResponse;
|
|
81196
81148
|
if (hook === "PostCompact") {
|
|
81197
|
-
|
|
81149
|
+
await this.handlePostCompact(event, { logger: requestLogger });
|
|
81198
81150
|
}
|
|
81199
81151
|
if (sessionId && !this.logMetrics.hasSession(sessionId)) {
|
|
81200
81152
|
await this.logMetrics.initSessionCounters(sessionId, false);
|
|
81201
81153
|
requestLogger.debug("Log counters initialized from file for hook", { hook });
|
|
81202
81154
|
}
|
|
81203
|
-
|
|
81204
|
-
if (postCompactResponse?.additionalContext) {
|
|
81205
|
-
const registryContext = response.additionalContext;
|
|
81206
|
-
response.additionalContext = registryContext ? `${registryContext}
|
|
81207
|
-
|
|
81208
|
-
${postCompactResponse.additionalContext}` : postCompactResponse.additionalContext;
|
|
81209
|
-
}
|
|
81210
|
-
return response;
|
|
81155
|
+
return this.handlerRegistry.invokeHook(hook, event, { logger: requestLogger });
|
|
81211
81156
|
}
|
|
81212
81157
|
/**
|
|
81213
|
-
* Handle PostCompact: signal compaction to the session's TranscriptService
|
|
81214
|
-
*
|
|
81158
|
+
* Handle PostCompact: signal compaction to the session's TranscriptService.
|
|
81159
|
+
*
|
|
81160
|
+
* PostCompact does not re-inject session context: Claude Code's PostCompact hook-output
|
|
81161
|
+
* schema has no additionalContext variant, so any snapshot would be rejected. Persona and
|
|
81162
|
+
* user-profile context are re-established after compaction via the SessionStart:compact
|
|
81163
|
+
* staging path instead.
|
|
81215
81164
|
*/
|
|
81216
81165
|
async handlePostCompact(event, options) {
|
|
81217
81166
|
const log = options?.logger ?? this.logger;
|
|
81218
81167
|
const sessionId = event.context?.sessionId;
|
|
81219
81168
|
if (!sessionId) {
|
|
81220
81169
|
log.warn("PostCompact event missing sessionId");
|
|
81221
|
-
return
|
|
81170
|
+
return;
|
|
81222
81171
|
}
|
|
81223
81172
|
const transcriptService = this.serviceFactory.getTranscriptService(sessionId);
|
|
81224
81173
|
if (transcriptService) {
|
|
@@ -81227,82 +81176,6 @@ ${postCompactResponse.additionalContext}` : postCompactResponse.additionalContex
|
|
|
81227
81176
|
} else {
|
|
81228
81177
|
log.warn("PostCompact: no transcript service for session", { sessionId });
|
|
81229
81178
|
}
|
|
81230
|
-
const snapshot = this.compactionSnapshots.get(sessionId);
|
|
81231
|
-
if (snapshot) {
|
|
81232
|
-
this.compactionSnapshots.delete(sessionId);
|
|
81233
|
-
log.info("PostCompact: re-injecting compaction snapshot", {
|
|
81234
|
-
sessionId,
|
|
81235
|
-
snapshotLength: snapshot.length
|
|
81236
|
-
});
|
|
81237
|
-
return { additionalContext: snapshot };
|
|
81238
|
-
}
|
|
81239
|
-
return {};
|
|
81240
|
-
}
|
|
81241
|
-
/**
|
|
81242
|
-
* Handle PreCompact: capture staged SessionStart reminders as a compaction snapshot.
|
|
81243
|
-
* The snapshot is returned by the next PostCompact call for context re-injection.
|
|
81244
|
-
*/
|
|
81245
|
-
async handlePreCompact(event, options) {
|
|
81246
|
-
const log = options?.logger ?? this.logger;
|
|
81247
|
-
const sessionId = event.context?.sessionId;
|
|
81248
|
-
if (!sessionId)
|
|
81249
|
-
return;
|
|
81250
|
-
try {
|
|
81251
|
-
const minimalCtx = {
|
|
81252
|
-
role: "daemon",
|
|
81253
|
-
config: {
|
|
81254
|
-
core: {
|
|
81255
|
-
logging: {
|
|
81256
|
-
level: this.configService.core.logging.level,
|
|
81257
|
-
components: this.configService.core.logging.components
|
|
81258
|
-
},
|
|
81259
|
-
development: { enabled: this.configService.core.development.enabled }
|
|
81260
|
-
},
|
|
81261
|
-
llm: {
|
|
81262
|
-
defaultProfile: this.configService.llm.defaultProfile,
|
|
81263
|
-
defaultFallbackProfileId: this.configService.llm.defaultFallbackProfileId,
|
|
81264
|
-
profiles: this.configService.llm.profiles,
|
|
81265
|
-
fallbackProfiles: this.configService.llm.fallbackProfiles
|
|
81266
|
-
},
|
|
81267
|
-
getAll: () => this.configService.getAll(),
|
|
81268
|
-
getFeature: (name) => this.configService.getFeature(name)
|
|
81269
|
-
},
|
|
81270
|
-
logger: log,
|
|
81271
|
-
assets: this.assetResolver,
|
|
81272
|
-
paths: this.buildRuntimePaths(),
|
|
81273
|
-
stateService: this.stateService,
|
|
81274
|
-
// Remaining DaemonContext fields are not needed by the resolve functions
|
|
81275
|
-
handlers: this.handlerRegistry,
|
|
81276
|
-
staging: this.serviceFactory.getStagingService(sessionId),
|
|
81277
|
-
transcript: void 0,
|
|
81278
|
-
llm: void 0,
|
|
81279
|
-
profileFactory: void 0,
|
|
81280
|
-
orchestrator: this.orchestrator,
|
|
81281
|
-
personaClearCache: { consume: () => this.consumeCachedPersona() },
|
|
81282
|
-
sessionType: this.sessionTypes.get(sessionId) ?? "interactive"
|
|
81283
|
-
};
|
|
81284
|
-
const [personaContext, userProfileContext] = await Promise.all([
|
|
81285
|
-
(0, feature_reminders_1.resolvePersonaContextForSnapshot)(minimalCtx, sessionId),
|
|
81286
|
-
Promise.resolve((0, feature_reminders_1.resolveUserProfileContextForSnapshot)(minimalCtx))
|
|
81287
|
-
]);
|
|
81288
|
-
const contextParts = [personaContext, userProfileContext].filter((c) => typeof c === "string" && c.trim().length > 0);
|
|
81289
|
-
if (contextParts.length === 0) {
|
|
81290
|
-
log.debug("PreCompact: no context to snapshot", { sessionId });
|
|
81291
|
-
return;
|
|
81292
|
-
}
|
|
81293
|
-
const snapshot = ["Context was compacted. Re-establishing session context:", "", ...contextParts].join("\n");
|
|
81294
|
-
this.compactionSnapshots.set(sessionId, snapshot);
|
|
81295
|
-
log.info("PreCompact: compaction snapshot captured", {
|
|
81296
|
-
sessionId,
|
|
81297
|
-
reminderCount: contextParts.length,
|
|
81298
|
-
snapshotLength: snapshot.length
|
|
81299
|
-
});
|
|
81300
|
-
} catch (err) {
|
|
81301
|
-
log.warn("PreCompact: failed to capture snapshot", {
|
|
81302
|
-
sessionId,
|
|
81303
|
-
error: (0, core_1.toErrorMessage)(err)
|
|
81304
|
-
});
|
|
81305
|
-
}
|
|
81306
81179
|
}
|
|
81307
81180
|
/**
|
|
81308
81181
|
* Handle SessionStart-specific logic: clear staging on startup/clear.
|
|
@@ -81388,7 +81261,6 @@ ${postCompactResponse.additionalContext}` : postCompactResponse.additionalContex
|
|
|
81388
81261
|
}
|
|
81389
81262
|
await this.llmManager.shutdownSessionProvider(sessionId, log);
|
|
81390
81263
|
this.logMetrics.deleteSessionCounters(sessionId);
|
|
81391
|
-
this.compactionSnapshots.delete(sessionId);
|
|
81392
81264
|
await this.serviceFactory.shutdownSession(sessionId);
|
|
81393
81265
|
await this.sessionLogWriter.closeSession(sessionId);
|
|
81394
81266
|
log.info("Session ended");
|