@scotthamilton77/sidekick 0.1.2 → 0.1.4
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/assets/sidekick/defaults/features/reminders.defaults.yaml +256 -0
- package/assets/sidekick/prompts/session-summary.prompt.txt +38 -0
- package/assets/sidekick/reminders/vc-build.yaml +15 -0
- package/assets/sidekick/reminders/vc-lint.yaml +15 -0
- package/assets/sidekick/reminders/vc-test.yaml +15 -0
- package/assets/sidekick/reminders/vc-typecheck.yaml +15 -0
- package/assets/sidekick/reminders/verify-completion.yaml +5 -20
- package/dist/bin.js +419 -87
- package/dist/daemon.js +455 -178
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -17213,7 +17213,7 @@ var require_state = __commonJS({
|
|
|
17213
17213
|
"../types/dist/services/state.js"(exports2) {
|
|
17214
17214
|
"use strict";
|
|
17215
17215
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
17216
|
-
exports2.DEFAULT_LATENCY_STATS = exports2.LLMMetricsStateSchema = exports2.LLMSessionTotalsSchema = exports2.LLMProviderMetricsSchema = exports2.LLMModelMetricsSchema = exports2.LLMLatencyStatsSchema = exports2.DEFAULT_PROJECT_METRICS = exports2.DEFAULT_BASE_METRICS = exports2.SessionContextMetricsSchema = exports2.ProjectContextMetricsSchema = exports2.BaseTokenMetricsStateSchema = exports2.VCUnverifiedStateSchema = exports2.PRBaselineStateSchema = exports2.EMPTY_LOG_METRICS = exports2.LogMetricsStateSchema = exports2.TranscriptMetricsStateSchema = exports2.ResumeMessageStateSchema = exports2.SnarkyMessageStateSchema = exports2.SummaryCountdownStateSchema = exports2.LastStagedPersonaSchema = exports2.SessionPersonaStateSchema = exports2.SESSION_SUMMARY_PLACEHOLDERS = exports2.SessionSummaryStateSchema = void 0;
|
|
17216
|
+
exports2.DEFAULT_LATENCY_STATS = exports2.LLMMetricsStateSchema = exports2.LLMSessionTotalsSchema = exports2.LLMProviderMetricsSchema = exports2.LLMModelMetricsSchema = exports2.LLMLatencyStatsSchema = exports2.DEFAULT_PROJECT_METRICS = exports2.DEFAULT_BASE_METRICS = exports2.SessionContextMetricsSchema = exports2.ProjectContextMetricsSchema = exports2.BaseTokenMetricsStateSchema = exports2.VerificationToolsStateSchema = exports2.VerificationToolStatusSchema = exports2.VCUnverifiedStateSchema = exports2.PRBaselineStateSchema = exports2.EMPTY_LOG_METRICS = exports2.LogMetricsStateSchema = exports2.TranscriptMetricsStateSchema = exports2.ResumeMessageStateSchema = exports2.SnarkyMessageStateSchema = exports2.SummaryCountdownStateSchema = exports2.LastStagedPersonaSchema = exports2.SessionPersonaStateSchema = exports2.SESSION_SUMMARY_PLACEHOLDERS = exports2.SessionSummaryStateSchema = void 0;
|
|
17217
17217
|
exports2.createDefaultLLMMetrics = createDefaultLLMMetrics;
|
|
17218
17218
|
var zod_1 = require_zod();
|
|
17219
17219
|
exports2.SessionSummaryStateSchema = zod_1.z.object({
|
|
@@ -17362,6 +17362,21 @@ var require_state = __commonJS({
|
|
|
17362
17362
|
confidence: zod_1.z.number()
|
|
17363
17363
|
})
|
|
17364
17364
|
});
|
|
17365
|
+
exports2.VerificationToolStatusSchema = zod_1.z.object({
|
|
17366
|
+
/** Current state: staged (needs run), verified (recently run), cooldown (post-verified, counting edits) */
|
|
17367
|
+
status: zod_1.z.enum(["staged", "verified", "cooldown"]),
|
|
17368
|
+
/** Number of qualifying file edits since last verification */
|
|
17369
|
+
editsSinceVerified: zod_1.z.number(),
|
|
17370
|
+
/** Unix timestamp (ms) when last verified, null if never */
|
|
17371
|
+
lastVerifiedAt: zod_1.z.number().nullable(),
|
|
17372
|
+
/** Unix timestamp (ms) when last staged, null if never */
|
|
17373
|
+
lastStagedAt: zod_1.z.number().nullable(),
|
|
17374
|
+
/** tool_id of the pattern that last matched (metadata for future scope-aware logic) */
|
|
17375
|
+
lastMatchedToolId: zod_1.z.string().nullable().optional(),
|
|
17376
|
+
/** Scope of the last matched pattern */
|
|
17377
|
+
lastMatchedScope: zod_1.z.enum(["project", "package", "file"]).nullable().optional()
|
|
17378
|
+
});
|
|
17379
|
+
exports2.VerificationToolsStateSchema = zod_1.z.record(zod_1.z.string(), exports2.VerificationToolStatusSchema);
|
|
17365
17380
|
exports2.BaseTokenMetricsStateSchema = zod_1.z.object({
|
|
17366
17381
|
/** System prompt tokens (~3.2k) */
|
|
17367
17382
|
systemPromptTokens: zod_1.z.number(),
|
|
@@ -71078,7 +71093,154 @@ var require_types2 = __commonJS({
|
|
|
71078
71093
|
"../feature-reminders/dist/types.js"(exports2) {
|
|
71079
71094
|
"use strict";
|
|
71080
71095
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
71081
|
-
exports2.ReminderIds = exports2.DEFAULT_REMINDERS_SETTINGS = exports2.DEFAULT_COMPLETION_DETECTION_SETTINGS = exports2.DEFAULT_SOURCE_CODE_PATTERNS = void 0;
|
|
71096
|
+
exports2.ALL_VC_REMINDER_IDS = exports2.VC_TOOL_REMINDER_IDS = exports2.ReminderIds = exports2.DEFAULT_REMINDERS_SETTINGS = exports2.DEFAULT_COMPLETION_DETECTION_SETTINGS = exports2.DEFAULT_SOURCE_CODE_PATTERNS = exports2.DEFAULT_VERIFICATION_TOOLS = exports2.VerificationToolsMapSchema = exports2.VerificationToolConfigSchema = exports2.ToolPatternSchema = exports2.ToolPatternScopeSchema = void 0;
|
|
71097
|
+
var zod_1 = require_zod2();
|
|
71098
|
+
exports2.ToolPatternScopeSchema = zod_1.z.enum(["project", "package", "file"]);
|
|
71099
|
+
exports2.ToolPatternSchema = zod_1.z.object({
|
|
71100
|
+
tool_id: zod_1.z.string(),
|
|
71101
|
+
tool: zod_1.z.string().nullable(),
|
|
71102
|
+
scope: exports2.ToolPatternScopeSchema.default("project")
|
|
71103
|
+
});
|
|
71104
|
+
exports2.VerificationToolConfigSchema = zod_1.z.object({
|
|
71105
|
+
enabled: zod_1.z.boolean(),
|
|
71106
|
+
patterns: zod_1.z.array(exports2.ToolPatternSchema).min(1),
|
|
71107
|
+
clearing_threshold: zod_1.z.number().int().positive(),
|
|
71108
|
+
clearing_patterns: zod_1.z.array(zod_1.z.string()).min(1)
|
|
71109
|
+
});
|
|
71110
|
+
exports2.VerificationToolsMapSchema = zod_1.z.record(zod_1.z.string(), exports2.VerificationToolConfigSchema);
|
|
71111
|
+
exports2.DEFAULT_VERIFICATION_TOOLS = {
|
|
71112
|
+
build: {
|
|
71113
|
+
enabled: true,
|
|
71114
|
+
patterns: [
|
|
71115
|
+
// TypeScript/JavaScript
|
|
71116
|
+
{ tool_id: "tsc", tool: "tsc", scope: "project" },
|
|
71117
|
+
{ tool_id: "esbuild", tool: "esbuild", scope: "file" },
|
|
71118
|
+
{ tool_id: "pnpm-filter-build", tool: "pnpm --filter * build", scope: "package" },
|
|
71119
|
+
{ tool_id: "pnpm-build", tool: "pnpm build", scope: "project" },
|
|
71120
|
+
{ tool_id: "npm-build", tool: "npm run build", scope: "project" },
|
|
71121
|
+
{ tool_id: "yarn-workspace-build", tool: "yarn workspace * build", scope: "package" },
|
|
71122
|
+
{ tool_id: "yarn-build", tool: "yarn build", scope: "project" },
|
|
71123
|
+
// Python
|
|
71124
|
+
{ tool_id: "python-setup-build", tool: "python setup.py build", scope: "project" },
|
|
71125
|
+
{ tool_id: "pip-install", tool: "pip install", scope: "project" },
|
|
71126
|
+
{ tool_id: "poetry-build", tool: "poetry build", scope: "project" },
|
|
71127
|
+
// JVM
|
|
71128
|
+
{ tool_id: "mvn-compile", tool: "mvn compile", scope: "project" },
|
|
71129
|
+
{ tool_id: "mvn-package", tool: "mvn package", scope: "project" },
|
|
71130
|
+
{ tool_id: "gradle-build", tool: "gradle build", scope: "project" },
|
|
71131
|
+
{ tool_id: "gradlew-build", tool: "./gradlew build", scope: "project" },
|
|
71132
|
+
// Go
|
|
71133
|
+
{ tool_id: "go-build", tool: "go build", scope: "project" },
|
|
71134
|
+
// Rust
|
|
71135
|
+
{ tool_id: "cargo-build", tool: "cargo build", scope: "project" },
|
|
71136
|
+
// C/C++
|
|
71137
|
+
{ tool_id: "make-build", tool: "make build", scope: "project" },
|
|
71138
|
+
{ tool_id: "make-default", tool: "make", scope: "project" },
|
|
71139
|
+
{ tool_id: "cmake-build", tool: "cmake --build", scope: "project" },
|
|
71140
|
+
// Containers
|
|
71141
|
+
{ tool_id: "docker-build", tool: "docker build", scope: "project" }
|
|
71142
|
+
],
|
|
71143
|
+
clearing_threshold: 3,
|
|
71144
|
+
clearing_patterns: [
|
|
71145
|
+
"**/*.ts",
|
|
71146
|
+
"**/*.tsx",
|
|
71147
|
+
"**/*.js",
|
|
71148
|
+
"**/*.jsx",
|
|
71149
|
+
"**/*.py",
|
|
71150
|
+
"**/*.java",
|
|
71151
|
+
"**/*.kt",
|
|
71152
|
+
"**/*.go",
|
|
71153
|
+
"**/*.rs",
|
|
71154
|
+
"**/*.c",
|
|
71155
|
+
"**/*.cpp",
|
|
71156
|
+
"**/*.cs"
|
|
71157
|
+
]
|
|
71158
|
+
},
|
|
71159
|
+
typecheck: {
|
|
71160
|
+
enabled: true,
|
|
71161
|
+
patterns: [
|
|
71162
|
+
{ tool_id: "tsc-noEmit", tool: "tsc --noEmit", scope: "project" },
|
|
71163
|
+
{ tool_id: "pnpm-filter-typecheck", tool: "pnpm --filter * typecheck", scope: "package" },
|
|
71164
|
+
{ tool_id: "pnpm-typecheck", tool: "pnpm typecheck", scope: "project" },
|
|
71165
|
+
{ tool_id: "npm-typecheck", tool: "npm run typecheck", scope: "project" },
|
|
71166
|
+
{ tool_id: "yarn-workspace-typecheck", tool: "yarn workspace * typecheck", scope: "package" },
|
|
71167
|
+
{ tool_id: "yarn-typecheck", tool: "yarn typecheck", scope: "project" },
|
|
71168
|
+
{ tool_id: "mypy", tool: "mypy", scope: "project" },
|
|
71169
|
+
{ tool_id: "pyright", tool: "pyright", scope: "project" },
|
|
71170
|
+
{ tool_id: "pytype", tool: "pytype", scope: "project" },
|
|
71171
|
+
{ tool_id: "go-vet", tool: "go vet", scope: "project" }
|
|
71172
|
+
],
|
|
71173
|
+
clearing_threshold: 3,
|
|
71174
|
+
clearing_patterns: ["**/*.ts", "**/*.tsx", "**/*.py", "**/*.go"]
|
|
71175
|
+
},
|
|
71176
|
+
test: {
|
|
71177
|
+
enabled: true,
|
|
71178
|
+
patterns: [
|
|
71179
|
+
{ tool_id: "vitest", tool: "vitest", scope: "project" },
|
|
71180
|
+
{ tool_id: "jest", tool: "jest", scope: "project" },
|
|
71181
|
+
{ tool_id: "pnpm-filter-test", tool: "pnpm --filter * test", scope: "package" },
|
|
71182
|
+
{ tool_id: "pnpm-test", tool: "pnpm test", scope: "project" },
|
|
71183
|
+
{ tool_id: "npm-test", tool: "npm test", scope: "project" },
|
|
71184
|
+
{ tool_id: "yarn-workspace-test", tool: "yarn workspace * test", scope: "package" },
|
|
71185
|
+
{ tool_id: "yarn-test", tool: "yarn test", scope: "project" },
|
|
71186
|
+
{ tool_id: "pytest", tool: "pytest", scope: "project" },
|
|
71187
|
+
{ tool_id: "python-pytest", tool: "python -m pytest", scope: "project" },
|
|
71188
|
+
{ tool_id: "python-unittest", tool: "python -m unittest", scope: "project" },
|
|
71189
|
+
{ tool_id: "mvn-test", tool: "mvn test", scope: "project" },
|
|
71190
|
+
{ tool_id: "gradle-test", tool: "gradle test", scope: "project" },
|
|
71191
|
+
{ tool_id: "gradlew-test", tool: "./gradlew test", scope: "project" },
|
|
71192
|
+
{ tool_id: "go-test", tool: "go test", scope: "project" },
|
|
71193
|
+
{ tool_id: "cargo-test", tool: "cargo test", scope: "project" },
|
|
71194
|
+
{ tool_id: "dotnet-test", tool: "dotnet test", scope: "project" },
|
|
71195
|
+
{ tool_id: "make-test", tool: "make test", scope: "project" }
|
|
71196
|
+
],
|
|
71197
|
+
clearing_threshold: 3,
|
|
71198
|
+
clearing_patterns: [
|
|
71199
|
+
"**/*.ts",
|
|
71200
|
+
"**/*.tsx",
|
|
71201
|
+
"**/*.js",
|
|
71202
|
+
"**/*.jsx",
|
|
71203
|
+
"**/*.py",
|
|
71204
|
+
"**/*.java",
|
|
71205
|
+
"**/*.kt",
|
|
71206
|
+
"**/*.go",
|
|
71207
|
+
"**/*.rs",
|
|
71208
|
+
"**/*.test.*",
|
|
71209
|
+
"**/*.spec.*",
|
|
71210
|
+
"**/test_*"
|
|
71211
|
+
]
|
|
71212
|
+
},
|
|
71213
|
+
lint: {
|
|
71214
|
+
enabled: true,
|
|
71215
|
+
patterns: [
|
|
71216
|
+
{ tool_id: "eslint", tool: "eslint", scope: "project" },
|
|
71217
|
+
{ tool_id: "pnpm-filter-lint", tool: "pnpm --filter * lint", scope: "package" },
|
|
71218
|
+
{ tool_id: "pnpm-lint", tool: "pnpm lint", scope: "project" },
|
|
71219
|
+
{ tool_id: "npm-lint", tool: "npm run lint", scope: "project" },
|
|
71220
|
+
{ tool_id: "yarn-workspace-lint", tool: "yarn workspace * lint", scope: "package" },
|
|
71221
|
+
{ tool_id: "yarn-lint", tool: "yarn lint", scope: "project" },
|
|
71222
|
+
{ tool_id: "ruff", tool: "ruff", scope: "project" },
|
|
71223
|
+
{ tool_id: "flake8", tool: "flake8", scope: "project" },
|
|
71224
|
+
{ tool_id: "pylint", tool: "pylint", scope: "project" },
|
|
71225
|
+
{ tool_id: "golangci-lint", tool: "golangci-lint", scope: "project" },
|
|
71226
|
+
{ tool_id: "cargo-clippy", tool: "cargo clippy", scope: "project" },
|
|
71227
|
+
{ tool_id: "ktlint", tool: "ktlint", scope: "project" },
|
|
71228
|
+
{ tool_id: "dotnet-format", tool: "dotnet format", scope: "project" }
|
|
71229
|
+
],
|
|
71230
|
+
clearing_threshold: 5,
|
|
71231
|
+
clearing_patterns: [
|
|
71232
|
+
"**/*.ts",
|
|
71233
|
+
"**/*.tsx",
|
|
71234
|
+
"**/*.js",
|
|
71235
|
+
"**/*.jsx",
|
|
71236
|
+
"**/*.py",
|
|
71237
|
+
"**/*.java",
|
|
71238
|
+
"**/*.kt",
|
|
71239
|
+
"**/*.go",
|
|
71240
|
+
"**/*.rs"
|
|
71241
|
+
]
|
|
71242
|
+
}
|
|
71243
|
+
};
|
|
71082
71244
|
exports2.DEFAULT_SOURCE_CODE_PATTERNS = [
|
|
71083
71245
|
// TypeScript/JavaScript
|
|
71084
71246
|
"**/*.ts",
|
|
@@ -71128,17 +71290,29 @@ var require_types2 = __commonJS({
|
|
|
71128
71290
|
exports2.DEFAULT_REMINDERS_SETTINGS = {
|
|
71129
71291
|
pause_and_reflect_threshold: 60,
|
|
71130
71292
|
source_code_patterns: exports2.DEFAULT_SOURCE_CODE_PATTERNS,
|
|
71131
|
-
max_verification_cycles: -1
|
|
71293
|
+
max_verification_cycles: -1,
|
|
71132
71294
|
// -1 = unlimited, 0 = disabled
|
|
71295
|
+
verification_tools: exports2.DEFAULT_VERIFICATION_TOOLS
|
|
71133
71296
|
};
|
|
71134
71297
|
exports2.ReminderIds = {
|
|
71135
71298
|
USER_PROMPT_SUBMIT: "user-prompt-submit",
|
|
71136
71299
|
PAUSE_AND_REFLECT: "pause-and-reflect",
|
|
71137
71300
|
VERIFY_COMPLETION: "verify-completion",
|
|
71301
|
+
VC_BUILD: "vc-build",
|
|
71302
|
+
VC_TYPECHECK: "vc-typecheck",
|
|
71303
|
+
VC_TEST: "vc-test",
|
|
71304
|
+
VC_LINT: "vc-lint",
|
|
71138
71305
|
REMEMBER_YOUR_PERSONA: "remember-your-persona",
|
|
71139
71306
|
PERSONA_CHANGED: "persona-changed",
|
|
71140
71307
|
USER_PROFILE: "user-profile"
|
|
71141
71308
|
};
|
|
71309
|
+
exports2.VC_TOOL_REMINDER_IDS = [
|
|
71310
|
+
exports2.ReminderIds.VC_BUILD,
|
|
71311
|
+
exports2.ReminderIds.VC_TYPECHECK,
|
|
71312
|
+
exports2.ReminderIds.VC_TEST,
|
|
71313
|
+
exports2.ReminderIds.VC_LINT
|
|
71314
|
+
];
|
|
71315
|
+
exports2.ALL_VC_REMINDER_IDS = [exports2.ReminderIds.VERIFY_COMPLETION, ...exports2.VC_TOOL_REMINDER_IDS];
|
|
71142
71316
|
}
|
|
71143
71317
|
});
|
|
71144
71318
|
|
|
@@ -71204,10 +71378,15 @@ var require_state3 = __commonJS({
|
|
|
71204
71378
|
defaultValue: null,
|
|
71205
71379
|
trackHistory: true
|
|
71206
71380
|
});
|
|
71381
|
+
var VerificationToolsDescriptor = (0, core_1.sessionState)("verification-tools.json", types_1.VerificationToolsStateSchema, {
|
|
71382
|
+
defaultValue: {},
|
|
71383
|
+
trackHistory: false
|
|
71384
|
+
});
|
|
71207
71385
|
function createRemindersState(stateService) {
|
|
71208
71386
|
return {
|
|
71209
71387
|
prBaseline: new core_1.SessionStateAccessor(stateService, PRBaselineDescriptor),
|
|
71210
|
-
vcUnverified: new core_1.SessionStateAccessor(stateService, VCUnverifiedDescriptor)
|
|
71388
|
+
vcUnverified: new core_1.SessionStateAccessor(stateService, VCUnverifiedDescriptor),
|
|
71389
|
+
verificationTools: new core_1.SessionStateAccessor(stateService, VerificationToolsDescriptor)
|
|
71211
71390
|
};
|
|
71212
71391
|
}
|
|
71213
71392
|
}
|
|
@@ -72788,78 +72967,6 @@ var require_picomatch2 = __commonJS({
|
|
|
72788
72967
|
}
|
|
72789
72968
|
});
|
|
72790
72969
|
|
|
72791
|
-
// ../feature-reminders/dist/handlers/staging/stage-stop-reminders.js
|
|
72792
|
-
var require_stage_stop_reminders = __commonJS({
|
|
72793
|
-
"../feature-reminders/dist/handlers/staging/stage-stop-reminders.js"(exports2) {
|
|
72794
|
-
"use strict";
|
|
72795
|
-
var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
|
|
72796
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
72797
|
-
};
|
|
72798
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
72799
|
-
exports2.registerStageStopReminders = registerStageStopReminders;
|
|
72800
|
-
var types_1 = require_dist();
|
|
72801
|
-
var picomatch_1 = __importDefault2(require_picomatch2());
|
|
72802
|
-
var staging_handler_utils_js_1 = require_staging_handler_utils();
|
|
72803
|
-
var types_js_1 = require_types2();
|
|
72804
|
-
var FILE_EDIT_TOOLS = ["Write", "Edit", "MultiEdit"];
|
|
72805
|
-
function registerStageStopReminders(context) {
|
|
72806
|
-
(0, staging_handler_utils_js_1.createStagingHandler)(context, {
|
|
72807
|
-
id: "reminders:stage-stop-reminders",
|
|
72808
|
-
priority: 60,
|
|
72809
|
-
filter: { kind: "transcript", eventTypes: ["ToolCall"] },
|
|
72810
|
-
execute: async (event, ctx) => {
|
|
72811
|
-
if (!(0, types_1.isTranscriptEvent)(event))
|
|
72812
|
-
return void 0;
|
|
72813
|
-
const toolName = event.payload.toolName;
|
|
72814
|
-
if (!toolName || !FILE_EDIT_TOOLS.includes(toolName))
|
|
72815
|
-
return void 0;
|
|
72816
|
-
const featureConfig = context.config.getFeature("reminders");
|
|
72817
|
-
const config = { ...types_js_1.DEFAULT_REMINDERS_SETTINGS, ...featureConfig.settings };
|
|
72818
|
-
const entry = event.payload.entry;
|
|
72819
|
-
const filePath = entry?.input?.file_path;
|
|
72820
|
-
if (!filePath)
|
|
72821
|
-
return void 0;
|
|
72822
|
-
const isMatch = picomatch_1.default.isMatch(filePath, config.source_code_patterns);
|
|
72823
|
-
if (!isMatch) {
|
|
72824
|
-
ctx.logger.debug("VC staging: file edit skipped (no pattern match)", {
|
|
72825
|
-
toolName,
|
|
72826
|
-
filePath
|
|
72827
|
-
});
|
|
72828
|
-
return void 0;
|
|
72829
|
-
}
|
|
72830
|
-
const metrics = event.metadata.metrics;
|
|
72831
|
-
const lastConsumed = await ctx.staging.getLastConsumed("Stop", types_js_1.ReminderIds.VERIFY_COMPLETION);
|
|
72832
|
-
if (lastConsumed?.stagedAt) {
|
|
72833
|
-
const shouldReactivate = metrics.turnCount > lastConsumed.stagedAt.turnCount;
|
|
72834
|
-
if (!shouldReactivate) {
|
|
72835
|
-
ctx.logger.debug("VC staging: skipped (already consumed this turn)", {
|
|
72836
|
-
currentTurn: metrics.turnCount,
|
|
72837
|
-
lastConsumedTurn: lastConsumed.stagedAt.turnCount
|
|
72838
|
-
});
|
|
72839
|
-
return void 0;
|
|
72840
|
-
}
|
|
72841
|
-
ctx.logger.info("VC staging: reactivating on new turn", {
|
|
72842
|
-
currentTurn: metrics.turnCount,
|
|
72843
|
-
lastConsumedTurn: lastConsumed.stagedAt.turnCount
|
|
72844
|
-
});
|
|
72845
|
-
}
|
|
72846
|
-
ctx.logger.info("VC staging: staging verify-completion", {
|
|
72847
|
-
toolName,
|
|
72848
|
-
filePath,
|
|
72849
|
-
turnCount: metrics.turnCount,
|
|
72850
|
-
toolCount: metrics.toolCount,
|
|
72851
|
-
firstTimeThisSession: !lastConsumed
|
|
72852
|
-
});
|
|
72853
|
-
return {
|
|
72854
|
-
reminderId: types_js_1.ReminderIds.VERIFY_COMPLETION,
|
|
72855
|
-
targetHook: "Stop"
|
|
72856
|
-
};
|
|
72857
|
-
}
|
|
72858
|
-
});
|
|
72859
|
-
}
|
|
72860
|
-
}
|
|
72861
|
-
});
|
|
72862
|
-
|
|
72863
72970
|
// ../feature-reminders/dist/handlers/staging/stage-stop-bash-changes.js
|
|
72864
72971
|
var require_stage_stop_bash_changes = __commonJS({
|
|
72865
72972
|
"../feature-reminders/dist/handlers/staging/stage-stop-bash-changes.js"(exports2) {
|
|
@@ -72975,6 +73082,226 @@ var require_stage_stop_bash_changes = __commonJS({
|
|
|
72975
73082
|
}
|
|
72976
73083
|
});
|
|
72977
73084
|
|
|
73085
|
+
// ../feature-reminders/dist/tool-pattern-matcher.js
|
|
73086
|
+
var require_tool_pattern_matcher = __commonJS({
|
|
73087
|
+
"../feature-reminders/dist/tool-pattern-matcher.js"(exports2) {
|
|
73088
|
+
"use strict";
|
|
73089
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
73090
|
+
exports2.matchesToolPattern = matchesToolPattern;
|
|
73091
|
+
exports2.findMatchingPattern = findMatchingPattern;
|
|
73092
|
+
var SHELL_OPERATOR_RE = /\s*(?:&&|\|\||[;|])\s*/;
|
|
73093
|
+
function matchesToolPattern(command, pattern) {
|
|
73094
|
+
if (!command || !pattern)
|
|
73095
|
+
return false;
|
|
73096
|
+
const segments = command.split(SHELL_OPERATOR_RE);
|
|
73097
|
+
const patternTokens = pattern.trim().split(/\s+/).filter(Boolean);
|
|
73098
|
+
if (patternTokens.length === 0)
|
|
73099
|
+
return false;
|
|
73100
|
+
return segments.some((segment) => {
|
|
73101
|
+
const cmdTokens = segment.trim().split(/\s+/);
|
|
73102
|
+
if (cmdTokens.length === 0 || cmdTokens[0] === "")
|
|
73103
|
+
return false;
|
|
73104
|
+
if (cmdTokens[0] !== patternTokens[0])
|
|
73105
|
+
return false;
|
|
73106
|
+
let pi = 1;
|
|
73107
|
+
for (let ci = 1; ci < cmdTokens.length && pi < patternTokens.length; ci++) {
|
|
73108
|
+
if (patternTokens[pi] === "*" || patternTokens[pi] === cmdTokens[ci]) {
|
|
73109
|
+
pi++;
|
|
73110
|
+
}
|
|
73111
|
+
}
|
|
73112
|
+
return pi === patternTokens.length;
|
|
73113
|
+
});
|
|
73114
|
+
}
|
|
73115
|
+
function findMatchingPattern(command, patterns) {
|
|
73116
|
+
for (const pattern of patterns) {
|
|
73117
|
+
if (pattern.tool === null)
|
|
73118
|
+
continue;
|
|
73119
|
+
if (matchesToolPattern(command, pattern.tool))
|
|
73120
|
+
return pattern;
|
|
73121
|
+
}
|
|
73122
|
+
return null;
|
|
73123
|
+
}
|
|
73124
|
+
}
|
|
73125
|
+
});
|
|
73126
|
+
|
|
73127
|
+
// ../feature-reminders/dist/handlers/staging/track-verification-tools.js
|
|
73128
|
+
var require_track_verification_tools = __commonJS({
|
|
73129
|
+
"../feature-reminders/dist/handlers/staging/track-verification-tools.js"(exports2) {
|
|
73130
|
+
"use strict";
|
|
73131
|
+
var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
|
|
73132
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
73133
|
+
};
|
|
73134
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
73135
|
+
exports2.registerTrackVerificationTools = registerTrackVerificationTools;
|
|
73136
|
+
var types_1 = require_dist();
|
|
73137
|
+
var picomatch_1 = __importDefault2(require_picomatch2());
|
|
73138
|
+
var tool_pattern_matcher_js_1 = require_tool_pattern_matcher();
|
|
73139
|
+
var reminder_utils_js_1 = require_reminder_utils();
|
|
73140
|
+
var types_js_1 = require_types2();
|
|
73141
|
+
var state_js_1 = require_state3();
|
|
73142
|
+
var FILE_EDIT_TOOLS = ["Write", "Edit", "MultiEdit"];
|
|
73143
|
+
var TOOL_REMINDER_MAP = {
|
|
73144
|
+
build: types_js_1.ReminderIds.VC_BUILD,
|
|
73145
|
+
typecheck: types_js_1.ReminderIds.VC_TYPECHECK,
|
|
73146
|
+
test: types_js_1.ReminderIds.VC_TEST,
|
|
73147
|
+
lint: types_js_1.ReminderIds.VC_LINT
|
|
73148
|
+
};
|
|
73149
|
+
var VC_TOOL_NAME_SET = new Set(types_js_1.VC_TOOL_REMINDER_IDS);
|
|
73150
|
+
function extractToolInput(event) {
|
|
73151
|
+
const entry = event.payload.entry;
|
|
73152
|
+
return entry?.input;
|
|
73153
|
+
}
|
|
73154
|
+
function registerTrackVerificationTools(context) {
|
|
73155
|
+
if (!(0, types_1.isDaemonContext)(context))
|
|
73156
|
+
return;
|
|
73157
|
+
context.handlers.register({
|
|
73158
|
+
id: "reminders:track-verification-tools",
|
|
73159
|
+
priority: 60,
|
|
73160
|
+
filter: { kind: "transcript", eventTypes: ["ToolCall"] },
|
|
73161
|
+
handler: async (event, ctx) => {
|
|
73162
|
+
if (!(0, types_1.isTranscriptEvent)(event))
|
|
73163
|
+
return;
|
|
73164
|
+
if (event.metadata.isBulkProcessing)
|
|
73165
|
+
return;
|
|
73166
|
+
if (!(0, types_1.isDaemonContext)(ctx))
|
|
73167
|
+
return;
|
|
73168
|
+
const daemonCtx = ctx;
|
|
73169
|
+
const sessionId = event.context?.sessionId;
|
|
73170
|
+
if (!sessionId)
|
|
73171
|
+
return;
|
|
73172
|
+
const toolName = event.payload.toolName;
|
|
73173
|
+
if (!toolName)
|
|
73174
|
+
return;
|
|
73175
|
+
const featureConfig = context.config.getFeature("reminders");
|
|
73176
|
+
const config = { ...types_js_1.DEFAULT_REMINDERS_SETTINGS, ...featureConfig.settings };
|
|
73177
|
+
const verificationTools = config.verification_tools ?? {};
|
|
73178
|
+
const remindersState = (0, state_js_1.createRemindersState)(daemonCtx.stateService);
|
|
73179
|
+
const stateResult = await remindersState.verificationTools.read(sessionId);
|
|
73180
|
+
const toolsState = { ...stateResult.data };
|
|
73181
|
+
if (FILE_EDIT_TOOLS.includes(toolName)) {
|
|
73182
|
+
await handleFileEdit(event, daemonCtx, sessionId, verificationTools, toolsState, remindersState);
|
|
73183
|
+
} else if (toolName === "Bash") {
|
|
73184
|
+
await handleBashCommand(event, daemonCtx, sessionId, verificationTools, toolsState, remindersState);
|
|
73185
|
+
}
|
|
73186
|
+
}
|
|
73187
|
+
});
|
|
73188
|
+
}
|
|
73189
|
+
async function handleFileEdit(event, daemonCtx, sessionId, verificationTools, toolsState, remindersState) {
|
|
73190
|
+
const filePath = extractToolInput(event)?.file_path;
|
|
73191
|
+
if (!filePath)
|
|
73192
|
+
return;
|
|
73193
|
+
const projectDir = daemonCtx.paths?.projectDir;
|
|
73194
|
+
if (projectDir && !filePath.startsWith(projectDir))
|
|
73195
|
+
return;
|
|
73196
|
+
const existingReminders = await daemonCtx.staging.listReminders("Stop");
|
|
73197
|
+
const stagedNames = new Set(existingReminders.map((r) => r.name));
|
|
73198
|
+
let anyStaged = false;
|
|
73199
|
+
for (const [toolName, toolConfig] of Object.entries(verificationTools)) {
|
|
73200
|
+
if (!toolConfig.enabled)
|
|
73201
|
+
continue;
|
|
73202
|
+
const reminderId = TOOL_REMINDER_MAP[toolName];
|
|
73203
|
+
if (!reminderId)
|
|
73204
|
+
continue;
|
|
73205
|
+
if (!picomatch_1.default.isMatch(filePath, toolConfig.clearing_patterns))
|
|
73206
|
+
continue;
|
|
73207
|
+
const current = toolsState[toolName];
|
|
73208
|
+
if (!current || current.status === "staged") {
|
|
73209
|
+
if (!current) {
|
|
73210
|
+
toolsState[toolName] = {
|
|
73211
|
+
status: "staged",
|
|
73212
|
+
editsSinceVerified: 0,
|
|
73213
|
+
lastVerifiedAt: null,
|
|
73214
|
+
lastStagedAt: Date.now()
|
|
73215
|
+
};
|
|
73216
|
+
}
|
|
73217
|
+
await stageToolReminderIfNeeded(daemonCtx, reminderId, stagedNames);
|
|
73218
|
+
anyStaged = true;
|
|
73219
|
+
} else {
|
|
73220
|
+
const newEdits = current.editsSinceVerified + 1;
|
|
73221
|
+
if (newEdits >= toolConfig.clearing_threshold) {
|
|
73222
|
+
toolsState[toolName] = {
|
|
73223
|
+
...current,
|
|
73224
|
+
status: "staged",
|
|
73225
|
+
editsSinceVerified: 0,
|
|
73226
|
+
lastStagedAt: Date.now()
|
|
73227
|
+
};
|
|
73228
|
+
await stageToolReminderIfNeeded(daemonCtx, reminderId, stagedNames);
|
|
73229
|
+
anyStaged = true;
|
|
73230
|
+
} else {
|
|
73231
|
+
toolsState[toolName] = {
|
|
73232
|
+
...current,
|
|
73233
|
+
status: "cooldown",
|
|
73234
|
+
editsSinceVerified: newEdits
|
|
73235
|
+
};
|
|
73236
|
+
}
|
|
73237
|
+
}
|
|
73238
|
+
}
|
|
73239
|
+
if (anyStaged) {
|
|
73240
|
+
await stageToolReminderIfNeeded(daemonCtx, types_js_1.ReminderIds.VERIFY_COMPLETION, stagedNames);
|
|
73241
|
+
}
|
|
73242
|
+
await remindersState.verificationTools.write(sessionId, toolsState);
|
|
73243
|
+
}
|
|
73244
|
+
async function handleBashCommand(event, daemonCtx, sessionId, verificationTools, toolsState, remindersState) {
|
|
73245
|
+
const command = extractToolInput(event)?.command;
|
|
73246
|
+
if (!command)
|
|
73247
|
+
return;
|
|
73248
|
+
let anyUnstaged = false;
|
|
73249
|
+
for (const [toolName, toolConfig] of Object.entries(verificationTools)) {
|
|
73250
|
+
if (!toolConfig.enabled)
|
|
73251
|
+
continue;
|
|
73252
|
+
const reminderId = TOOL_REMINDER_MAP[toolName];
|
|
73253
|
+
if (!reminderId)
|
|
73254
|
+
continue;
|
|
73255
|
+
const match = (0, tool_pattern_matcher_js_1.findMatchingPattern)(command, toolConfig.patterns);
|
|
73256
|
+
if (!match)
|
|
73257
|
+
continue;
|
|
73258
|
+
toolsState[toolName] = {
|
|
73259
|
+
status: "verified",
|
|
73260
|
+
editsSinceVerified: 0,
|
|
73261
|
+
lastVerifiedAt: Date.now(),
|
|
73262
|
+
lastStagedAt: toolsState[toolName]?.lastStagedAt ?? null,
|
|
73263
|
+
lastMatchedToolId: match.tool_id,
|
|
73264
|
+
lastMatchedScope: match.scope
|
|
73265
|
+
};
|
|
73266
|
+
await daemonCtx.staging.deleteReminder("Stop", reminderId);
|
|
73267
|
+
anyUnstaged = true;
|
|
73268
|
+
daemonCtx.logger.debug("VC tool verified", {
|
|
73269
|
+
toolName,
|
|
73270
|
+
reminderId,
|
|
73271
|
+
matchedToolId: match.tool_id,
|
|
73272
|
+
matchedScope: match.scope,
|
|
73273
|
+
command: command.slice(0, 100)
|
|
73274
|
+
});
|
|
73275
|
+
}
|
|
73276
|
+
if (anyUnstaged) {
|
|
73277
|
+
const remaining = await daemonCtx.staging.listReminders("Stop");
|
|
73278
|
+
const hasPerToolReminders = remaining.some((r) => VC_TOOL_NAME_SET.has(r.name));
|
|
73279
|
+
if (!hasPerToolReminders) {
|
|
73280
|
+
await daemonCtx.staging.deleteReminder("Stop", types_js_1.ReminderIds.VERIFY_COMPLETION);
|
|
73281
|
+
daemonCtx.logger.info("All VC tools verified, unstaged wrapper", { sessionId });
|
|
73282
|
+
}
|
|
73283
|
+
await remindersState.verificationTools.write(sessionId, toolsState);
|
|
73284
|
+
}
|
|
73285
|
+
}
|
|
73286
|
+
async function stageToolReminderIfNeeded(daemonCtx, reminderId, stagedNames) {
|
|
73287
|
+
if (stagedNames.has(reminderId))
|
|
73288
|
+
return;
|
|
73289
|
+
const reminder = (0, reminder_utils_js_1.resolveReminder)(reminderId, {
|
|
73290
|
+
context: {},
|
|
73291
|
+
assets: daemonCtx.assets
|
|
73292
|
+
});
|
|
73293
|
+
if (!reminder) {
|
|
73294
|
+
daemonCtx.logger.warn("Failed to resolve VC tool reminder", { reminderId });
|
|
73295
|
+
return;
|
|
73296
|
+
}
|
|
73297
|
+
await (0, reminder_utils_js_1.stageReminder)(daemonCtx, "Stop", {
|
|
73298
|
+
...reminder,
|
|
73299
|
+
stagedAt: { timestamp: Date.now(), turnCount: 0, toolsThisTurn: 0, toolCount: 0 }
|
|
73300
|
+
});
|
|
73301
|
+
}
|
|
73302
|
+
}
|
|
73303
|
+
});
|
|
73304
|
+
|
|
72978
73305
|
// ../feature-reminders/dist/handlers/staging/unstage-verify-completion.js
|
|
72979
73306
|
var require_unstage_verify_completion = __commonJS({
|
|
72980
73307
|
"../feature-reminders/dist/handlers/staging/unstage-verify-completion.js"(exports2) {
|
|
@@ -73059,8 +73386,10 @@ var require_unstage_verify_completion = __commonJS({
|
|
|
73059
73386
|
hadState: unverifiedState !== null
|
|
73060
73387
|
});
|
|
73061
73388
|
}
|
|
73062
|
-
|
|
73063
|
-
|
|
73389
|
+
for (const vcId of types_js_1.ALL_VC_REMINDER_IDS) {
|
|
73390
|
+
await daemonCtx.staging.deleteReminder("Stop", vcId);
|
|
73391
|
+
}
|
|
73392
|
+
daemonCtx.logger.debug("VC unstage: deleted all VC reminders");
|
|
73064
73393
|
}
|
|
73065
73394
|
});
|
|
73066
73395
|
}
|
|
@@ -73291,15 +73620,15 @@ var require_staging2 = __commonJS({
|
|
|
73291
73620
|
exports2.registerStagingHandlers = registerStagingHandlers;
|
|
73292
73621
|
var stage_default_user_prompt_1 = require_stage_default_user_prompt();
|
|
73293
73622
|
var stage_pause_and_reflect_1 = require_stage_pause_and_reflect();
|
|
73294
|
-
var stage_stop_reminders_1 = require_stage_stop_reminders();
|
|
73295
73623
|
var stage_stop_bash_changes_1 = require_stage_stop_bash_changes();
|
|
73624
|
+
var track_verification_tools_1 = require_track_verification_tools();
|
|
73296
73625
|
var unstage_verify_completion_1 = require_unstage_verify_completion();
|
|
73297
73626
|
var stage_persona_reminders_1 = require_stage_persona_reminders();
|
|
73298
73627
|
var stage_user_profile_reminders_1 = require_stage_user_profile_reminders();
|
|
73299
73628
|
function registerStagingHandlers(context) {
|
|
73300
73629
|
(0, stage_default_user_prompt_1.registerStageDefaultUserPrompt)(context);
|
|
73301
73630
|
(0, stage_pause_and_reflect_1.registerStagePauseAndReflect)(context);
|
|
73302
|
-
(0,
|
|
73631
|
+
(0, track_verification_tools_1.registerTrackVerificationTools)(context);
|
|
73303
73632
|
(0, stage_stop_bash_changes_1.registerStageBashChanges)(context);
|
|
73304
73633
|
(0, unstage_verify_completion_1.registerUnstageVerifyCompletion)(context);
|
|
73305
73634
|
(0, stage_persona_reminders_1.registerStagePersonaReminders)(context);
|
|
@@ -74011,10 +74340,12 @@ var require_orchestrator = __commonJS({
|
|
|
74011
74340
|
if (reminder.name === types_js_1.ReminderIds.PAUSE_AND_REFLECT) {
|
|
74012
74341
|
try {
|
|
74013
74342
|
const staging = this.deps.getStagingService(sessionId);
|
|
74014
|
-
|
|
74015
|
-
|
|
74343
|
+
for (const vcId of types_js_1.ALL_VC_REMINDER_IDS) {
|
|
74344
|
+
await staging.deleteReminder("Stop", vcId);
|
|
74345
|
+
}
|
|
74346
|
+
this.deps.logger.debug("Unstaged all VC reminders after P&R staged", { sessionId });
|
|
74016
74347
|
} catch (err) {
|
|
74017
|
-
this.deps.logger.warn("Failed to unstage VC after P&R staged", {
|
|
74348
|
+
this.deps.logger.warn("Failed to unstage VC reminders after P&R staged", {
|
|
74018
74349
|
sessionId,
|
|
74019
74350
|
error: err instanceof Error ? err.message : String(err)
|
|
74020
74351
|
});
|
|
@@ -77532,7 +77863,7 @@ var require_statusline_service = __commonJS({
|
|
|
77532
77863
|
if (this.hookInput) {
|
|
77533
77864
|
const usage = this.hookInput.context_window.current_usage;
|
|
77534
77865
|
if (usage) {
|
|
77535
|
-
effectiveTokens = usage.input_tokens + usage.cache_creation_input_tokens + usage.cache_read_input_tokens;
|
|
77866
|
+
effectiveTokens = usage.input_tokens + usage.output_tokens + usage.cache_creation_input_tokens + usage.cache_read_input_tokens;
|
|
77536
77867
|
} else {
|
|
77537
77868
|
const transcriptTokens = state.currentContextTokens;
|
|
77538
77869
|
if (transcriptTokens != null && transcriptTokens > 0) {
|
|
@@ -77542,8 +77873,9 @@ var require_statusline_service = __commonJS({
|
|
|
77542
77873
|
effectiveTokens = 0;
|
|
77543
77874
|
}
|
|
77544
77875
|
}
|
|
77545
|
-
|
|
77546
|
-
|
|
77876
|
+
const baselineMinimum = baseline.totalOverhead - baseline.autocompactBufferTokens;
|
|
77877
|
+
if (effectiveTokens < baselineMinimum) {
|
|
77878
|
+
effectiveTokens = baselineMinimum;
|
|
77547
77879
|
usingBaseline = true;
|
|
77548
77880
|
}
|
|
77549
77881
|
} else {
|
|
@@ -82184,7 +82516,7 @@ var require_cli = __commonJS({
|
|
|
82184
82516
|
var promises_12 = require("node:fs/promises");
|
|
82185
82517
|
var node_stream_1 = require("node:stream");
|
|
82186
82518
|
var yargs_parser_1 = __importDefault2(require_build());
|
|
82187
|
-
var VERSION = true ? "0.1.
|
|
82519
|
+
var VERSION = true ? "0.1.4" : "dev";
|
|
82188
82520
|
var SANDBOX_ERROR_MESSAGE = `Error: Daemon commands cannot run in sandbox mode.
|
|
82189
82521
|
|
|
82190
82522
|
Claude Code's sandbox blocks Unix socket operations required for daemon IPC.
|